]>
git.gir.st - tmk_keyboard.git/blob - ps2_vusb/config.h
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
14 #define MATRIX_ROWS 32 // keycode bit: 3-0
15 #define MATRIX_COLS 8 // keycode bit: 6-4
17 /* key combination for command */
18 #define IS_COMMAND() ( \
19 keyboard_report->mods == (BIT_LSHIFT | BIT_RSHIFT) || \
20 keyboard_report->mods == (BIT_LCTRL | BIT_RSHIFT) \
24 /* USB NKey Rollover */
25 #ifdef USB_NKRO_ENABLE
29 #ifdef MOUSEKEY_ENABLE
30 # define MOUSEKEY_DELAY_TIME 255
35 #define PS2_CLOCK_PORT PORTD
36 #define PS2_CLOCK_PIN PIND
37 #define PS2_CLOCK_DDR DDRD
38 #define PS2_CLOCK_BIT 4
39 #define PS2_DATA_PORT PORTD
40 #define PS2_DATA_PIN PIND
41 #define PS2_DATA_DDR DDRD
42 #define PS2_DATA_BIT 0
45 // Synchronous USART is used to receive data from keyboard.
46 // Use RXD pin for PS/2 DATA line and XCK for PS/2 CLOCK.
47 // NOTE: This is recomended strongly if you use V-USB library.
50 // External or Pin Change Interrupt is used to receive data from keyboard.
51 // Use INT1 or PCINTxx for PS/2 CLOCK line. see below.
56 // synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge
57 // set DDR of CLOCK as input to be slave
58 #define PS2_USART_INIT() do { \
59 PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
60 PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
61 UCSR0C = ((1 << UMSEL00) | \
70 #define PS2_USART_RX_INT_ON() do { \
71 UCSR0B = ((1 << RXCIE0) | \
74 #define PS2_USART_RX_POLL_ON() do { \
75 UCSR0B = (1 << RXEN0); \
77 #define PS2_USART_OFF() do { \
79 UCSR0B &= ~((1 << RXEN0) | \
82 #define PS2_USART_RX_READY (UCSR0A & (1<<RXC0))
83 #define PS2_USART_RX_DATA UDR0
84 #define PS2_USART_ERROR (UCSR0A & ((1<<FE0) | (1<<DOR0) | (1<<UPE0)))
85 #define PS2_USART_RX_VECT USART_RX_vect
91 #define PS2_INT_INIT() do { \
92 EICRA |= ((1<<ISC11) | \
95 #define PS2_INT_ON() do { \
98 #define PS2_INT_OFF() do { \
99 EIMSK &= ~(1<<INT1); \
101 #define PS2_INT_VECT INT1_vect
105 #define PS2_INT_INIT() do { \
106 PCICR |= (1<<PCIE2); \
108 #define PS2_INT_ON() do { \
109 PCMSK2 |= (1<<PCINT20); \
111 #define PS2_INT_OFF() do { \
112 PCMSK2 &= ~(1<<PCINT20); \
113 PCICR &= ~(1<<PCIE2); \
115 #define PS2_INT_VECT PCINT2_vect