]> git.donarmstrong.com Git - qmk_firmware.git/blob - quantum/config_common.h
0a2dba78ffdac119ebf84959466be5b439f659d6
[qmk_firmware.git] / quantum / config_common.h
1 #ifndef CONFIG_DEFINITIONS_H
2 #define CONFIG_DEFINITIONS_H
3
4 /* diode directions */
5 #define COL2ROW 0
6 #define ROW2COL 1
7 /* I/O pins */
8 #define B0 0x30
9 #define B1 0x31
10 #define B2 0x32
11 #define B3 0x33
12 #define B4 0x34
13 #define B5 0x35
14 #define B6 0x36
15 #define B7 0x37
16 #define C0 0x60
17 #define C1 0x61
18 #define C2 0x62
19 #define C3 0x63
20 #define C4 0x64
21 #define C5 0x65
22 #define C6 0x66
23 #define C7 0x67
24 #define D0 0x90
25 #define D1 0x91
26 #define D2 0x92
27 #define D3 0x93
28 #define D4 0x94
29 #define D5 0x95
30 #define D6 0x96
31 #define D7 0x97
32 #define E0 0xC0
33 #define E1 0xC1
34 #define E2 0xC2
35 #define E3 0xC3
36 #define E4 0xC4
37 #define E5 0xC5
38 #define E6 0xC6
39 #define E7 0xC7
40 #define F0 0xF0
41 #define F1 0xF1
42 #define F2 0xF2
43 #define F3 0xF3
44 #define F4 0xF4
45 #define F5 0xF5
46 #define F6 0xF6
47 #define F7 0xF7
48 #define A0 0x00
49 #define A1 0x01
50 #define A2 0x02
51 #define A3 0x03
52 #define A4 0x04
53 #define A5 0x05
54 #define A6 0x06
55 #define A7 0x07
56
57
58 /* USART configuration */
59 #ifdef BLUETOOTH_ENABLE
60 #   ifdef __AVR_ATmega32U4__
61 #      define SERIAL_UART_BAUD 9600
62 #      define SERIAL_UART_DATA UDR1
63 #      define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
64 #      define SERIAL_UART_RXD_VECT USART1_RX_vect
65 #      define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
66 #      define SERIAL_UART_INIT() do { \
67             /* baud rate */ \
68             UBRR1L = SERIAL_UART_UBRR; \
69             /* baud rate */ \
70             UBRR1H = SERIAL_UART_UBRR >> 8; \
71             /* enable TX */ \
72             UCSR1B = _BV(TXEN1); \
73             /* 8-bit data */ \
74             UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
75             sei(); \
76         } while(0)
77 #   else
78 #       error "USART configuration is needed."
79 #   endif
80 #endif
81
82 #ifdef PS2_USE_BUSYWAIT
83 #   ifndef PS2_CLOCK_PORT
84 #       error "PS2_CLOCK_PORT has to be defined"
85 #   endif
86 #   ifndef PS2_CLOCK_PIN
87 #       error "PS2_CLOCK_PIN has to be defined"
88 #   endif
89 #   ifndef PS2_CLOCK_DDR
90 #       error "PS2_CLOCK_DDR has to be defined"
91 #   endif
92 #   ifndef PS2_CLOCK_BIT
93 #       error "PS2_CLOCK_BIT has to be defined"
94 #   endif
95 #   ifndef PS2_DATA_PORT
96 #       error "PS2_DATA_PORT has to be defined"
97 #   endif
98 #   ifndef PS2_DATA_PIN
99 #       error "PS2_DATA_PIN has to be defined"
100 #   endif
101 #   ifndef PS2_DATA_DDR
102 #       error "PS2_DATA_DDR has to be defined"
103 #   endif
104 #   ifndef PS2_DATA_BIT
105 #       error "PS2_DATA_BIT has to be defined"
106 #   endif
107 #endif
108
109 #ifdef PS2_USE_INT
110 #   ifndef PS2_CLOCK_PORT
111 #       error "PS2_CLOCK_PORT has to be defined"
112 #   endif
113 #   ifndef PS2_CLOCK_PIN
114 #       error "PS2_CLOCK_PIN has to be defined"
115 #   endif
116 #   ifndef PS2_CLOCK_DDR
117 #       error "PS2_CLOCK_DDR has to be defined"
118 #   endif
119 #   ifndef PS2_CLOCK_BIT
120 #       error "PS2_CLOCK_BIT has to be defined"
121 #   endif
122 #   ifndef PS2_DATA_PORT
123 #       error "PS2_DATA_PORT has to be defined"
124 #   endif
125 #   ifndef PS2_DATA_PIN
126 #       error "PS2_DATA_PIN has to be defined"
127 #   endif
128 #   ifndef PS2_DATA_DDR
129 #       error "PS2_DATA_DDR has to be defined"
130 #   endif
131 #   ifndef PS2_DATA_BIT
132 #       error "PS2_DATA_BIT has to be defined"
133 #   endif
134 #   ifndef PS2_INT_INIT
135 #       error "PS2_INT_INIT has to be defined"
136 #   endif
137 #   ifndef PS2_INT_ON
138 #       error "PS2_INT_ON has to be defined"
139 #   endif
140 #   ifndef PS2_INT_OFF
141 #       error "PS2_INT_OFF has to be defined"
142 #   endif
143 #   ifndef PS2_INT_VECT
144 #       error "PS2_INT_VECT has to be defined"
145 #   endif
146 #endif
147
148 #ifdef PS2_USE_USART
149 #   ifndef PS2_CLOCK_PORT
150 #       error "PS2_CLOCK_PORT has to be defined"
151 #   endif
152 #   ifndef PS2_CLOCK_PIN
153 #       error "PS2_CLOCK_PIN has to be defined"
154 #   endif
155 #   ifndef PS2_CLOCK_DDR
156 #       error "PS2_CLOCK_DDR has to be defined"
157 #   endif
158 #   ifndef PS2_CLOCK_BIT
159 #       error "PS2_CLOCK_BIT has to be defined"
160 #   endif
161 #   ifndef PS2_DATA_PORT
162 #       error "PS2_DATA_PORT has to be defined"
163 #   endif
164 #   ifndef PS2_DATA_PIN
165 #       error "PS2_DATA_PIN has to be defined"
166 #   endif
167 #   ifndef PS2_DATA_DDR
168 #       error "PS2_DATA_DDR has to be defined"
169 #   endif
170 #   ifndef PS2_DATA_BIT
171 #       error "PS2_DATA_BIT has to be defined"
172 #   endif
173 #   ifndef PS2_USART_INIT
174 #       error "PS2_USART_INIT has to be defined"
175 #   endif
176 #   ifndef PS2_USART_RX_INT_ON
177 #       error "PS2_USART_RX_INT_ON has to be defined"
178 #   endif
179 #   ifndef PS2_USART_RX_POLL_ON
180 #       error "PS2_USART_RX_POLL_ON has to be defined"
181 #   endif
182 #   ifndef PS2_USART_OFF
183 #       error "PS2_USART_OFF has to be defined"
184 #   endif
185 #   ifndef PS2_USART_RX_READY
186 #       error "PS2_USART_RX_READY has to be defined"
187 #   endif
188 #   ifndef PS2_USART_RX_DATA
189 #       error "PS2_USART_RX_DATA has to be defined"
190 #   endif
191 #   ifndef PS2_USART_ERROR
192 #       error "PS2_USART_ERROR has to be defined"
193 #   endif
194 #   ifndef PS2_USART_RX_VECT
195 #       error "PS2_USART_RX_VECT has to be defined"
196 #   endif
197 #endif
198
199
200 #endif