]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboards/handwired/promethium/config.h
minimize LEDs
[qmk_firmware.git] / keyboards / handwired / promethium / config.h
1 /*
2 Copyright 2012 Jun Wako <wakojun@gmail.com>
3
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.
8
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.
13
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/>.
16 */
17
18 #ifndef CONFIG_H
19 #define CONFIG_H
20
21 #include "config_common.h"
22
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
28
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
35 #define DESCRIPTION
36
37 /* key matrix size */
38 #define MATRIX_ROWS 8
39 #define MATRIX_COLS 6
40
41 /* default pin-out */
42 #define MATRIX_COL_PINS { B6, B7, D6, C7, F6, F7 }
43 #define MATRIX_ROW_PINS { D7, C6, D0, D1, F5, F4, F1, F0 }
44 #define UNUSED_PINS
45
46 /* COL2ROW or ROW2COL */
47 #define DIODE_DIRECTION COL2ROW
48
49 /* define if matrix has ghost */
50 //#define MATRIX_HAS_GHOST
51
52 /* number of backlight levels */
53 #define BACKLIGHT_LEVELS 3
54
55 /* Set 0 if debouncing isn't needed */
56 #define DEBOUNCING_DELAY 5
57
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
62
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)) \
66 )
67
68 /*
69  * Feature disable options
70  *  These options are also useful to firmware size reduction.
71  */
72
73 /* disable debug print */
74 //#define NO_DEBUG
75
76 /* disable print */
77 //#define NO_PRINT
78
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
85
86 /* PS/2 mouse */
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
96 #endif
97
98 /* PS/2 mouse interrupt version */
99 #ifdef PS2_USE_INT
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
109
110 #define PS2_INT_INIT()  do {    \
111     EICRA |= ((1<<ISC31) |      \
112               (0<<ISC30));      \
113 } while (0)
114 #define PS2_INT_ON()  do {      \
115     EIMSK |= (1<<INT3);         \
116 } while (0)
117 #define PS2_INT_OFF() do {      \
118     EIMSK &= ~(1<<INT3);        \
119 } while (0)
120 #define PS2_INT_VECT    INT3_vect
121 #endif
122
123 /* PS/2 mouse USART version */
124 #ifdef PS2_USE_USART
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
134
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) |  \
141               (3 << UPM10)   |  \
142               (0 << USBS1)   |  \
143               (3 << UCSZ10)  |  \
144               (0 << UCPOL1));   \
145     UCSR1A = 0;                 \
146     UBRR1H = 0;                 \
147     UBRR1L = 0;                 \
148 } while (0)
149 #define PS2_USART_RX_INT_ON() do {  \
150     UCSR1B = ((1 << RXCIE1) |       \
151               (1 << RXEN1));        \
152 } while (0)
153 #define PS2_USART_RX_POLL_ON() do { \
154     UCSR1B = (1 << RXEN1);          \
155 } while (0)
156 #define PS2_USART_OFF() do {    \
157     UCSR1C = 0;                 \
158     UCSR1B &= ~((1 << RXEN1) |  \
159                 (1 << TXEN1));  \
160 } while (0)
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
165 #endif
166
167
168 #endif