2 Copyright 2012 Jun Wako <wakojun@gmail.com>
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "config_common.h"
23 #define USB_VENDOR_ID_LENOVO 0x17ef
24 #define USB_DEVICE_ID_LENOVO_TPKBD 0x6009
25 #define USB_DEVICE_ID_LENOVO_CUSBKBD 0x6047
26 #define USB_DEVICE_ID_LENOVO_CBTKBD 0x6048
27 #define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067
29 /* USB Device descriptor parameter */
30 #define VENDOR_ID USB_VENDOR_ID_LENOVO
31 #define PRODUCT_ID USB_DEVICE_ID_LENOVO_CBTKBD
32 #define DEVICE_VER 0x0001
33 #define MANUFACTURER Priyadi
34 #define PRODUCT Promethium Keyboard
42 #define MATRIX_COL_PINS { B6, B7, D6, C7, F6, F7 }
43 #define MATRIX_ROW_PINS { D7, C6, D0, D1, F5, F4, F1, F0 }
46 /* COL2ROW or ROW2COL */
47 #define DIODE_DIRECTION COL2ROW
49 /* define if matrix has ghost */
50 //#define MATRIX_HAS_GHOST
52 /* number of backlight levels */
53 #define BACKLIGHT_LEVELS 3
55 /* Set 0 if debouncing isn't needed */
56 #define DEBOUNCING_DELAY 5
58 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
59 #define LOCKING_SUPPORT_ENABLE
60 /* Locking resynchronize hack */
61 #define LOCKING_RESYNC_ENABLE
63 /* key combination for command */
64 #define IS_COMMAND() ( \
65 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT) | MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RCTRL)) \
69 * Feature disable options
70 * These options are also useful to firmware size reduction.
73 /* disable debug print */
79 /* disable action features */
80 //#define NO_ACTION_LAYER
81 //#define NO_ACTION_TAPPING
82 //#define NO_ACTION_ONESHOT
83 //#define NO_ACTION_MACRO
84 //#define NO_ACTION_FUNCTION
87 #ifdef PS2_USE_BUSYWAIT
88 # define PS2_CLOCK_PORT PORTD
89 # define PS2_CLOCK_PIN PIND
90 # define PS2_CLOCK_DDR DDRD
91 # define PS2_CLOCK_BIT 1
92 # define PS2_DATA_PORT PORTD
93 # define PS2_DATA_PIN PIND
94 # define PS2_DATA_DDR DDRD
95 # define PS2_DATA_BIT 2
98 /* PS/2 mouse interrupt version */
100 /* uses INT1 for clock line(ATMega32U4) */
101 #define PS2_CLOCK_PORT PORTD
102 #define PS2_CLOCK_PIN PIND
103 #define PS2_CLOCK_DDR DDRD
104 #define PS2_CLOCK_BIT 3
105 #define PS2_DATA_PORT PORTD
106 #define PS2_DATA_PIN PIND
107 #define PS2_DATA_DDR DDRD
108 #define PS2_DATA_BIT 2
110 #define PS2_INT_INIT() do { \
111 EICRA |= ((1<<ISC31) | \
114 #define PS2_INT_ON() do { \
115 EIMSK |= (1<<INT3); \
117 #define PS2_INT_OFF() do { \
118 EIMSK &= ~(1<<INT3); \
120 #define PS2_INT_VECT INT3_vect
123 /* PS/2 mouse USART version */
125 /* XCK for clock line and RXD for data line */
126 #define PS2_CLOCK_PORT PORTD
127 #define PS2_CLOCK_PIN PIND
128 #define PS2_CLOCK_DDR DDRD
129 #define PS2_CLOCK_BIT 5
130 #define PS2_DATA_PORT PORTD
131 #define PS2_DATA_PIN PIND
132 #define PS2_DATA_DDR DDRD
133 #define PS2_DATA_BIT 2
135 /* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
136 /* set DDR of CLOCK as input to be slave */
137 #define PS2_USART_INIT() do { \
138 PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
139 PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
140 UCSR1C = ((1 << UMSEL10) | \
149 #define PS2_USART_RX_INT_ON() do { \
150 UCSR1B = ((1 << RXCIE1) | \
153 #define PS2_USART_RX_POLL_ON() do { \
154 UCSR1B = (1 << RXEN1); \
156 #define PS2_USART_OFF() do { \
158 UCSR1B &= ~((1 << RXEN1) | \
161 #define PS2_USART_RX_READY (UCSR1A & (1<<RXC1))
162 #define PS2_USART_RX_DATA UDR1
163 #define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
164 #define PS2_USART_RX_VECT USART1_RX_vect