]> git.donarmstrong.com Git - qmk_firmware.git/blob - quantum/config_common.h
288617255f51ad8324a1b163e7af610947b71cf2
[qmk_firmware.git] / quantum / config_common.h
1 /* Copyright 2015-2017 Jack Humbert
2  *
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
5  * the Free Software Foundation, either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15  */
16
17 #ifndef CONFIG_DEFINITIONS_H
18 #define CONFIG_DEFINITIONS_H
19
20 /* diode directions */
21 #define COL2ROW       0
22 #define ROW2COL       1
23 #define CUSTOM_MATRIX 2 /* Disables built-in matrix scanning code */
24
25 #ifdef __AVR__
26     /* I/O pins */
27     #ifndef F0
28         #define B0 0x30
29         #define B1 0x31
30         #define B2 0x32
31         #define B3 0x33
32         #define B4 0x34
33         #define B5 0x35
34         #define B6 0x36
35         #define B7 0x37
36         #define C0 0x60
37         #define C1 0x61
38         #define C2 0x62
39         #define C3 0x63
40         #define C4 0x64
41         #define C5 0x65
42         #define C6 0x66
43         #define C7 0x67
44         #define D0 0x90
45         #define D1 0x91
46         #define D2 0x92
47         #define D3 0x93
48         #define D4 0x94
49         #define D5 0x95
50         #define D6 0x96
51         #define D7 0x97
52         #define E0 0xC0
53         #define E1 0xC1
54         #define E2 0xC2
55         #define E3 0xC3
56         #define E4 0xC4
57         #define E5 0xC5
58         #define E6 0xC6
59         #define E7 0xC7
60         #define F0 0xF0
61         #define F1 0xF1
62         #define F2 0xF2
63         #define F3 0xF3
64         #define F4 0xF4
65         #define F5 0xF5
66         #define F6 0xF6
67         #define F7 0xF7
68         #define A0 0x00
69         #define A1 0x01
70         #define A2 0x02
71         #define A3 0x03
72         #define A4 0x04
73         #define A5 0x05
74         #define A6 0x06
75         #define A7 0x07
76     #endif
77 #elif defined(PROTOCOL_CHIBIOS)
78     #define A0  PAL_LINE(GPIOA, 0)
79     #define A1  PAL_LINE(GPIOA, 1)
80     #define A2  PAL_LINE(GPIOA, 2)
81     #define A3  PAL_LINE(GPIOA, 3)
82     #define A4  PAL_LINE(GPIOA, 4)
83     #define A5  PAL_LINE(GPIOA, 5)
84     #define A6  PAL_LINE(GPIOA, 6)
85     #define A7  PAL_LINE(GPIOA, 7)
86     #define A8  PAL_LINE(GPIOA, 8)
87     #define A9  PAL_LINE(GPIOA, 9)
88     #define A10 PAL_LINE(GPIOA, 10)
89     #define A11 PAL_LINE(GPIOA, 11)
90     #define A12 PAL_LINE(GPIOA, 12)
91     #define A13 PAL_LINE(GPIOA, 13)
92     #define A14 PAL_LINE(GPIOA, 14)
93     #define A15 PAL_LINE(GPIOA, 15)
94     #define B0  PAL_LINE(GPIOB, 0)
95     #define B1  PAL_LINE(GPIOB, 1)
96     #define B2  PAL_LINE(GPIOB, 2)
97     #define B3  PAL_LINE(GPIOB, 3)
98     #define B4  PAL_LINE(GPIOB, 4)
99     #define B5  PAL_LINE(GPIOB, 5)
100     #define B6  PAL_LINE(GPIOB, 6)
101     #define B7  PAL_LINE(GPIOB, 7)
102     #define B8  PAL_LINE(GPIOB, 8)
103     #define B9  PAL_LINE(GPIOB, 9)
104     #define B10 PAL_LINE(GPIOB, 10)
105     #define B11 PAL_LINE(GPIOB, 11)
106     #define B12 PAL_LINE(GPIOB, 12)
107     #define B13 PAL_LINE(GPIOB, 13)
108     #define B14 PAL_LINE(GPIOB, 14)
109     #define B15 PAL_LINE(GPIOB, 15)
110     #define C0  PAL_LINE(GPIOC, 0)
111     #define C1  PAL_LINE(GPIOC, 1)
112     #define C2  PAL_LINE(GPIOC, 2)
113     #define C3  PAL_LINE(GPIOC, 3)
114     #define C4  PAL_LINE(GPIOC, 4)
115     #define C5  PAL_LINE(GPIOC, 5)
116     #define C6  PAL_LINE(GPIOC, 6)
117     #define C7  PAL_LINE(GPIOC, 7)
118     #define C8  PAL_LINE(GPIOC, 8)
119     #define C9  PAL_LINE(GPIOC, 9)
120     #define C10 PAL_LINE(GPIOC, 10)
121     #define C11 PAL_LINE(GPIOC, 11)
122     #define C12 PAL_LINE(GPIOC, 12)
123     #define C13 PAL_LINE(GPIOC, 13)
124     #define C14 PAL_LINE(GPIOC, 14)
125     #define C15 PAL_LINE(GPIOC, 15)
126     #define D0  PAL_LINE(GPIOD, 0)
127     #define D1  PAL_LINE(GPIOD, 1)
128     #define D2  PAL_LINE(GPIOD, 2)
129     #define D3  PAL_LINE(GPIOD, 3)
130     #define D4  PAL_LINE(GPIOD, 4)
131     #define D5  PAL_LINE(GPIOD, 5)
132     #define D6  PAL_LINE(GPIOD, 6)
133     #define D7  PAL_LINE(GPIOD, 7)
134     #define D8  PAL_LINE(GPIOD, 8)
135     #define D9  PAL_LINE(GPIOD, 9)
136     #define D10 PAL_LINE(GPIOD, 10)
137     #define D11 PAL_LINE(GPIOD, 11)
138     #define D12 PAL_LINE(GPIOD, 12)
139     #define D13 PAL_LINE(GPIOD, 13)
140     #define D14 PAL_LINE(GPIOD, 14)
141     #define D15 PAL_LINE(GPIOD, 15)
142     #define E0  PAL_LINE(GPIOE, 0)
143     #define E1  PAL_LINE(GPIOE, 1)
144     #define E2  PAL_LINE(GPIOE, 2)
145     #define E3  PAL_LINE(GPIOE, 3)
146     #define E4  PAL_LINE(GPIOE, 4)
147     #define E5  PAL_LINE(GPIOE, 5)
148     #define E6  PAL_LINE(GPIOE, 6)
149     #define E7  PAL_LINE(GPIOE, 7)
150     #define E8  PAL_LINE(GPIOE, 8)
151     #define E9  PAL_LINE(GPIOE, 9)
152     #define E10 PAL_LINE(GPIOE, 10)
153     #define E11 PAL_LINE(GPIOE, 11)
154     #define E12 PAL_LINE(GPIOE, 12)
155     #define E13 PAL_LINE(GPIOE, 13)
156     #define E14 PAL_LINE(GPIOE, 14)
157     #define E15 PAL_LINE(GPIOE, 15)
158     #define F0  PAL_LINE(GPIOF, 0)
159     #define F1  PAL_LINE(GPIOF, 1)
160     #define F2  PAL_LINE(GPIOF, 2)
161     #define F3  PAL_LINE(GPIOF, 3)
162     #define F4  PAL_LINE(GPIOF, 4)
163     #define F5  PAL_LINE(GPIOF, 5)
164     #define F6  PAL_LINE(GPIOF, 6)
165     #define F7  PAL_LINE(GPIOF, 7)
166     #define F8  PAL_LINE(GPIOF, 8)
167     #define F9  PAL_LINE(GPIOF, 9)
168     #define F10 PAL_LINE(GPIOF, 10)
169     #define F11 PAL_LINE(GPIOF, 11)
170     #define F12 PAL_LINE(GPIOF, 12)
171     #define F13 PAL_LINE(GPIOF, 13)
172     #define F14 PAL_LINE(GPIOF, 14)
173     #define F15 PAL_LINE(GPIOF, 15)
174 #endif
175
176 /* USART configuration */
177 #ifdef BLUETOOTH_ENABLE
178 #   ifdef __AVR_ATmega32U4__
179 #      define SERIAL_UART_BAUD 9600
180 #      define SERIAL_UART_DATA UDR1
181 #      define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
182 #      define SERIAL_UART_RXD_VECT USART1_RX_vect
183 #      define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
184 #      define SERIAL_UART_INIT() do { \
185             /* baud rate */ \
186             UBRR1L = SERIAL_UART_UBRR; \
187             /* baud rate */ \
188             UBRR1H = SERIAL_UART_UBRR >> 8; \
189             /* enable TX */ \
190             UCSR1B = _BV(TXEN1); \
191             /* 8-bit data */ \
192             UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
193             sei(); \
194         } while(0)
195 #   else
196 #       error "USART configuration is needed."
197 #   endif
198 #endif
199
200 #define API_SYSEX_MAX_SIZE 32
201
202 #include "song_list.h"
203
204 #endif