aboutsummaryrefslogtreecommitdiff
path: root/quantum/config_common.h
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/config_common.h')
-rw-r--r--quantum/config_common.h257
1 files changed, 201 insertions, 56 deletions
diff --git a/quantum/config_common.h b/quantum/config_common.h
index f6f51b367..cbff372ea 100644
--- a/quantum/config_common.h
+++ b/quantum/config_common.h
@@ -1,4 +1,4 @@
1/* Copyright 2015-2017 Jack Humbert 1/* Copyright 2015-2018 Jack Humbert
2 * 2 *
3 * This program is free software: you can redistribute it and/or modify 3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by 4 * it under the terms of the GNU General Public License as published by
@@ -14,8 +14,7 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16 16
17#ifndef CONFIG_DEFINITIONS_H 17#pragma once
18#define CONFIG_DEFINITIONS_H
19 18
20/* diode directions */ 19/* diode directions */
21#define COL2ROW 0 20#define COL2ROW 0
@@ -23,57 +22,205 @@
23#define CUSTOM_MATRIX 2 /* Disables built-in matrix scanning code */ 22#define CUSTOM_MATRIX 2 /* Disables built-in matrix scanning code */
24 23
25#ifdef __AVR__ 24#ifdef __AVR__
26 /* I/O pins */ 25 #ifndef __ASSEMBLER__
27 #ifndef F0 26 #include <avr/io.h>
28 #define B0 0x30 27 #endif
29 #define B1 0x31 28 #define PORT_SHIFTER 4 // this may be 4 for all AVR chips
30 #define B2 0x32 29
31 #define B3 0x33 30 // If you want to add more to this list, reference the PINx definitions in these header
32 #define B4 0x34 31 // files: https://github.com/vancegroup-mirrors/avr-libc/tree/master/avr-libc/include/avr
33 #define B5 0x35 32
34 #define B6 0x36 33 #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__)
35 #define B7 0x37 34 #define ADDRESS_BASE 0x00
36 #define C0 0x60 35 #define PINB_ADDRESS 0x3
37 #define C1 0x61 36 #define PINC_ADDRESS 0x6
38 #define C2 0x62 37 #define PIND_ADDRESS 0x9
39 #define C3 0x63 38 #define PINE_ADDRESS 0xC
40 #define C4 0x64 39 #define PINF_ADDRESS 0xF
41 #define C5 0x65 40 #elif defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__)
42 #define C6 0x66 41 #define ADDRESS_BASE 0x00
43 #define C7 0x67 42 #define PINB_ADDRESS 0x3
44 #define D0 0x90 43 #define PINC_ADDRESS 0x6
45 #define D1 0x91 44 #define PIND_ADDRESS 0x9
46 #define D2 0x92 45 #elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__)
47 #define D3 0x93 46 #define ADDRESS_BASE 0x00
48 #define D4 0x94 47 #define PINA_ADDRESS 0x0
49 #define D5 0x95 48 #define PINB_ADDRESS 0x3
50 #define D6 0x96 49 #define PINC_ADDRESS 0x6
51 #define D7 0x97 50 #define PIND_ADDRESS 0x9
52 #define E0 0xC0 51 #define PINE_ADDRESS 0xC
53 #define E1 0xC1 52 #define PINF_ADDRESS 0xF
54 #define E2 0xC2 53 #elif defined(__AVR_ATmega32A__)
55 #define E3 0xC3 54 #define ADDRESS_BASE 0x10
56 #define E4 0xC4 55 #define PIND_ADDRESS 0x0
57 #define E5 0xC5 56 #define PINC_ADDRESS 0x3
58 #define E6 0xC6 57 #define PINB_ADDRESS 0x6
59 #define E7 0xC7 58 #define PINA_ADDRESS 0x9
60 #define F0 0xF0 59 #else
61 #define F1 0xF1 60 #error "Pins are not defined"
62 #define F2 0xF2 61 #endif
63 #define F3 0xF3 62
64 #define F4 0xF4 63 /* I/O pins */
65 #define F5 0xF5 64 #define PINDEF(port, pin) ((PIN##port##_ADDRESS << PORT_SHIFTER) | pin)
66 #define F6 0xF6 65
67 #define F7 0xF7 66 #ifdef PORTA
68 #define A0 0x00 67 #define A0 PINDEF(A, 0)
69 #define A1 0x01 68 #define A1 PINDEF(A, 1)
70 #define A2 0x02 69 #define A2 PINDEF(A, 2)
71 #define A3 0x03 70 #define A3 PINDEF(A, 3)
72 #define A4 0x04 71 #define A4 PINDEF(A, 4)
73 #define A5 0x05 72 #define A5 PINDEF(A, 5)
74 #define A6 0x06 73 #define A6 PINDEF(A, 6)
75 #define A7 0x07 74 #define A7 PINDEF(A, 7)
76 #endif 75 #endif
76 #ifdef PORTB
77 #define B0 PINDEF(B, 0)
78 #define B1 PINDEF(B, 1)
79 #define B2 PINDEF(B, 2)
80 #define B3 PINDEF(B, 3)
81 #define B4 PINDEF(B, 4)
82 #define B5 PINDEF(B, 5)
83 #define B6 PINDEF(B, 6)
84 #define B7 PINDEF(B, 7)
85 #endif
86 #ifdef PORTC
87 #define C0 PINDEF(C, 0)
88 #define C1 PINDEF(C, 1)
89 #define C2 PINDEF(C, 2)
90 #define C3 PINDEF(C, 3)
91 #define C4 PINDEF(C, 4)
92 #define C5 PINDEF(C, 5)
93 #define C6 PINDEF(C, 6)
94 #define C7 PINDEF(C, 7)
95 #endif
96 #ifdef PORTD
97 #define D0 PINDEF(D, 0)
98 #define D1 PINDEF(D, 1)
99 #define D2 PINDEF(D, 2)
100 #define D3 PINDEF(D, 3)
101 #define D4 PINDEF(D, 4)
102 #define D5 PINDEF(D, 5)
103 #define D6 PINDEF(D, 6)
104 #define D7 PINDEF(D, 7)
105 #endif
106 #ifdef PORTE
107 #define E0 PINDEF(E, 0)
108 #define E1 PINDEF(E, 1)
109 #define E2 PINDEF(E, 2)
110 #define E3 PINDEF(E, 3)
111 #define E4 PINDEF(E, 4)
112 #define E5 PINDEF(E, 5)
113 #define E6 PINDEF(E, 6)
114 #define E7 PINDEF(E, 7)
115 #endif
116 #ifdef PORTF
117 #define F0 PINDEF(F, 0)
118 #define F1 PINDEF(F, 1)
119 #define F2 PINDEF(F, 2)
120 #define F3 PINDEF(F, 3)
121 #define F4 PINDEF(F, 4)
122 #define F5 PINDEF(F, 5)
123 #define F6 PINDEF(F, 6)
124 #define F7 PINDEF(F, 7)
125 #endif
126
127#elif defined(PROTOCOL_CHIBIOS)
128 #define A0 PAL_LINE(GPIOA, 0)
129 #define A1 PAL_LINE(GPIOA, 1)
130 #define A2 PAL_LINE(GPIOA, 2)
131 #define A3 PAL_LINE(GPIOA, 3)
132 #define A4 PAL_LINE(GPIOA, 4)
133 #define A5 PAL_LINE(GPIOA, 5)
134 #define A6 PAL_LINE(GPIOA, 6)
135 #define A7 PAL_LINE(GPIOA, 7)
136 #define A8 PAL_LINE(GPIOA, 8)
137 #define A9 PAL_LINE(GPIOA, 9)
138 #define A10 PAL_LINE(GPIOA, 10)
139 #define A11 PAL_LINE(GPIOA, 11)
140 #define A12 PAL_LINE(GPIOA, 12)
141 #define A13 PAL_LINE(GPIOA, 13)
142 #define A14 PAL_LINE(GPIOA, 14)
143 #define A15 PAL_LINE(GPIOA, 15)
144 #define B0 PAL_LINE(GPIOB, 0)
145 #define B1 PAL_LINE(GPIOB, 1)
146 #define B2 PAL_LINE(GPIOB, 2)
147 #define B3 PAL_LINE(GPIOB, 3)
148 #define B4 PAL_LINE(GPIOB, 4)
149 #define B5 PAL_LINE(GPIOB, 5)
150 #define B6 PAL_LINE(GPIOB, 6)
151 #define B7 PAL_LINE(GPIOB, 7)
152 #define B8 PAL_LINE(GPIOB, 8)
153 #define B9 PAL_LINE(GPIOB, 9)
154 #define B10 PAL_LINE(GPIOB, 10)
155 #define B11 PAL_LINE(GPIOB, 11)
156 #define B12 PAL_LINE(GPIOB, 12)
157 #define B13 PAL_LINE(GPIOB, 13)
158 #define B14 PAL_LINE(GPIOB, 14)
159 #define B15 PAL_LINE(GPIOB, 15)
160 #define C0 PAL_LINE(GPIOC, 0)
161 #define C1 PAL_LINE(GPIOC, 1)
162 #define C2 PAL_LINE(GPIOC, 2)
163 #define C3 PAL_LINE(GPIOC, 3)
164 #define C4 PAL_LINE(GPIOC, 4)
165 #define C5 PAL_LINE(GPIOC, 5)
166 #define C6 PAL_LINE(GPIOC, 6)
167 #define C7 PAL_LINE(GPIOC, 7)
168 #define C8 PAL_LINE(GPIOC, 8)
169 #define C9 PAL_LINE(GPIOC, 9)
170 #define C10 PAL_LINE(GPIOC, 10)
171 #define C11 PAL_LINE(GPIOC, 11)
172 #define C12 PAL_LINE(GPIOC, 12)
173 #define C13 PAL_LINE(GPIOC, 13)
174 #define C14 PAL_LINE(GPIOC, 14)
175 #define C15 PAL_LINE(GPIOC, 15)
176 #define D0 PAL_LINE(GPIOD, 0)
177 #define D1 PAL_LINE(GPIOD, 1)
178 #define D2 PAL_LINE(GPIOD, 2)
179 #define D3 PAL_LINE(GPIOD, 3)
180 #define D4 PAL_LINE(GPIOD, 4)
181 #define D5 PAL_LINE(GPIOD, 5)
182 #define D6 PAL_LINE(GPIOD, 6)
183 #define D7 PAL_LINE(GPIOD, 7)
184 #define D8 PAL_LINE(GPIOD, 8)
185 #define D9 PAL_LINE(GPIOD, 9)
186 #define D10 PAL_LINE(GPIOD, 10)
187 #define D11 PAL_LINE(GPIOD, 11)
188 #define D12 PAL_LINE(GPIOD, 12)
189 #define D13 PAL_LINE(GPIOD, 13)
190 #define D14 PAL_LINE(GPIOD, 14)
191 #define D15 PAL_LINE(GPIOD, 15)
192 #define E0 PAL_LINE(GPIOE, 0)
193 #define E1 PAL_LINE(GPIOE, 1)
194 #define E2 PAL_LINE(GPIOE, 2)
195 #define E3 PAL_LINE(GPIOE, 3)
196 #define E4 PAL_LINE(GPIOE, 4)
197 #define E5 PAL_LINE(GPIOE, 5)
198 #define E6 PAL_LINE(GPIOE, 6)
199 #define E7 PAL_LINE(GPIOE, 7)
200 #define E8 PAL_LINE(GPIOE, 8)
201 #define E9 PAL_LINE(GPIOE, 9)
202 #define E10 PAL_LINE(GPIOE, 10)
203 #define E11 PAL_LINE(GPIOE, 11)
204 #define E12 PAL_LINE(GPIOE, 12)
205 #define E13 PAL_LINE(GPIOE, 13)
206 #define E14 PAL_LINE(GPIOE, 14)
207 #define E15 PAL_LINE(GPIOE, 15)
208 #define F0 PAL_LINE(GPIOF, 0)
209 #define F1 PAL_LINE(GPIOF, 1)
210 #define F2 PAL_LINE(GPIOF, 2)
211 #define F3 PAL_LINE(GPIOF, 3)
212 #define F4 PAL_LINE(GPIOF, 4)
213 #define F5 PAL_LINE(GPIOF, 5)
214 #define F6 PAL_LINE(GPIOF, 6)
215 #define F7 PAL_LINE(GPIOF, 7)
216 #define F8 PAL_LINE(GPIOF, 8)
217 #define F9 PAL_LINE(GPIOF, 9)
218 #define F10 PAL_LINE(GPIOF, 10)
219 #define F11 PAL_LINE(GPIOF, 11)
220 #define F12 PAL_LINE(GPIOF, 12)
221 #define F13 PAL_LINE(GPIOF, 13)
222 #define F14 PAL_LINE(GPIOF, 14)
223 #define F15 PAL_LINE(GPIOF, 15)
77#endif 224#endif
78 225
79/* USART configuration */ 226/* USART configuration */
@@ -103,5 +250,3 @@
103#define API_SYSEX_MAX_SIZE 32 250#define API_SYSEX_MAX_SIZE 32
104 251
105#include "song_list.h" 252#include "song_list.h"
106
107#endif