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/>.
20 #include "config_common.h"
22 #define USB_VENDOR_ID_LENOVO 0x17ef
23 #define USB_DEVICE_ID_LENOVO_TPKBD 0x6009
24 #define USB_DEVICE_ID_LENOVO_CUSBKBD 0x6047
25 #define USB_DEVICE_ID_LENOVO_CBTKBD 0x6048
26 #define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067
28 /* USB Device descriptor parameter */
29 #define VENDOR_ID USB_VENDOR_ID_LENOVO
30 #define PRODUCT_ID USB_DEVICE_ID_LENOVO_CBTKBD
31 #define DEVICE_VER 0x0001
32 #define MANUFACTURER Priyadi
33 #define PRODUCT Promethium Keyboard
41 #define MATRIX_COL_PINS { F4, F1, F0, D6, D0, D1 }
42 #define MATRIX_ROW_PINS { F5, F6, F7 }
43 #define TRACKPOINT_PINS { B7, B6, D7 }
47 * Keyboard Matrix Assignments
49 * Change this to how you wired your keyboard
50 * COLS: AVR pins used for columns, left to right
51 * ROWS: AVR pins used for rows, top to bottom
52 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
53 * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
56 #define DIODE_DIRECTION COL2ROW
58 // #define BACKLIGHT_PIN B7
59 // #define BACKLIGHT_BREATHING
60 // #define BACKLIGHT_LEVELS 3
62 /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
65 /* define if matrix has ghost (lacks anti-ghosting diodes) */
66 //#define MATRIX_HAS_GHOST
68 /* number of backlight levels */
70 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
71 // #define LOCKING_SUPPORT_ENABLE
72 /* Locking resynchronize hack */
73 // #define LOCKING_RESYNC_ENABLE
78 * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
79 * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
80 * makefile for this to work.)
82 * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
83 * until the next keyboard reset.
85 * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
86 * fully operational during normal computer usage.
88 * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
89 * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
90 * bootmagic, NKRO mode will always be enabled until it is toggled again during a
96 /* key combination for command */
97 #define IS_COMMAND() ( \
98 get_mods() == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT) | MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RCTRL)) \
101 /* control how magic key switches layers */
102 //#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
103 //#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
104 //#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
106 /* override magic key keymap */
107 //#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
108 //#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
109 //#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
110 //#define MAGIC_KEY_HELP1 H
111 //#define MAGIC_KEY_HELP2 SLASH
112 //#define MAGIC_KEY_DEBUG D
113 //#define MAGIC_KEY_DEBUG_MATRIX X
114 //#define MAGIC_KEY_DEBUG_KBD K
115 //#define MAGIC_KEY_DEBUG_MOUSE M
116 //#define MAGIC_KEY_VERSION V
117 //#define MAGIC_KEY_STATUS S
118 //#define MAGIC_KEY_CONSOLE C
119 //#define MAGIC_KEY_LAYER0_ALT1 ESC
120 //#define MAGIC_KEY_LAYER0_ALT2 GRAVE
121 //#define MAGIC_KEY_LAYER0 0
122 //#define MAGIC_KEY_LAYER1 1
123 //#define MAGIC_KEY_LAYER2 2
124 //#define MAGIC_KEY_LAYER3 3
125 //#define MAGIC_KEY_LAYER4 4
126 //#define MAGIC_KEY_LAYER5 5
127 //#define MAGIC_KEY_LAYER6 6
128 //#define MAGIC_KEY_LAYER7 7
129 //#define MAGIC_KEY_LAYER8 8
130 //#define MAGIC_KEY_LAYER9 9
131 //#define MAGIC_KEY_BOOTLOADER PAUSE
132 //#define MAGIC_KEY_LOCK CAPS
133 //#define MAGIC_KEY_EEPROM E
134 //#define MAGIC_KEY_NKRO N
135 //#define MAGIC_KEY_SLEEP_LED Z
138 * Feature disable options
139 * These options are also useful to firmware size reduction.
142 /* disable debug print */
148 /* disable action features */
149 //#define NO_ACTION_LAYER
150 //#define NO_ACTION_TAPPING
151 //#define NO_ACTION_ONESHOT
152 //#define NO_ACTION_MACRO
153 //#define NO_ACTION_FUNCTION
155 #define PS2_MOUSE_INIT_DELAY 2000
156 #define BATTERY_PIN 9
157 #define BATTERY_POLL 30000
158 #define MAX_VOLTAGE 4.2
159 #define MIN_VOLTAGE 3.2
161 #ifndef __ASSEMBLER__ // assembler doesn't like enum in .h file
248 #define RGB_DI_PIN B5
249 #define RGBSPS_NUM LED_TOTAL
253 #ifdef PS2_USE_BUSYWAIT
254 # define PS2_CLOCK_PORT PORTD
255 # define PS2_CLOCK_PIN PIND
256 # define PS2_CLOCK_DDR DDRD
257 # define PS2_CLOCK_BIT 3
258 # define PS2_DATA_PORT PORTD
259 # define PS2_DATA_PIN PIND
260 # define PS2_DATA_DDR DDRD
261 # define PS2_DATA_BIT 2
264 /* PS/2 mouse interrupt version */
266 /* uses INT1 for clock line(ATMega32U4) */
267 #define PS2_CLOCK_PORT PORTD
268 #define PS2_CLOCK_PIN PIND
269 #define PS2_CLOCK_DDR DDRD
270 #define PS2_CLOCK_BIT 3
271 #define PS2_DATA_PORT PORTD
272 #define PS2_DATA_PIN PIND
273 #define PS2_DATA_DDR DDRD
274 #define PS2_DATA_BIT 2
276 #define PS2_INT_INIT() do { \
277 EICRA |= ((1<<ISC31) | \
280 #define PS2_INT_ON() do { \
281 EIMSK |= (1<<INT3); \
283 #define PS2_INT_OFF() do { \
284 EIMSK &= ~(1<<INT3); \
286 #define PS2_INT_VECT INT3_vect
289 /* PS/2 mouse USART version */
291 /* XCK for clock line and RXD for data line */
292 #define PS2_CLOCK_PORT PORTD
293 #define PS2_CLOCK_PIN PIND
294 #define PS2_CLOCK_DDR DDRD
295 #define PS2_CLOCK_BIT 5
296 #define PS2_DATA_PORT PORTD
297 #define PS2_DATA_PIN PIND
298 #define PS2_DATA_DDR DDRD
299 #define PS2_DATA_BIT 2
301 /* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
302 /* set DDR of CLOCK as input to be slave */
303 #define PS2_USART_INIT() do { \
304 PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
305 PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
306 UCSR1C = ((1 << UMSEL10) | \
315 #define PS2_USART_RX_INT_ON() do { \
316 UCSR1B = ((1 << RXCIE1) | \
319 #define PS2_USART_RX_POLL_ON() do { \
320 UCSR1B = (1 << RXEN1); \
322 #define PS2_USART_OFF() do { \
324 UCSR1B &= ~((1 << RXEN1) | \
327 #define PS2_USART_RX_READY (UCSR1A & (1<<RXC1))
328 #define PS2_USART_RX_DATA UDR1
329 #define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
330 #define PS2_USART_RX_VECT USART1_RX_vect