aboutsummaryrefslogtreecommitdiff
path: root/quantum/config_common.h
diff options
context:
space:
mode:
authorskullY <skullydazed@gmail.com>2019-08-30 11:19:03 -0700
committerskullydazed <skullydazed@users.noreply.github.com>2019-08-30 15:01:52 -0700
commitb624f32f944acdc59dcb130674c09090c5c404cb (patch)
treebc13adbba137d122d9a2c2fb2fafcbb08ac10e25 /quantum/config_common.h
parent61af76a10d00aba185b8338604171de490a13e3b (diff)
downloadqmk_firmware-b624f32f944acdc59dcb130674c09090c5c404cb.tar.gz
qmk_firmware-b624f32f944acdc59dcb130674c09090c5c404cb.zip
clang-format changes
Diffstat (limited to 'quantum/config_common.h')
-rw-r--r--quantum/config_common.h539
1 files changed, 270 insertions, 269 deletions
diff --git a/quantum/config_common.h b/quantum/config_common.h
index ae72701da..fb9f1fd00 100644
--- a/quantum/config_common.h
+++ b/quantum/config_common.h
@@ -17,294 +17,295 @@
17#pragma once 17#pragma once
18 18
19/* diode directions */ 19/* diode directions */
20#define COL2ROW 0 20#define COL2ROW 0
21#define ROW2COL 1 21#define ROW2COL 1
22#define CUSTOM_MATRIX 2 /* Disables built-in matrix scanning code */ 22#define CUSTOM_MATRIX 2 /* Disables built-in matrix scanning code */
23 23
24// useful for direct pin mapping 24// useful for direct pin mapping
25#define NO_PIN (~0) 25#define NO_PIN (~0)
26 26
27#ifdef __AVR__ 27#ifdef __AVR__
28 #ifndef __ASSEMBLER__ 28# ifndef __ASSEMBLER__
29 #include <avr/io.h> 29# include <avr/io.h>
30 #endif 30# endif
31 #define PORT_SHIFTER 4 // this may be 4 for all AVR chips 31# define PORT_SHIFTER 4 // this may be 4 for all AVR chips
32 32
33 // If you want to add more to this list, reference the PINx definitions in these header 33// If you want to add more to this list, reference the PINx definitions in these header
34 // files: https://github.com/vancegroup-mirrors/avr-libc/tree/master/avr-libc/include/avr 34// files: https://github.com/vancegroup-mirrors/avr-libc/tree/master/avr-libc/include/avr
35 35
36 #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__) 36# if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__)
37 #define ADDRESS_BASE 0x00 37# define ADDRESS_BASE 0x00
38 #define PINB_ADDRESS 0x3 38# define PINB_ADDRESS 0x3
39 #define PINC_ADDRESS 0x6 39# define PINC_ADDRESS 0x6
40 #define PIND_ADDRESS 0x9 40# define PIND_ADDRESS 0x9
41 #define PINE_ADDRESS 0xC 41# define PINE_ADDRESS 0xC
42 #define PINF_ADDRESS 0xF 42# define PINF_ADDRESS 0xF
43 #elif defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) 43# elif defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__)
44 #define ADDRESS_BASE 0x00 44# define ADDRESS_BASE 0x00
45 #define PINB_ADDRESS 0x3 45# define PINB_ADDRESS 0x3
46 #define PINC_ADDRESS 0x6 46# define PINC_ADDRESS 0x6
47 #define PIND_ADDRESS 0x9 47# define PIND_ADDRESS 0x9
48 #elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) 48# elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__)
49 #define ADDRESS_BASE 0x00 49# define ADDRESS_BASE 0x00
50 #define PINA_ADDRESS 0x0 50# define PINA_ADDRESS 0x0
51 #define PINB_ADDRESS 0x3 51# define PINB_ADDRESS 0x3
52 #define PINC_ADDRESS 0x6 52# define PINC_ADDRESS 0x6
53 #define PIND_ADDRESS 0x9 53# define PIND_ADDRESS 0x9
54 #define PINE_ADDRESS 0xC 54# define PINE_ADDRESS 0xC
55 #define PINF_ADDRESS 0xF 55# define PINF_ADDRESS 0xF
56 #elif defined(__AVR_ATmega32A__) 56# elif defined(__AVR_ATmega32A__)
57 #define ADDRESS_BASE 0x10 57# define ADDRESS_BASE 0x10
58 #define PIND_ADDRESS 0x0 58# define PIND_ADDRESS 0x0
59 #define PINC_ADDRESS 0x3 59# define PINC_ADDRESS 0x3
60 #define PINB_ADDRESS 0x6 60# define PINB_ADDRESS 0x6
61 #define PINA_ADDRESS 0x9 61# define PINA_ADDRESS 0x9
62 #elif defined(__AVR_ATmega328P__) 62# elif defined(__AVR_ATmega328P__)
63 #define ADDRESS_BASE 0x00 63# define ADDRESS_BASE 0x00
64 #define PINB_ADDRESS 0x3 64# define PINB_ADDRESS 0x3
65 #define PINC_ADDRESS 0x6 65# define PINC_ADDRESS 0x6
66 #define PIND_ADDRESS 0x9 66# define PIND_ADDRESS 0x9
67 #else 67# else
68 #error "Pins are not defined" 68# error "Pins are not defined"
69 #endif 69# endif
70 70
71 /* I/O pins */ 71/* I/O pins */
72 #define PINDEF(port, pin) ((PIN##port##_ADDRESS << PORT_SHIFTER) | pin) 72# define PINDEF(port, pin) ((PIN##port##_ADDRESS << PORT_SHIFTER) | pin)
73 73
74 #ifdef PORTA 74# ifdef PORTA
75 #define A0 PINDEF(A, 0) 75# define A0 PINDEF(A, 0)
76 #define A1 PINDEF(A, 1) 76# define A1 PINDEF(A, 1)
77 #define A2 PINDEF(A, 2) 77# define A2 PINDEF(A, 2)
78 #define A3 PINDEF(A, 3) 78# define A3 PINDEF(A, 3)
79 #define A4 PINDEF(A, 4) 79# define A4 PINDEF(A, 4)
80 #define A5 PINDEF(A, 5) 80# define A5 PINDEF(A, 5)
81 #define A6 PINDEF(A, 6) 81# define A6 PINDEF(A, 6)
82 #define A7 PINDEF(A, 7) 82# define A7 PINDEF(A, 7)
83 #endif 83# endif
84 #ifdef PORTB 84# ifdef PORTB
85 #define B0 PINDEF(B, 0) 85# define B0 PINDEF(B, 0)
86 #define B1 PINDEF(B, 1) 86# define B1 PINDEF(B, 1)
87 #define B2 PINDEF(B, 2) 87# define B2 PINDEF(B, 2)
88 #define B3 PINDEF(B, 3) 88# define B3 PINDEF(B, 3)
89 #define B4 PINDEF(B, 4) 89# define B4 PINDEF(B, 4)
90 #define B5 PINDEF(B, 5) 90# define B5 PINDEF(B, 5)
91 #define B6 PINDEF(B, 6) 91# define B6 PINDEF(B, 6)
92 #define B7 PINDEF(B, 7) 92# define B7 PINDEF(B, 7)
93 #endif 93# endif
94 #ifdef PORTC 94# ifdef PORTC
95 #define C0 PINDEF(C, 0) 95# define C0 PINDEF(C, 0)
96 #define C1 PINDEF(C, 1) 96# define C1 PINDEF(C, 1)
97 #define C2 PINDEF(C, 2) 97# define C2 PINDEF(C, 2)
98 #define C3 PINDEF(C, 3) 98# define C3 PINDEF(C, 3)
99 #define C4 PINDEF(C, 4) 99# define C4 PINDEF(C, 4)
100 #define C5 PINDEF(C, 5) 100# define C5 PINDEF(C, 5)
101 #define C6 PINDEF(C, 6) 101# define C6 PINDEF(C, 6)
102 #define C7 PINDEF(C, 7) 102# define C7 PINDEF(C, 7)
103 #endif 103# endif
104 #ifdef PORTD 104# ifdef PORTD
105 #define D0 PINDEF(D, 0) 105# define D0 PINDEF(D, 0)
106 #define D1 PINDEF(D, 1) 106# define D1 PINDEF(D, 1)
107 #define D2 PINDEF(D, 2) 107# define D2 PINDEF(D, 2)
108 #define D3 PINDEF(D, 3) 108# define D3 PINDEF(D, 3)
109 #define D4 PINDEF(D, 4) 109# define D4 PINDEF(D, 4)
110 #define D5 PINDEF(D, 5) 110# define D5 PINDEF(D, 5)
111 #define D6 PINDEF(D, 6) 111# define D6 PINDEF(D, 6)
112 #define D7 PINDEF(D, 7) 112# define D7 PINDEF(D, 7)
113 #endif 113# endif
114 #ifdef PORTE 114# ifdef PORTE
115 #define E0 PINDEF(E, 0) 115# define E0 PINDEF(E, 0)
116 #define E1 PINDEF(E, 1) 116# define E1 PINDEF(E, 1)
117 #define E2 PINDEF(E, 2) 117# define E2 PINDEF(E, 2)
118 #define E3 PINDEF(E, 3) 118# define E3 PINDEF(E, 3)
119 #define E4 PINDEF(E, 4) 119# define E4 PINDEF(E, 4)
120 #define E5 PINDEF(E, 5) 120# define E5 PINDEF(E, 5)
121 #define E6 PINDEF(E, 6) 121# define E6 PINDEF(E, 6)
122 #define E7 PINDEF(E, 7) 122# define E7 PINDEF(E, 7)
123 #endif 123# endif
124 #ifdef PORTF 124# ifdef PORTF
125 #define F0 PINDEF(F, 0) 125# define F0 PINDEF(F, 0)
126 #define F1 PINDEF(F, 1) 126# define F1 PINDEF(F, 1)
127 #define F2 PINDEF(F, 2) 127# define F2 PINDEF(F, 2)
128 #define F3 PINDEF(F, 3) 128# define F3 PINDEF(F, 3)
129 #define F4 PINDEF(F, 4) 129# define F4 PINDEF(F, 4)
130 #define F5 PINDEF(F, 5) 130# define F5 PINDEF(F, 5)
131 #define F6 PINDEF(F, 6) 131# define F6 PINDEF(F, 6)
132 #define F7 PINDEF(F, 7) 132# define F7 PINDEF(F, 7)
133 #endif 133# endif
134 134
135 #ifndef __ASSEMBLER__ 135# ifndef __ASSEMBLER__
136 #define _PIN_ADDRESS(p, offset) _SFR_IO8(ADDRESS_BASE + (p >> PORT_SHIFTER) + offset) 136# define _PIN_ADDRESS(p, offset) _SFR_IO8(ADDRESS_BASE + (p >> PORT_SHIFTER) + offset)
137 // Port X Input Pins Address 137// Port X Input Pins Address
138 #define PINx_ADDRESS(p) _PIN_ADDRESS(p, 0) 138# define PINx_ADDRESS(p) _PIN_ADDRESS(p, 0)
139 // Port X Data Direction Register, 0:input 1:output 139// Port X Data Direction Register, 0:input 1:output
140 #define DDRx_ADDRESS(p) _PIN_ADDRESS(p, 1) 140# define DDRx_ADDRESS(p) _PIN_ADDRESS(p, 1)
141 // Port X Data Register 141// Port X Data Register
142 #define PORTx_ADDRESS(p) _PIN_ADDRESS(p, 2) 142# define PORTx_ADDRESS(p) _PIN_ADDRESS(p, 2)
143 #endif 143# endif
144 144
145#elif defined(PROTOCOL_CHIBIOS) 145#elif defined(PROTOCOL_CHIBIOS)
146 // Defines mapping for Proton C replacement 146// Defines mapping for Proton C replacement
147 #ifdef CONVERT_TO_PROTON_C 147# ifdef CONVERT_TO_PROTON_C
148 // Left side (front) 148// Left side (front)
149 #define D3 PAL_LINE(GPIOA, 9) 149# define D3 PAL_LINE(GPIOA, 9)
150 #define D2 PAL_LINE(GPIOA, 10) 150# define D2 PAL_LINE(GPIOA, 10)
151 // GND 151// GND
152 // GND 152// GND
153 #define D1 PAL_LINE(GPIOB, 7) 153# define D1 PAL_LINE(GPIOB, 7)
154 #define D0 PAL_LINE(GPIOB, 6) 154# define D0 PAL_LINE(GPIOB, 6)
155 #define D4 PAL_LINE(GPIOB, 5) 155# define D4 PAL_LINE(GPIOB, 5)
156 #define C6 PAL_LINE(GPIOB, 4) 156# define C6 PAL_LINE(GPIOB, 4)
157 #define D7 PAL_LINE(GPIOB, 3) 157# define D7 PAL_LINE(GPIOB, 3)
158 #define E6 PAL_LINE(GPIOB, 2) 158# define E6 PAL_LINE(GPIOB, 2)
159 #define B4 PAL_LINE(GPIOB, 1) 159# define B4 PAL_LINE(GPIOB, 1)
160 #define B5 PAL_LINE(GPIOB, 0) 160# define B5 PAL_LINE(GPIOB, 0)
161 161
162 // Right side (front) 162// Right side (front)
163 // RAW 163// RAW
164 // GND 164// GND
165 // RESET 165// RESET
166 // VCC 166// VCC
167 #define F4 PAL_LINE(GPIOA, 2) 167# define F4 PAL_LINE(GPIOA, 2)
168 #define F5 PAL_LINE(GPIOA, 1) 168# define F5 PAL_LINE(GPIOA, 1)
169 #define F6 PAL_LINE(GPIOA, 0) 169# define F6 PAL_LINE(GPIOA, 0)
170 #define F7 PAL_LINE(GPIOB, 8) 170# define F7 PAL_LINE(GPIOB, 8)
171 #define B1 PAL_LINE(GPIOB, 13) 171# define B1 PAL_LINE(GPIOB, 13)
172 #define B3 PAL_LINE(GPIOB, 14) 172# define B3 PAL_LINE(GPIOB, 14)
173 #define B2 PAL_LINE(GPIOB, 15) 173# define B2 PAL_LINE(GPIOB, 15)
174 #define B6 PAL_LINE(GPIOB, 9) 174# define B6 PAL_LINE(GPIOB, 9)
175 175
176 // LEDs (only D5/C13 uses an actual LED) 176// LEDs (only D5/C13 uses an actual LED)
177 #ifdef CONVERT_TO_PROTON_C_RXLED 177# ifdef CONVERT_TO_PROTON_C_RXLED
178 #define D5 PAL_LINE(GPIOC, 13) 178# define D5 PAL_LINE(GPIOC, 13)
179 #define B0 PAL_LINE(GPIOC, 13) 179# define B0 PAL_LINE(GPIOC, 13)
180 #else 180# else
181 #define D5 PAL_LINE(GPIOC, 13) 181# define D5 PAL_LINE(GPIOC, 13)
182 #define B0 PAL_LINE(GPIOC, 14) 182# define B0 PAL_LINE(GPIOC, 14)
183 #endif 183# endif
184 #else 184# else
185 #define A0 PAL_LINE(GPIOA, 0) 185# define A0 PAL_LINE(GPIOA, 0)
186 #define A1 PAL_LINE(GPIOA, 1) 186# define A1 PAL_LINE(GPIOA, 1)
187 #define A2 PAL_LINE(GPIOA, 2) 187# define A2 PAL_LINE(GPIOA, 2)
188 #define A3 PAL_LINE(GPIOA, 3) 188# define A3 PAL_LINE(GPIOA, 3)
189 #define A4 PAL_LINE(GPIOA, 4) 189# define A4 PAL_LINE(GPIOA, 4)
190 #define A5 PAL_LINE(GPIOA, 5) 190# define A5 PAL_LINE(GPIOA, 5)
191 #define A6 PAL_LINE(GPIOA, 6) 191# define A6 PAL_LINE(GPIOA, 6)
192 #define A7 PAL_LINE(GPIOA, 7) 192# define A7 PAL_LINE(GPIOA, 7)
193 #define A8 PAL_LINE(GPIOA, 8) 193# define A8 PAL_LINE(GPIOA, 8)
194 #define A9 PAL_LINE(GPIOA, 9) 194# define A9 PAL_LINE(GPIOA, 9)
195 #define A10 PAL_LINE(GPIOA, 10) 195# define A10 PAL_LINE(GPIOA, 10)
196 #define A11 PAL_LINE(GPIOA, 11) 196# define A11 PAL_LINE(GPIOA, 11)
197 #define A12 PAL_LINE(GPIOA, 12) 197# define A12 PAL_LINE(GPIOA, 12)
198 #define A13 PAL_LINE(GPIOA, 13) 198# define A13 PAL_LINE(GPIOA, 13)
199 #define A14 PAL_LINE(GPIOA, 14) 199# define A14 PAL_LINE(GPIOA, 14)
200 #define A15 PAL_LINE(GPIOA, 15) 200# define A15 PAL_LINE(GPIOA, 15)
201 #define B0 PAL_LINE(GPIOB, 0) 201# define B0 PAL_LINE(GPIOB, 0)
202 #define B1 PAL_LINE(GPIOB, 1) 202# define B1 PAL_LINE(GPIOB, 1)
203 #define B2 PAL_LINE(GPIOB, 2) 203# define B2 PAL_LINE(GPIOB, 2)
204 #define B3 PAL_LINE(GPIOB, 3) 204# define B3 PAL_LINE(GPIOB, 3)
205 #define B4 PAL_LINE(GPIOB, 4) 205# define B4 PAL_LINE(GPIOB, 4)
206 #define B5 PAL_LINE(GPIOB, 5) 206# define B5 PAL_LINE(GPIOB, 5)
207 #define B6 PAL_LINE(GPIOB, 6) 207# define B6 PAL_LINE(GPIOB, 6)
208 #define B7 PAL_LINE(GPIOB, 7) 208# define B7 PAL_LINE(GPIOB, 7)
209 #define B8 PAL_LINE(GPIOB, 8) 209# define B8 PAL_LINE(GPIOB, 8)
210 #define B9 PAL_LINE(GPIOB, 9) 210# define B9 PAL_LINE(GPIOB, 9)
211 #define B10 PAL_LINE(GPIOB, 10) 211# define B10 PAL_LINE(GPIOB, 10)
212 #define B11 PAL_LINE(GPIOB, 11) 212# define B11 PAL_LINE(GPIOB, 11)
213 #define B12 PAL_LINE(GPIOB, 12) 213# define B12 PAL_LINE(GPIOB, 12)
214 #define B13 PAL_LINE(GPIOB, 13) 214# define B13 PAL_LINE(GPIOB, 13)
215 #define B14 PAL_LINE(GPIOB, 14) 215# define B14 PAL_LINE(GPIOB, 14)
216 #define B15 PAL_LINE(GPIOB, 15) 216# define B15 PAL_LINE(GPIOB, 15)
217 #define B16 PAL_LINE(GPIOB, 16) 217# define B16 PAL_LINE(GPIOB, 16)
218 #define B17 PAL_LINE(GPIOB, 17) 218# define B17 PAL_LINE(GPIOB, 17)
219 #define C0 PAL_LINE(GPIOC, 0) 219# define C0 PAL_LINE(GPIOC, 0)
220 #define C1 PAL_LINE(GPIOC, 1) 220# define C1 PAL_LINE(GPIOC, 1)
221 #define C2 PAL_LINE(GPIOC, 2) 221# define C2 PAL_LINE(GPIOC, 2)
222 #define C3 PAL_LINE(GPIOC, 3) 222# define C3 PAL_LINE(GPIOC, 3)
223 #define C4 PAL_LINE(GPIOC, 4) 223# define C4 PAL_LINE(GPIOC, 4)
224 #define C5 PAL_LINE(GPIOC, 5) 224# define C5 PAL_LINE(GPIOC, 5)
225 #define C6 PAL_LINE(GPIOC, 6) 225# define C6 PAL_LINE(GPIOC, 6)
226 #define C7 PAL_LINE(GPIOC, 7) 226# define C7 PAL_LINE(GPIOC, 7)
227 #define C8 PAL_LINE(GPIOC, 8) 227# define C8 PAL_LINE(GPIOC, 8)
228 #define C9 PAL_LINE(GPIOC, 9) 228# define C9 PAL_LINE(GPIOC, 9)
229 #define C10 PAL_LINE(GPIOC, 10) 229# define C10 PAL_LINE(GPIOC, 10)
230 #define C11 PAL_LINE(GPIOC, 11) 230# define C11 PAL_LINE(GPIOC, 11)
231 #define C12 PAL_LINE(GPIOC, 12) 231# define C12 PAL_LINE(GPIOC, 12)
232 #define C13 PAL_LINE(GPIOC, 13) 232# define C13 PAL_LINE(GPIOC, 13)
233 #define C14 PAL_LINE(GPIOC, 14) 233# define C14 PAL_LINE(GPIOC, 14)
234 #define C15 PAL_LINE(GPIOC, 15) 234# define C15 PAL_LINE(GPIOC, 15)
235 #define D0 PAL_LINE(GPIOD, 0) 235# define D0 PAL_LINE(GPIOD, 0)
236 #define D1 PAL_LINE(GPIOD, 1) 236# define D1 PAL_LINE(GPIOD, 1)
237 #define D2 PAL_LINE(GPIOD, 2) 237# define D2 PAL_LINE(GPIOD, 2)
238 #define D3 PAL_LINE(GPIOD, 3) 238# define D3 PAL_LINE(GPIOD, 3)
239 #define D4 PAL_LINE(GPIOD, 4) 239# define D4 PAL_LINE(GPIOD, 4)
240 #define D5 PAL_LINE(GPIOD, 5) 240# define D5 PAL_LINE(GPIOD, 5)
241 #define D6 PAL_LINE(GPIOD, 6) 241# define D6 PAL_LINE(GPIOD, 6)
242 #define D7 PAL_LINE(GPIOD, 7) 242# define D7 PAL_LINE(GPIOD, 7)
243 #define D8 PAL_LINE(GPIOD, 8) 243# define D8 PAL_LINE(GPIOD, 8)
244 #define D9 PAL_LINE(GPIOD, 9) 244# define D9 PAL_LINE(GPIOD, 9)
245 #define D10 PAL_LINE(GPIOD, 10) 245# define D10 PAL_LINE(GPIOD, 10)
246 #define D11 PAL_LINE(GPIOD, 11) 246# define D11 PAL_LINE(GPIOD, 11)
247 #define D12 PAL_LINE(GPIOD, 12) 247# define D12 PAL_LINE(GPIOD, 12)
248 #define D13 PAL_LINE(GPIOD, 13) 248# define D13 PAL_LINE(GPIOD, 13)
249 #define D14 PAL_LINE(GPIOD, 14) 249# define D14 PAL_LINE(GPIOD, 14)
250 #define D15 PAL_LINE(GPIOD, 15) 250# define D15 PAL_LINE(GPIOD, 15)
251 #define E0 PAL_LINE(GPIOE, 0) 251# define E0 PAL_LINE(GPIOE, 0)
252 #define E1 PAL_LINE(GPIOE, 1) 252# define E1 PAL_LINE(GPIOE, 1)
253 #define E2 PAL_LINE(GPIOE, 2) 253# define E2 PAL_LINE(GPIOE, 2)
254 #define E3 PAL_LINE(GPIOE, 3) 254# define E3 PAL_LINE(GPIOE, 3)
255 #define E4 PAL_LINE(GPIOE, 4) 255# define E4 PAL_LINE(GPIOE, 4)
256 #define E5 PAL_LINE(GPIOE, 5) 256# define E5 PAL_LINE(GPIOE, 5)
257 #define E6 PAL_LINE(GPIOE, 6) 257# define E6 PAL_LINE(GPIOE, 6)
258 #define E7 PAL_LINE(GPIOE, 7) 258# define E7 PAL_LINE(GPIOE, 7)
259 #define E8 PAL_LINE(GPIOE, 8) 259# define E8 PAL_LINE(GPIOE, 8)
260 #define E9 PAL_LINE(GPIOE, 9) 260# define E9 PAL_LINE(GPIOE, 9)
261 #define E10 PAL_LINE(GPIOE, 10) 261# define E10 PAL_LINE(GPIOE, 10)
262 #define E11 PAL_LINE(GPIOE, 11) 262# define E11 PAL_LINE(GPIOE, 11)
263 #define E12 PAL_LINE(GPIOE, 12) 263# define E12 PAL_LINE(GPIOE, 12)
264 #define E13 PAL_LINE(GPIOE, 13) 264# define E13 PAL_LINE(GPIOE, 13)
265 #define E14 PAL_LINE(GPIOE, 14) 265# define E14 PAL_LINE(GPIOE, 14)
266 #define E15 PAL_LINE(GPIOE, 15) 266# define E15 PAL_LINE(GPIOE, 15)
267 #define F0 PAL_LINE(GPIOF, 0) 267# define F0 PAL_LINE(GPIOF, 0)
268 #define F1 PAL_LINE(GPIOF, 1) 268# define F1 PAL_LINE(GPIOF, 1)
269 #define F2 PAL_LINE(GPIOF, 2) 269# define F2 PAL_LINE(GPIOF, 2)
270 #define F3 PAL_LINE(GPIOF, 3) 270# define F3 PAL_LINE(GPIOF, 3)
271 #define F4 PAL_LINE(GPIOF, 4) 271# define F4 PAL_LINE(GPIOF, 4)
272 #define F5 PAL_LINE(GPIOF, 5) 272# define F5 PAL_LINE(GPIOF, 5)
273 #define F6 PAL_LINE(GPIOF, 6) 273# define F6 PAL_LINE(GPIOF, 6)
274 #define F7 PAL_LINE(GPIOF, 7) 274# define F7 PAL_LINE(GPIOF, 7)
275 #define F8 PAL_LINE(GPIOF, 8) 275# define F8 PAL_LINE(GPIOF, 8)
276 #define F9 PAL_LINE(GPIOF, 9) 276# define F9 PAL_LINE(GPIOF, 9)
277 #define F10 PAL_LINE(GPIOF, 10) 277# define F10 PAL_LINE(GPIOF, 10)
278 #define F11 PAL_LINE(GPIOF, 11) 278# define F11 PAL_LINE(GPIOF, 11)
279 #define F12 PAL_LINE(GPIOF, 12) 279# define F12 PAL_LINE(GPIOF, 12)
280 #define F13 PAL_LINE(GPIOF, 13) 280# define F13 PAL_LINE(GPIOF, 13)
281 #define F14 PAL_LINE(GPIOF, 14) 281# define F14 PAL_LINE(GPIOF, 14)
282 #define F15 PAL_LINE(GPIOF, 15) 282# define F15 PAL_LINE(GPIOF, 15)
283 #endif 283# endif
284#endif 284#endif
285 285
286/* USART configuration */ 286/* USART configuration */
287#ifdef BLUETOOTH_ENABLE 287#ifdef BLUETOOTH_ENABLE
288# ifdef __AVR_ATmega32U4__ 288# ifdef __AVR_ATmega32U4__
289# define SERIAL_UART_BAUD 9600 289# define SERIAL_UART_BAUD 9600
290# define SERIAL_UART_DATA UDR1 290# define SERIAL_UART_DATA UDR1
291# define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1) 291# define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
292# define SERIAL_UART_RXD_VECT USART1_RX_vect 292# define SERIAL_UART_RXD_VECT USART1_RX_vect
293# define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1)) 293# define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
294# define SERIAL_UART_INIT() do { \ 294# define SERIAL_UART_INIT() \
295 /* baud rate */ \ 295 do { \
296 UBRR1L = SERIAL_UART_UBRR; \ 296 /* baud rate */ \
297 /* baud rate */ \ 297 UBRR1L = SERIAL_UART_UBRR; \
298 UBRR1H = SERIAL_UART_UBRR >> 8; \ 298 /* baud rate */ \
299 /* enable TX */ \ 299 UBRR1H = SERIAL_UART_UBRR >> 8; \
300 UCSR1B = _BV(TXEN1); \ 300 /* enable TX */ \
301 /* 8-bit data */ \ 301 UCSR1B = _BV(TXEN1); \
302 UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \ 302 /* 8-bit data */ \
303 sei(); \ 303 UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
304 } while(0) 304 sei(); \
305# else 305 } while (0)
306# error "USART configuration is needed." 306# else
307# endif 307# error "USART configuration is needed."
308# endif
308#endif 309#endif
309 310
310#define API_SYSEX_MAX_SIZE 32 311#define API_SYSEX_MAX_SIZE 32