5 #define VENDOR_ID 0xFEED
6 #define PRODUCT_ID 0x2233
7 // TODO: share these strings with usbconfig.h
8 // Edit usbconfig.h to change these.
9 #define MANUFACTURER t.m.k.
10 #define PRODUCT PS/2 keyboard converter
11 #define DESCRIPTION convert PS/2 keyboard to USB
15 #define MATRIX_ROWS 32 // keycode bit: 3-0
16 #define MATRIX_COLS 8 // keycode bit: 6-4
19 /* key combination for command */
20 #define IS_COMMAND() ( \
21 keyboard_report->mods == (BIT_LSHIFT | BIT_RSHIFT) || \
22 keyboard_report->mods == (BIT_LCTRL | BIT_RSHIFT) \
27 #ifdef MOUSEKEY_ENABLE
28 # define MOUSEKEY_DELAY_TIME 255
33 #define PS2_CLOCK_PORT PORTD
34 #define PS2_CLOCK_PIN PIND
35 #define PS2_CLOCK_DDR DDRD
36 #define PS2_CLOCK_BIT 4
37 #define PS2_DATA_PORT PORTD
38 #define PS2_DATA_PIN PIND
39 #define PS2_DATA_DDR DDRD
40 #define PS2_DATA_BIT 0
43 // Synchronous USART is used to receive data from keyboard.
44 // Use RXD pin for PS/2 DATA line and XCK for PS/2 CLOCK.
45 // NOTE: This is recomended strongly if you use V-USB library.
48 // External or Pin Change Interrupt is used to receive data from keyboard.
49 // Use INT1 or PCINTxx for PS/2 CLOCK line. see below.
54 // synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge
55 // set DDR of CLOCK as input to be slave
56 #define PS2_USART_INIT() do { \
57 PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
58 PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
59 UCSR0C = ((1 << UMSEL00) | \
68 #define PS2_USART_RX_INT_ON() do { \
69 UCSR0B = ((1 << RXCIE0) | \
72 #define PS2_USART_RX_POLL_ON() do { \
73 UCSR0B = (1 << RXEN0); \
75 #define PS2_USART_OFF() do { \
77 UCSR0B &= ~((1 << RXEN0) | \
80 #define PS2_USART_RX_READY (UCSR0A & (1<<RXC0))
81 #define PS2_USART_RX_DATA UDR0
82 #define PS2_USART_ERROR (UCSR0A & ((1<<FE0) | (1<<DOR0) | (1<<UPE0)))
83 #define PS2_USART_RX_VECT USART_RX_vect
89 #define PS2_INT_INIT() do { \
90 EICRA |= ((1<<ISC11) | \
93 #define PS2_INT_ON() do { \
96 #define PS2_INT_OFF() do { \
97 EIMSK &= ~(1<<INT1); \
99 #define PS2_INT_VECT INT1_vect
103 #define PS2_INT_INIT() do { \
104 PCICR |= (1<<PCIE2); \
106 #define PS2_INT_ON() do { \
107 PCMSK2 |= (1<<PCINT20); \
109 #define PS2_INT_OFF() do { \
110 PCMSK2 &= ~(1<<PCINT20); \
111 PCICR &= ~(1<<PCIE2); \
113 #define PS2_INT_VECT PCINT2_vect