Index: kbd/pcwk/circuit.txt
===================================================================
--- kbd/pcwk/circuit.txt	(revision a3eb2c64521acdacf6215facc97a3a6ba0e1bf05)
+++ kbd/pcwk/circuit.txt	(revision a3eb2c64521acdacf6215facc97a3a6ba0e1bf05)
@@ -0,0 +1,1 @@
+The circuit used for ps2toserial is the same as the one for ak2serial, so see you there !
Index: kbd/pcwk/code/Makefile
===================================================================
--- kbd/pcwk/code/Makefile	(revision a3eb2c64521acdacf6215facc97a3a6ba0e1bf05)
+++ kbd/pcwk/code/Makefile	(revision a3eb2c64521acdacf6215facc97a3a6ba0e1bf05)
@@ -0,0 +1,14 @@
+CC := $(shell { which avr-gcc || which avr-gcc-x86; } 2>/dev/null)
+OBJCOPY := $(shell { which avr-objcopy || which avr-objcopy-x86; } 2>/dev/null)
+
+keyboard.hex: keyboard.bin
+	$(OBJCOPY) -j .text -j .data -O ihex keyboard.bin keyboard.hex
+
+keyboard.bin: keyboard.o main.o
+	$(CC) keyboard.o main.o -o keyboard.bin -mmcu=atmega8 -Os
+
+main.o: main.c ../../libs/usart/usart.h ../../libs/ps2_keyboard/ps2_keyboard.h
+	$(CC) -std=c99 -c main.c -mmcu=atmega8 -Os -o main.o -mmcu=atmega8 -Os
+
+keyboard.o: ../../libs/ps2_keyboard/ps2_keyboard.c ../../libs/ps2_keyboard/ps2_keyboard.h ../../libs/ps2_keyboard/keymap.h
+	$(CC) -DCALLBACK="callback();" -c ../../libs/ps2_keyboard/ps2_keyboard.c -mmcu=atmega8 -Os -o keyboard.o
Index: kbd/pcwk/code/keyboard.hex
===================================================================
--- kbd/pcwk/code/keyboard.hex	(revision a3eb2c64521acdacf6215facc97a3a6ba0e1bf05)
+++ kbd/pcwk/code/keyboard.hex	(revision a3eb2c64521acdacf6215facc97a3a6ba0e1bf05)
@@ -0,0 +1,59 @@
+:1000000092C0A1C0A1C09FC09EC09DC09CC09BC00B
+:100010009AC099C098C097C096C095C094C093C02C
+:1000200092C091C090C03F3F3F3F3F3F3F3F3F3F67
+:100030003F3F3F3F3F3F3F3F3F3F3F71313F3F3FAC
+:100040007A736177323F3F6378646534333F3F2092
+:1000500076667472353F3F6E62686779363F3F3F20
+:100060006D6A7537383F3F3F6B696F30393F3F3FAF
+:100070003F6C3F703F3F3F3F3F3F3F3F3F3F3F3F32
+:100080003F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F80
+:100090003F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F70
+:1000A0003F3F3F3F3F3F3F203FA000023F123F0303
+:1000B000A43F3F84263F3FA7263FA183803F3F3F89
+:1000C00087748573813F3F7677757270713F3F57B4
+:1000D00067656362613F3F5666546453603F3F3FCC
+:1000E00046555251503F3F2C45434240413F3F37D8
+:1000F00023443533313F3F3F3F1132303F3F862568
+:10010000222136343F3F3F3F3F3F3F3F973F3F171E
+:100110003F15243F3F3F01A60716051482A513276C
+:1001200006A3A204103F11241FBECFE5D4E0DEBF1A
+:10013000CDBF10E0A0E6B0E001C01D92A637B10728
+:10014000E1F7BFD024C15CCF1F920F920FB60F9280
+:1001500011242F933F934F935F936F937F938F93CC
+:100160009F93AF93BF93EF93FF9382B390E489275C
+:1001700082BB83994EC080916200811108C084992E
+:1001800026C081E0809362001092610027C0209118
+:100190006100283090F4849B0CC03091640081E0B1
+:1001A00090E0022E01C0880F0A94EAF7382B3093B2
+:1001B00064002F5F209361002CC0283021F489E077
+:1001C0008093610026C010926200109261008091BD
+:1001D0006400803F31F481E08093650010926400F8
+:1001E00018C09091640080916500923149F48111AA
+:1001F00004C081E0809360000CC01092600002C0D7
+:10020000882319F01092650004C081E08093630098
+:1002100037D0FF91EF91BF91AF919F918F917F91D7
+:100220006F915F914F913F912F910F900FBE0F9063
+:100230001F901895E82FF0E0EA5DFF4F84919091B0
+:100240006000911180520895809163008823E1F34A
+:1002500010926300809164000895109262001092E1
+:100260006400109261008B98839A85B7886085BF7F
+:1002700085B78B7F85BF8BB780688BBF78940895D7
+:10028000E3DFE82FF0E0EA55FF4FE491809165004D
+:10029000AE2FA295AF70EF70B0E0AA59BF4F21E02A
+:1002A00030E00E2E01C0220F0A94EAF7882329F0CD
+:1002B00020958C9128232C9308958C91822B8C93DC
+:1002C0000895CBDF18BA86E087BB8E9A8FEF9FEF39
+:1002D00064E068BB20E22A95F1F718BA40E24A953B
+:1002E000F1F768BBE0E2EA95F1F718BAF0E2FA95A7
+:1002F000F1F724E030E021503109C0F0AC01022ECA
+:1003000002C0559547950A94E2F740FF02C068BBCA
+:1003100001C018BA40E24A95F1F7C19AE0E4EA95C3
+:10032000F1F718BAF0E7FA95F1F7E5CFE7EDF0E06D
+:100330003197F1F700C0000028E030E0FC01EF70D9
+:10034000FF27EA59FF4F21503109C8F0408150E0A2
+:10035000022E02C0559547950A94E2F740FF02C06D
+:1003600068BB01C018BA40E24A95F1F7C19A40E46F
+:100370004A95F1F718BA40E74A95F1F7E4CF0196AC
+:10038000803191050CF4A5CF8FEF9FEFA2CFF894A9
+:02039000FFCF9D
+:00000001FF
Index: kbd/pcwk/code/main.c
===================================================================
--- kbd/pcwk/code/main.c	(revision a3eb2c64521acdacf6215facc97a3a6ba0e1bf05)
+++ kbd/pcwk/code/main.c	(revision a3eb2c64521acdacf6215facc97a3a6ba0e1bf05)
@@ -0,0 +1,102 @@
+#define F_CPU 16000000UL
+
+#include <avr/io.h>
+#include <avr/pgmspace.h>
+#include <util/delay.h>
+
+#include "../../libs/ps2_keyboard/ps2_keyboard.h"
+
+uint8_t keys[16];
+
+const uint8_t pcw[128] PROGMEM = {
+// 0   1   2   3    4    5    6    7    8    9    A    B    C    D    E    F
+'?' ,0x20,'?' ,0xA0,0x00,0x02,'?' ,0x12,'?' ,0x03,0xA4,'?' ,'?' ,0x84,0x26,'?', // 0
+'?' ,0xA7,0x26,'?' ,0xA1,0x83,0x80,'?' ,'?' ,'?' ,0x87,0x74,0x85,0x73,0x81,'?', // 1
+'?' ,0x76,0x77,0x75,0x72,0x70,0x71,'?' ,'?' ,0x57,0x67,0x65,0x63,0x62,0x61,'?', // 2
+'?' ,0x56,0x66,0x54,0x64,0x53,0x60,'?' ,'?' ,'?' ,0x46,0x55,0x52,0x51,0x50,'?', // 3
+'?' ,',' ,0x45,0x43,0x42,0x40,0x41,'?' ,'?' ,0x37,0x23,0x44,0x35,0x33,0x31,'?', // 4
+'?' ,'?' ,'?' ,0x11,0x32,0x30,'?' ,'?' ,0x86,0x25,0x22,0x21,0x36,0x34,'?' ,'?', // 5
+'?' ,'?' ,'?' ,'?' ,'?' ,'?' ,0x97,'?' ,'?' ,0x17,'?' ,0x15,0x24,'?' ,'?' ,'?', // 6
+0x01,0xA6,0x07,0x16,0x05,0x14,0x82,0xA5,0x13,0x27,0x06,0xA3,0xA2,0x04,0x10,'?'  // 7
+};
+
+
+void callback()
+{
+	uint8_t key_code = 0;
+	key_code = read_char(); // TODO this is blocking function
+
+	uint8_t decode = pgm_read_byte(&(pcw[key_code]));
+	if(release)
+		keys[decode >> 4] &= ~(1 << (decode & 0xF));
+	else
+		keys[decode >> 4] |= 1 << (decode & 0xF);
+}
+
+
+int main() {
+  init_keyboard(); 
+
+  // PCW init - configure pins directions
+  PORTB = 0;
+  DDRB = 0x6; // PB1 and PB2 as outputs
+
+  //debug LED - output
+  DDRD |= (1<<PD6);
+
+
+  while(1) {
+	for(int idx = -1; idx < 16; idx++)
+	{
+		// send data to PCW
+		
+		// Start pulse
+		PORTB = 4;
+		_delay_us(6);
+		PORTB = 0;
+		_delay_us(6);
+		PORTB = 4;
+		_delay_us(6);
+		PORTB = 0;
+		_delay_us(6);
+
+		// Address
+		for(int j = 4; --j >= 0;)
+		{
+			if(idx & (1<<j))
+				PORTB = 4;
+			else
+				PORTB = 0;
+
+			// Clock
+			_delay_us(6);
+			PORTB |= 2;
+			_delay_us(12);
+			PORTB = 0;
+			_delay_us(21);
+		}
+
+		// One "empty" clock cycle
+		_delay_us(21 + 33);
+
+		// Data
+		for(int j = 8; --j >= 0;)
+		{
+			if (keys[idx & 0xF] & (1 << j)) 
+				PORTB = 4;
+			else
+				PORTB = 0;
+
+			// Clock
+			_delay_us(6);
+			PORTB |= 2;
+			_delay_us(12);
+			PORTB = 0;
+			_delay_us(21);
+		}
+	}
+  }
+  
+  return 0;
+}
+
Index: kbd/pcwk/doc/scancode_table.txt
===================================================================
--- kbd/pcwk/doc/scancode_table.txt	(revision a3eb2c64521acdacf6215facc97a3a6ba0e1bf05)
+++ kbd/pcwk/doc/scancode_table.txt	(revision a3eb2c64521acdacf6215facc97a3a6ba0e1bf05)
@@ -0,0 +1,139 @@
+KEY	MAKE	BREAK
+
+
+F9	01	F0,01	 	
+F5	03	F0,03	 	
+F3	04	F0,04	 	
+F1	05	F0,05	 	
+F2	06	F0,06	 	
+F12	07	F0,07	 	
+F10	09	F0,09	 	
+F8	0A	F0,0A	 	
+F6	0B	F0,0B	 	
+F4	0C	F0,0C	 	
+TAB	0D	F0,0D	 	
+`	0E	F0,0E	 	
+
+L ALT	11	F0,11	 	
+L SHFT	12	FO,12	 	
+L CTRL	14	FO,14	 	
+Q	15	F0,15	 	
+1	16	F0,16	 	
+Z	1A	F0,1A	 	
+S	1B	F0,1B	 	
+A	1C	F0,1C	 	
+W	1D	F0,1D	 	
+2	1E	F0,1E	 	
+
+C	21	F0,21	 	
+X	22	F0,22	 	
+D	23	F0,23	 	
+E	24	F0,24	 	
+4	25	F0,25	 	
+3	26	F0,26	 	
+SPACE	29	F0,29	 	
+V	2A	F0,2A	 	
+F	2B	F0,2B	 	
+T	2C	F0,2C	 	
+R	2D	F0,2D	 	
+5	2E	F0,2E	 	
+
+N	31	F0,31	 	
+B	32	F0,32	 	
+H	33	F0,33	 	
+G	34	F0,34	 	
+Y	35	F0,35	 	
+6	36	F0,36	 	
+M	3A	F0,3A	 	
+J	3B	F0,3B	 	
+U	3C	F0,3C	 	
+7	3D	F0,3D	 	
+8	3E	F0,3E	 	
+
+,	41	F0,41
+K	42	F0,42	 	
+I	43	F0,43	 	
+O	44	F0,44	 	
+0	45	F0,45	 	
+9	46	F0,46	 	
+.	49	F0,49
+/	4A	F0,4A
+L	4B	F0,4B	 	
+;	4C	F0,4C
+P	4D	F0,4D	 	
+-	4E	F0,4E	 	
+
+'	52	F0,52
+[	54	FO,54
+=	55	FO,55	 	
+CAPS	58	F0,58	 	
+R SHFT	59	F0,59	 	
+ENTER	5A	F0,5A	 	
+]	5B	F0,5B
+\	5D	F0,5D	 	
+
+BKSP	66	F0,66	 	
+KP 1	69	F0,69
+KP 4	6B	F0,6B
+KP 7	6C	F0,6C
+
+KP 0	70	F0,70
+KP .	71	F0,71
+KP 2	72	F0,72
+KP 5	73	F0,73
+KP 6	74	F0,74
+KP 8	75	F0,75
+ESC	76	F0,76	 	
+NUM	77	F0,77
+F11	78	F0,78	 	
+KP +	79	F0,79
+KP 3	7A	F0,7A
+KP -	7B	F0,7B
+KP *	7C	F0,7C
+KP 9	7D	F0,7D
+SCROLL	7E	F0,7E	 	
+
+F7	83	F0,83	 	
+
+WWW Search	E0, 10	E0, F0, 10
+R ALT	E0,11	E0,F0,11	 	
+R CTRL	E0,14	E0,F0,14	 	
+Previous Track	E0, 15	E0, F0, 15
+WWW Favorites	E0, 18	E0, F0, 18
+L GUI	E0,1F	E0,F0,1F	 	
+WWW Refresh	E0, 20	E0, F0, 20
+Volume Down	E0, 21	E0, F0, 21
+Mute	E0, 23	E0, F0, 23
+R GUI	E0,27	E0,F0,27	 	
+WWW Stop	E0, 28	E0, F0, 28
+Calculator	E0, 2B	E0, F0, 2B
+APPS	E0,2F	E0,F0,2F
+WWW Forward	E0, 30	E0, F0, 30
+Volume Up	E0, 32	E0, F0, 32
+Play/Pause	E0, 34	E0, F0, 34
+Power	E0,37
+WWW Back	E0, 38	E0, F0, 38
+WWW Home	E0, 3A	E0, F0, 3A
+Stop	E0, 3B	E0, F0, 3B
+Sleep	E0,3F
+My Computer	E0, 40	E0, F0, 40
+E-Mail	E0, 48	E0, F0, 48
+KP /	E0,4A	E0,F0,4A
+Next Track	E0, 4D	E0, F0, 4D 
+Media Select	E0, 50	E0, F0, 50
+KP EN	E0,5A	E0,F0,5A
+Wake	E0,5E
+END	E0,69	E0,F0,69
+L ARROW	E0,6B	E0,F0,6B
+HOME	E0,6C	E0,F0,6C
+INSERT	E0,70	E0,F0,70
+DELETE	E0,71	E0,F0,71
+D ARROW	E0,72	E0,F0,72
+R ARROW	E0,74	E0,F0,74
+U ARROW	E0,75	E0,F0,75
+PG DN	E0,7A	E0,F0,7A
+PG UP	E0,7D	E0,F0,7D
+
+PRNT SCRN	E0,12,E0,7C	E0,F0,7C,E0,F0,12
+PAUSE	E1,14,77,E1,F0,14,F0,77	-NONE-
+
