]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboards/handwired/promethium/config.h
473af67d34d6aa3b872770012ab33fa557764efe
[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 /* USB Device descriptor parameter */
24 #define VENDOR_ID       0xFEED
25 #define PRODUCT_ID      0x6660
26 #define DEVICE_VER      0x0001
27 #define MANUFACTURER    Priyadi
28 #define PRODUCT         Promethium Keyboard
29 #define DESCRIPTION     Promethium Keyboard
30
31 /* key matrix size */
32 #define MATRIX_ROWS 8
33 #define MATRIX_COLS 6
34
35 /* default pin-out */
36 #define MATRIX_COL_PINS { B6, B7, D6, C7, F6, F7 }
37 #define MATRIX_ROW_PINS { D7, C6, D0, D1, F5, F4, F1, F0 }
38 #define UNUSED_PINS
39
40 /* COL2ROW or ROW2COL */
41 #define DIODE_DIRECTION COL2ROW
42
43 /* define if matrix has ghost */
44 //#define MATRIX_HAS_GHOST
45
46 /* number of backlight levels */
47 #define BACKLIGHT_LEVELS 3
48
49 /* Set 0 if debouncing isn't needed */
50 #define DEBOUNCING_DELAY 5
51
52 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
53 #define LOCKING_SUPPORT_ENABLE
54 /* Locking resynchronize hack */
55 #define LOCKING_RESYNC_ENABLE
56
57 /* key combination for command */
58 #define IS_COMMAND() ( \
59     keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT) | MOD_BIT(KC_LCTRL) | MOD_BIT(KC_RCTRL)) \
60 )
61
62 /*
63  * Feature disable options
64  *  These options are also useful to firmware size reduction.
65  */
66
67 /* disable debug print */
68 //#define NO_DEBUG
69
70 /* disable print */
71 //#define NO_PRINT
72
73 /* disable action features */
74 //#define NO_ACTION_LAYER
75 //#define NO_ACTION_TAPPING
76 //#define NO_ACTION_ONESHOT
77 //#define NO_ACTION_MACRO
78 //#define NO_ACTION_FUNCTION
79
80 /* PS/2 mouse */
81 #ifdef PS2_USE_BUSYWAIT
82 #   define PS2_CLOCK_PORT  PORTD
83 #   define PS2_CLOCK_PIN   PIND
84 #   define PS2_CLOCK_DDR   DDRD
85 #   define PS2_CLOCK_BIT   1
86 #   define PS2_DATA_PORT   PORTD
87 #   define PS2_DATA_PIN    PIND
88 #   define PS2_DATA_DDR    DDRD
89 #   define PS2_DATA_BIT    2
90 #endif
91
92 /* PS/2 mouse interrupt version */
93 #ifdef PS2_USE_INT
94 /* uses INT1 for clock line(ATMega32U4) */
95 #define PS2_CLOCK_PORT  PORTD
96 #define PS2_CLOCK_PIN   PIND
97 #define PS2_CLOCK_DDR   DDRD
98 #define PS2_CLOCK_BIT   3
99 #define PS2_DATA_PORT   PORTD
100 #define PS2_DATA_PIN    PIND
101 #define PS2_DATA_DDR    DDRD
102 #define PS2_DATA_BIT    2
103
104 #define PS2_INT_INIT()  do {    \
105     EICRA |= ((1<<ISC31) |      \
106               (0<<ISC30));      \
107 } while (0)
108 #define PS2_INT_ON()  do {      \
109     EIMSK |= (1<<INT3);         \
110 } while (0)
111 #define PS2_INT_OFF() do {      \
112     EIMSK &= ~(1<<INT3);        \
113 } while (0)
114 #define PS2_INT_VECT    INT3_vect
115 #endif
116
117 /* PS/2 mouse USART version */
118 #ifdef PS2_USE_USART
119 /* XCK for clock line and RXD for data line */
120 #define PS2_CLOCK_PORT  PORTD
121 #define PS2_CLOCK_PIN   PIND
122 #define PS2_CLOCK_DDR   DDRD
123 #define PS2_CLOCK_BIT   5
124 #define PS2_DATA_PORT   PORTD
125 #define PS2_DATA_PIN    PIND
126 #define PS2_DATA_DDR    DDRD
127 #define PS2_DATA_BIT    2
128
129 /* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
130 /* set DDR of CLOCK as input to be slave */
131 #define PS2_USART_INIT() do {   \
132     PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT);   \
133     PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT);     \
134     UCSR1C = ((1 << UMSEL10) |  \
135               (3 << UPM10)   |  \
136               (0 << USBS1)   |  \
137               (3 << UCSZ10)  |  \
138               (0 << UCPOL1));   \
139     UCSR1A = 0;                 \
140     UBRR1H = 0;                 \
141     UBRR1L = 0;                 \
142 } while (0)
143 #define PS2_USART_RX_INT_ON() do {  \
144     UCSR1B = ((1 << RXCIE1) |       \
145               (1 << RXEN1));        \
146 } while (0)
147 #define PS2_USART_RX_POLL_ON() do { \
148     UCSR1B = (1 << RXEN1);          \
149 } while (0)
150 #define PS2_USART_OFF() do {    \
151     UCSR1C = 0;                 \
152     UCSR1B &= ~((1 << RXEN1) |  \
153                 (1 << TXEN1));  \
154 } while (0)
155 #define PS2_USART_RX_READY      (UCSR1A & (1<<RXC1))
156 #define PS2_USART_RX_DATA       UDR1
157 #define PS2_USART_ERROR         (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
158 #define PS2_USART_RX_VECT       USART1_RX_vect
159 #endif
160
161
162 #endif