aboutsummaryrefslogtreecommitdiff
path: root/quantum/config_common.h
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2021-02-14 00:51:06 +0000
committerGitHub <noreply@github.com>2021-02-14 11:51:06 +1100
commitde8caf708c1a9a80527a04be620ed3969262e50b (patch)
tree2b0839ed1f1c77c3bab8c1c28fff6f4ba62696eb /quantum/config_common.h
parent101990139f3efc0d61491d58f41474f5bc039c66 (diff)
downloadqmk_firmware-de8caf708c1a9a80527a04be620ed3969262e50b.tar.gz
qmk_firmware-de8caf708c1a9a80527a04be620ed3969262e50b.zip
Split gpio and atomic to platform (#11792)
Diffstat (limited to 'quantum/config_common.h')
-rw-r--r--quantum/config_common.h351
1 files changed, 4 insertions, 347 deletions
diff --git a/quantum/config_common.h b/quantum/config_common.h
index 5973232ef..fa1ff2a5f 100644
--- a/quantum/config_common.h
+++ b/quantum/config_common.h
@@ -16,357 +16,14 @@
16 16
17#pragma once 17#pragma once
18 18
19#ifndef __ASSEMBLER__
20# include "pin_defs.h"
21#endif
22
19/* diode directions */ 23/* diode directions */
20#define COL2ROW 0 24#define COL2ROW 0
21#define ROW2COL 1 25#define ROW2COL 1
22 26
23// useful for direct pin mapping
24#define NO_PIN (pin_t)(~0)
25
26#ifdef __AVR__
27# ifndef __ASSEMBLER__
28# include <avr/io.h>
29# endif
30# define PORT_SHIFTER 4 // this may be 4 for all AVR chips
31
32// If you want to add more to this list, reference the PINx definitions in these header
33// files: https://github.com/vancegroup-mirrors/avr-libc/tree/master/avr-libc/include/avr
34
35# if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__)
36# define ADDRESS_BASE 0x00
37# define PINB_ADDRESS 0x3
38# define PINC_ADDRESS 0x6
39# define PIND_ADDRESS 0x9
40# define PINE_ADDRESS 0xC
41# define PINF_ADDRESS 0xF
42# elif defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)
43# define ADDRESS_BASE 0x00
44# define PINB_ADDRESS 0x3
45# define PINC_ADDRESS 0x6
46# define PIND_ADDRESS 0x9
47# elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__)
48# define ADDRESS_BASE 0x00
49# define PINA_ADDRESS 0x0
50# define PINB_ADDRESS 0x3
51# define PINC_ADDRESS 0x6
52# define PIND_ADDRESS 0x9
53# define PINE_ADDRESS 0xC
54# define PINF_ADDRESS 0xF
55# elif defined(__AVR_ATmega32A__)
56# define ADDRESS_BASE 0x10
57# define PIND_ADDRESS 0x0
58# define PINC_ADDRESS 0x3
59# define PINB_ADDRESS 0x6
60# define PINA_ADDRESS 0x9
61# elif defined(__AVR_ATtiny85__)
62# define ADDRESS_BASE 0x10
63# define PINB_ADDRESS 0x6
64# else
65# error "Pins are not defined"
66# endif
67
68/* I/O pins */
69# define PINDEF(port, pin) ((PIN##port##_ADDRESS << PORT_SHIFTER) | pin)
70
71# ifdef PORTA
72# define A0 PINDEF(A, 0)
73# define A1 PINDEF(A, 1)
74# define A2 PINDEF(A, 2)
75# define A3 PINDEF(A, 3)
76# define A4 PINDEF(A, 4)
77# define A5 PINDEF(A, 5)
78# define A6 PINDEF(A, 6)
79# define A7 PINDEF(A, 7)
80# endif
81# ifdef PORTB
82# define B0 PINDEF(B, 0)
83# define B1 PINDEF(B, 1)
84# define B2 PINDEF(B, 2)
85# define B3 PINDEF(B, 3)
86# define B4 PINDEF(B, 4)
87# define B5 PINDEF(B, 5)
88# define B6 PINDEF(B, 6)
89# define B7 PINDEF(B, 7)
90# endif
91# ifdef PORTC
92# define C0 PINDEF(C, 0)
93# define C1 PINDEF(C, 1)
94# define C2 PINDEF(C, 2)
95# define C3 PINDEF(C, 3)
96# define C4 PINDEF(C, 4)
97# define C5 PINDEF(C, 5)
98# define C6 PINDEF(C, 6)
99# define C7 PINDEF(C, 7)
100# endif
101# ifdef PORTD
102# define D0 PINDEF(D, 0)
103# define D1 PINDEF(D, 1)
104# define D2 PINDEF(D, 2)
105# define D3 PINDEF(D, 3)
106# define D4 PINDEF(D, 4)
107# define D5 PINDEF(D, 5)
108# define D6 PINDEF(D, 6)
109# define D7 PINDEF(D, 7)
110# endif
111# ifdef PORTE
112# define E0 PINDEF(E, 0)
113# define E1 PINDEF(E, 1)
114# define E2 PINDEF(E, 2)
115# define E3 PINDEF(E, 3)
116# define E4 PINDEF(E, 4)
117# define E5 PINDEF(E, 5)
118# define E6 PINDEF(E, 6)
119# define E7 PINDEF(E, 7)
120# endif
121# ifdef PORTF
122# define F0 PINDEF(F, 0)
123# define F1 PINDEF(F, 1)
124# define F2 PINDEF(F, 2)
125# define F3 PINDEF(F, 3)
126# define F4 PINDEF(F, 4)
127# define F5 PINDEF(F, 5)
128# define F6 PINDEF(F, 6)
129# define F7 PINDEF(F, 7)
130# endif
131
132# ifndef __ASSEMBLER__
133# define _PIN_ADDRESS(p, offset) _SFR_IO8(ADDRESS_BASE + ((p) >> PORT_SHIFTER) + (offset))
134// Port X Input Pins Address
135# define PINx_ADDRESS(p) _PIN_ADDRESS(p, 0)
136// Port X Data Direction Register, 0:input 1:output
137# define DDRx_ADDRESS(p) _PIN_ADDRESS(p, 1)
138// Port X Data Register
139# define PORTx_ADDRESS(p) _PIN_ADDRESS(p, 2)
140# endif
141
142#elif defined(PROTOCOL_CHIBIOS)
143// Defines mapping for Proton C replacement
144# ifdef CONVERT_TO_PROTON_C
145// Left side (front)
146# define D3 PAL_LINE(GPIOA, 9)
147# define D2 PAL_LINE(GPIOA, 10)
148// GND
149// GND
150# define D1 PAL_LINE(GPIOB, 7)
151# define D0 PAL_LINE(GPIOB, 6)
152# define D4 PAL_LINE(GPIOB, 5)
153# define C6 PAL_LINE(GPIOB, 4)
154# define D7 PAL_LINE(GPIOB, 3)
155# define E6 PAL_LINE(GPIOB, 2)
156# define B4 PAL_LINE(GPIOB, 1)
157# define B5 PAL_LINE(GPIOB, 0)
158
159// Right side (front)
160// RAW
161// GND
162// RESET
163// VCC
164# define F4 PAL_LINE(GPIOA, 2)
165# define F5 PAL_LINE(GPIOA, 1)
166# define F6 PAL_LINE(GPIOA, 0)
167# define F7 PAL_LINE(GPIOB, 8)
168# define B1 PAL_LINE(GPIOB, 13)
169# define B3 PAL_LINE(GPIOB, 14)
170# define B2 PAL_LINE(GPIOB, 15)
171# define B6 PAL_LINE(GPIOB, 9)
172
173// LEDs (only D5/C13 uses an actual LED)
174# ifdef CONVERT_TO_PROTON_C_RXLED
175# define D5 PAL_LINE(GPIOC, 14)
176# define B0 PAL_LINE(GPIOC, 13)
177# else
178# define D5 PAL_LINE(GPIOC, 13)
179# define B0 PAL_LINE(GPIOC, 14)
180# endif
181# else
182# define A0 PAL_LINE(GPIOA, 0)
183# define A1 PAL_LINE(GPIOA, 1)
184# define A2 PAL_LINE(GPIOA, 2)
185# define A3 PAL_LINE(GPIOA, 3)
186# define A4 PAL_LINE(GPIOA, 4)
187# define A5 PAL_LINE(GPIOA, 5)
188# define A6 PAL_LINE(GPIOA, 6)
189# define A7 PAL_LINE(GPIOA, 7)
190# define A8 PAL_LINE(GPIOA, 8)
191# define A9 PAL_LINE(GPIOA, 9)
192# define A10 PAL_LINE(GPIOA, 10)
193# define A11 PAL_LINE(GPIOA, 11)
194# define A12 PAL_LINE(GPIOA, 12)
195# define A13 PAL_LINE(GPIOA, 13)
196# define A14 PAL_LINE(GPIOA, 14)
197# define A15 PAL_LINE(GPIOA, 15)
198# define B0 PAL_LINE(GPIOB, 0)
199# define B1 PAL_LINE(GPIOB, 1)
200# define B2 PAL_LINE(GPIOB, 2)
201# define B3 PAL_LINE(GPIOB, 3)
202# define B4 PAL_LINE(GPIOB, 4)
203# define B5 PAL_LINE(GPIOB, 5)
204# define B6 PAL_LINE(GPIOB, 6)
205# define B7 PAL_LINE(GPIOB, 7)
206# define B8 PAL_LINE(GPIOB, 8)
207# define B9 PAL_LINE(GPIOB, 9)
208# define B10 PAL_LINE(GPIOB, 10)
209# define B11 PAL_LINE(GPIOB, 11)
210# define B12 PAL_LINE(GPIOB, 12)
211# define B13 PAL_LINE(GPIOB, 13)
212# define B14 PAL_LINE(GPIOB, 14)
213# define B15 PAL_LINE(GPIOB, 15)
214# define B16 PAL_LINE(GPIOB, 16)
215# define B17 PAL_LINE(GPIOB, 17)
216# define B18 PAL_LINE(GPIOB, 18)
217# define B19 PAL_LINE(GPIOB, 19)
218# define C0 PAL_LINE(GPIOC, 0)
219# define C1 PAL_LINE(GPIOC, 1)
220# define C2 PAL_LINE(GPIOC, 2)
221# define C3 PAL_LINE(GPIOC, 3)
222# define C4 PAL_LINE(GPIOC, 4)
223# define C5 PAL_LINE(GPIOC, 5)
224# define C6 PAL_LINE(GPIOC, 6)
225# define C7 PAL_LINE(GPIOC, 7)
226# define C8 PAL_LINE(GPIOC, 8)
227# define C9 PAL_LINE(GPIOC, 9)
228# define C10 PAL_LINE(GPIOC, 10)
229# define C11 PAL_LINE(GPIOC, 11)
230# define C12 PAL_LINE(GPIOC, 12)
231# define C13 PAL_LINE(GPIOC, 13)
232# define C14 PAL_LINE(GPIOC, 14)
233# define C15 PAL_LINE(GPIOC, 15)
234# define D0 PAL_LINE(GPIOD, 0)
235# define D1 PAL_LINE(GPIOD, 1)
236# define D2 PAL_LINE(GPIOD, 2)
237# define D3 PAL_LINE(GPIOD, 3)
238# define D4 PAL_LINE(GPIOD, 4)
239# define D5 PAL_LINE(GPIOD, 5)
240# define D6 PAL_LINE(GPIOD, 6)
241# define D7 PAL_LINE(GPIOD, 7)
242# define D8 PAL_LINE(GPIOD, 8)
243# define D9 PAL_LINE(GPIOD, 9)
244# define D10 PAL_LINE(GPIOD, 10)
245# define D11 PAL_LINE(GPIOD, 11)
246# define D12 PAL_LINE(GPIOD, 12)
247# define D13 PAL_LINE(GPIOD, 13)
248# define D14 PAL_LINE(GPIOD, 14)
249# define D15 PAL_LINE(GPIOD, 15)
250# define E0 PAL_LINE(GPIOE, 0)
251# define E1 PAL_LINE(GPIOE, 1)
252# define E2 PAL_LINE(GPIOE, 2)
253# define E3 PAL_LINE(GPIOE, 3)
254# define E4 PAL_LINE(GPIOE, 4)
255# define E5 PAL_LINE(GPIOE, 5)
256# define E6 PAL_LINE(GPIOE, 6)
257# define E7 PAL_LINE(GPIOE, 7)
258# define E8 PAL_LINE(GPIOE, 8)
259# define E9 PAL_LINE(GPIOE, 9)
260# define E10 PAL_LINE(GPIOE, 10)
261# define E11 PAL_LINE(GPIOE, 11)
262# define E12 PAL_LINE(GPIOE, 12)
263# define E13 PAL_LINE(GPIOE, 13)
264# define E14 PAL_LINE(GPIOE, 14)
265# define E15 PAL_LINE(GPIOE, 15)
266# define F0 PAL_LINE(GPIOF, 0)
267# define F1 PAL_LINE(GPIOF, 1)
268# define F2 PAL_LINE(GPIOF, 2)
269# define F3 PAL_LINE(GPIOF, 3)
270# define F4 PAL_LINE(GPIOF, 4)
271# define F5 PAL_LINE(GPIOF, 5)
272# define F6 PAL_LINE(GPIOF, 6)
273# define F7 PAL_LINE(GPIOF, 7)
274# define F8 PAL_LINE(GPIOF, 8)
275# define F9 PAL_LINE(GPIOF, 9)
276# define F10 PAL_LINE(GPIOF, 10)
277# define F11 PAL_LINE(GPIOF, 11)
278# define F12 PAL_LINE(GPIOF, 12)
279# define F13 PAL_LINE(GPIOF, 13)
280# define F14 PAL_LINE(GPIOF, 14)
281# define F15 PAL_LINE(GPIOF, 15)
282# define G0 PAL_LINE(GPIOG, 0)
283# define G1 PAL_LINE(GPIOG, 1)
284# define G2 PAL_LINE(GPIOG, 2)
285# define G3 PAL_LINE(GPIOG, 3)
286# define G4 PAL_LINE(GPIOG, 4)
287# define G5 PAL_LINE(GPIOG, 5)
288# define G6 PAL_LINE(GPIOG, 6)
289# define G7 PAL_LINE(GPIOG, 7)
290# define G8 PAL_LINE(GPIOG, 8)
291# define G9 PAL_LINE(GPIOG, 9)
292# define G10 PAL_LINE(GPIOG, 10)
293# define G11 PAL_LINE(GPIOG, 11)
294# define G12 PAL_LINE(GPIOG, 12)
295# define G13 PAL_LINE(GPIOG, 13)
296# define G14 PAL_LINE(GPIOG, 14)
297# define G15 PAL_LINE(GPIOG, 15)
298# define H0 PAL_LINE(GPIOH, 0)
299# define H1 PAL_LINE(GPIOH, 1)
300# define H2 PAL_LINE(GPIOH, 2)
301# define H3 PAL_LINE(GPIOH, 3)
302# define H4 PAL_LINE(GPIOH, 4)
303# define H5 PAL_LINE(GPIOH, 5)
304# define H6 PAL_LINE(GPIOH, 6)
305# define H7 PAL_LINE(GPIOH, 7)
306# define H8 PAL_LINE(GPIOH, 8)
307# define H9 PAL_LINE(GPIOH, 9)
308# define H10 PAL_LINE(GPIOH, 10)
309# define H11 PAL_LINE(GPIOH, 11)
310# define H12 PAL_LINE(GPIOH, 12)
311# define H13 PAL_LINE(GPIOH, 13)
312# define H14 PAL_LINE(GPIOH, 14)
313# define H15 PAL_LINE(GPIOH, 15)
314# define I0 PAL_LINE(GPIOI, 0)
315# define I1 PAL_LINE(GPIOI, 1)
316# define I2 PAL_LINE(GPIOI, 2)
317# define I3 PAL_LINE(GPIOI, 3)
318# define I4 PAL_LINE(GPIOI, 4)
319# define I5 PAL_LINE(GPIOI, 5)
320# define I6 PAL_LINE(GPIOI, 6)
321# define I7 PAL_LINE(GPIOI, 7)
322# define I8 PAL_LINE(GPIOI, 8)
323# define I9 PAL_LINE(GPIOI, 9)
324# define I10 PAL_LINE(GPIOI, 10)
325# define I11 PAL_LINE(GPIOI, 11)
326# define I12 PAL_LINE(GPIOI, 12)
327# define I13 PAL_LINE(GPIOI, 13)
328# define I14 PAL_LINE(GPIOI, 14)
329# define I15 PAL_LINE(GPIOI, 15)
330# define J0 PAL_LINE(GPIOJ, 0)
331# define J1 PAL_LINE(GPIOJ, 1)
332# define J2 PAL_LINE(GPIOJ, 2)
333# define J3 PAL_LINE(GPIOJ, 3)
334# define J4 PAL_LINE(GPIOJ, 4)
335# define J5 PAL_LINE(GPIOJ, 5)
336# define J6 PAL_LINE(GPIOJ, 6)
337# define J7 PAL_LINE(GPIOJ, 7)
338# define J8 PAL_LINE(GPIOJ, 8)
339# define J9 PAL_LINE(GPIOJ, 9)
340# define J10 PAL_LINE(GPIOJ, 10)
341# define J11 PAL_LINE(GPIOJ, 11)
342# define J12 PAL_LINE(GPIOJ, 12)
343# define J13 PAL_LINE(GPIOJ, 13)
344# define J14 PAL_LINE(GPIOJ, 14)
345# define J15 PAL_LINE(GPIOJ, 15)
346// Keyboards can `#define KEYBOARD_REQUIRES_GPIOK` if they need to access GPIO-K pins. These conflict with a whole
347// bunch of layout definitions, so it's intentionally left out unless absolutely required -- in that case, the
348// keyboard designer should use a different symbol when defining their layout macros.
349# ifdef KEYBOARD_REQUIRES_GPIOK
350# define K0 PAL_LINE(GPIOK, 0)
351# define K1 PAL_LINE(GPIOK, 1)
352# define K2 PAL_LINE(GPIOK, 2)
353# define K3 PAL_LINE(GPIOK, 3)
354# define K4 PAL_LINE(GPIOK, 4)
355# define K5 PAL_LINE(GPIOK, 5)
356# define K6 PAL_LINE(GPIOK, 6)
357# define K7 PAL_LINE(GPIOK, 7)
358# define K8 PAL_LINE(GPIOK, 8)
359# define K9 PAL_LINE(GPIOK, 9)
360# define K10 PAL_LINE(GPIOK, 10)
361# define K11 PAL_LINE(GPIOK, 11)
362# define K12 PAL_LINE(GPIOK, 12)
363# define K13 PAL_LINE(GPIOK, 13)
364# define K14 PAL_LINE(GPIOK, 14)
365# define K15 PAL_LINE(GPIOK, 15)
366# endif
367# endif
368#endif
369
370#define API_SYSEX_MAX_SIZE 32 27#define API_SYSEX_MAX_SIZE 32
371 28
372#include "song_list.h" 29#include "song_list.h"