diff options
author | Jack Humbert <jack.humb@gmail.com> | 2017-07-10 11:18:47 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-10 11:18:47 -0400 |
commit | 42d5a324eb673b2214a87c8911d850105c3bdaab (patch) | |
tree | c14aca23eb74164d5cd7e69f50e6d347b3ace51a | |
parent | 8d190d5e25b3374156264fde0ba5d78696cc74aa (diff) | |
download | qmk_firmware-42d5a324eb673b2214a87c8911d850105c3bdaab.tar.gz qmk_firmware-42d5a324eb673b2214a87c8911d850105c3bdaab.zip |
Start mvoing hardware drivers to /drivers/ (#1433)
* start driver isolation
* update nyquist and orthodox boards
* update atreus62
* move drivers to avr
* update avr conditional
-rw-r--r-- | common.mk | 6 | ||||
-rw-r--r-- | common_features.mk | 2 | ||||
-rw-r--r-- | drivers/avr/analog.c (renamed from quantum/analog.c) | 0 | ||||
-rw-r--r-- | drivers/avr/analog.h (renamed from quantum/analog.h) | 0 | ||||
-rw-r--r-- | drivers/avr/glcdfont.c (renamed from keyboards/lets_split/common/glcdfont.c) | 0 | ||||
-rw-r--r-- | drivers/avr/pro_micro.h (renamed from keyboards/atreus62/pro_micro.h) | 0 | ||||
-rw-r--r-- | drivers/avr/ssd1306.c (renamed from keyboards/orthodox/ssd1306.c) | 2 | ||||
-rw-r--r-- | drivers/avr/ssd1306.h (renamed from keyboards/lets_split/ssd1306.h) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | drivers/avr/ws2812.c (renamed from quantum/light_ws2812.c) | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | drivers/avr/ws2812.h (renamed from quantum/light_ws2812.h) | 0 | ||||
-rw-r--r-- | keyboards/handwired/promethium/rgbsps.c | 2 | ||||
-rw-r--r-- | keyboards/handwired/promethium/rules.mk | 4 | ||||
-rw-r--r-- | keyboards/lets_split/pro_micro.h | 362 | ||||
-rw-r--r-- | keyboards/lets_split/ssd1306.c | 470 | ||||
-rw-r--r-- | keyboards/nyquist/pro_micro.h | 362 | ||||
-rw-r--r-- | keyboards/orthodox/pro_micro.h | 362 | ||||
-rw-r--r-- | keyboards/orthodox/ssd1306.h | 17 | ||||
-rw-r--r-- | quantum/rgblight.h | 2 | ||||
-rw-r--r-- | tmk_core/avr.mk | 2 |
19 files changed, 13 insertions, 1582 deletions
@@ -9,6 +9,9 @@ LIB_PATH = $(TOP_DIR)/lib | |||
9 | QUANTUM_DIR = quantum | 9 | QUANTUM_DIR = quantum |
10 | QUANTUM_PATH = $(TOP_DIR)/$(QUANTUM_DIR) | 10 | QUANTUM_PATH = $(TOP_DIR)/$(QUANTUM_DIR) |
11 | 11 | ||
12 | DRIVER_DIR = drivers | ||
13 | DRIVER_PATH = $(TOP_DIR)/$(DRIVER_DIR) | ||
14 | |||
12 | BUILD_DIR := $(TOP_DIR)/.build | 15 | BUILD_DIR := $(TOP_DIR)/.build |
13 | 16 | ||
14 | COMMON_VPATH := $(TOP_DIR) | 17 | COMMON_VPATH := $(TOP_DIR) |
@@ -17,4 +20,5 @@ COMMON_VPATH += $(QUANTUM_PATH) | |||
17 | COMMON_VPATH += $(QUANTUM_PATH)/keymap_extras | 20 | COMMON_VPATH += $(QUANTUM_PATH)/keymap_extras |
18 | COMMON_VPATH += $(QUANTUM_PATH)/audio | 21 | COMMON_VPATH += $(QUANTUM_PATH)/audio |
19 | COMMON_VPATH += $(QUANTUM_PATH)/process_keycode | 22 | COMMON_VPATH += $(QUANTUM_PATH)/process_keycode |
20 | COMMON_VPATH += $(QUANTUM_PATH)/api \ No newline at end of file | 23 | COMMON_VPATH += $(QUANTUM_PATH)/api |
24 | COMMON_VPATH += $(DRIVER_PATH) \ No newline at end of file | ||
diff --git a/common_features.mk b/common_features.mk index f5e7af01f..5eb56ccbf 100644 --- a/common_features.mk +++ b/common_features.mk | |||
@@ -87,7 +87,7 @@ endif | |||
87 | 87 | ||
88 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) | 88 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) |
89 | OPT_DEFS += -DRGBLIGHT_ENABLE | 89 | OPT_DEFS += -DRGBLIGHT_ENABLE |
90 | SRC += $(QUANTUM_DIR)/light_ws2812.c | 90 | SRC += ws2812.c |
91 | SRC += $(QUANTUM_DIR)/rgblight.c | 91 | SRC += $(QUANTUM_DIR)/rgblight.c |
92 | CIE1931_CURVE = yes | 92 | CIE1931_CURVE = yes |
93 | LED_BREATHING_TABLE = yes | 93 | LED_BREATHING_TABLE = yes |
diff --git a/quantum/analog.c b/drivers/avr/analog.c index 1ec38df75..1ec38df75 100644 --- a/quantum/analog.c +++ b/drivers/avr/analog.c | |||
diff --git a/quantum/analog.h b/drivers/avr/analog.h index 8d93de7dc..8d93de7dc 100644 --- a/quantum/analog.h +++ b/drivers/avr/analog.h | |||
diff --git a/keyboards/lets_split/common/glcdfont.c b/drivers/avr/glcdfont.c index 6f88bd23a..6f88bd23a 100644 --- a/keyboards/lets_split/common/glcdfont.c +++ b/drivers/avr/glcdfont.c | |||
diff --git a/keyboards/atreus62/pro_micro.h b/drivers/avr/pro_micro.h index f9e7ed75d..f9e7ed75d 100644 --- a/keyboards/atreus62/pro_micro.h +++ b/drivers/avr/pro_micro.h | |||
diff --git a/keyboards/orthodox/ssd1306.c b/drivers/avr/ssd1306.c index 5c6dff27f..f9312d2dc 100644 --- a/keyboards/orthodox/ssd1306.c +++ b/drivers/avr/ssd1306.c | |||
@@ -6,7 +6,7 @@ | |||
6 | #include <string.h> | 6 | #include <string.h> |
7 | #include "print.h" | 7 | #include "print.h" |
8 | #include "lets_split.h" | 8 | #include "lets_split.h" |
9 | #include "common/glcdfont.c" | 9 | #include "glcdfont.c" |
10 | #ifdef ADAFRUIT_BLE_ENABLE | 10 | #ifdef ADAFRUIT_BLE_ENABLE |
11 | #include "adafruit_ble.h" | 11 | #include "adafruit_ble.h" |
12 | #endif | 12 | #endif |
diff --git a/keyboards/lets_split/ssd1306.h b/drivers/avr/ssd1306.h index b0c74f987..b0c74f987 100644 --- a/keyboards/lets_split/ssd1306.h +++ b/drivers/avr/ssd1306.h | |||
diff --git a/quantum/light_ws2812.c b/drivers/avr/ws2812.c index 2506e3d8e..59e032bf7 100755..100644 --- a/quantum/light_ws2812.c +++ b/drivers/avr/ws2812.c | |||
@@ -21,7 +21,7 @@ | |||
21 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 21 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include "light_ws2812.h" | 24 | #include "ws2812.h" |
25 | #include <avr/interrupt.h> | 25 | #include <avr/interrupt.h> |
26 | #include <avr/io.h> | 26 | #include <avr/io.h> |
27 | #include <util/delay.h> | 27 | #include <util/delay.h> |
diff --git a/quantum/light_ws2812.h b/drivers/avr/ws2812.h index 60924a0fb..60924a0fb 100755..100644 --- a/quantum/light_ws2812.h +++ b/drivers/avr/ws2812.h | |||
diff --git a/keyboards/handwired/promethium/rgbsps.c b/keyboards/handwired/promethium/rgbsps.c index f30badd35..84fac1ae1 100644 --- a/keyboards/handwired/promethium/rgbsps.c +++ b/keyboards/handwired/promethium/rgbsps.c | |||
@@ -1,4 +1,4 @@ | |||
1 | #include "light_ws2812.h" | 1 | #include "ws2812.h" |
2 | #include "rgbsps.h" | 2 | #include "rgbsps.h" |
3 | 3 | ||
4 | struct cRGB led[RGBSPS_NUM]; | 4 | struct cRGB led[RGBSPS_NUM]; |
diff --git a/keyboards/handwired/promethium/rules.mk b/keyboards/handwired/promethium/rules.mk index 6fa45b42b..69903dceb 100644 --- a/keyboards/handwired/promethium/rules.mk +++ b/keyboards/handwired/promethium/rules.mk | |||
@@ -72,7 +72,7 @@ BLUETOOTH = AdafruitBLE | |||
72 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | 72 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE |
73 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | 73 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend |
74 | 74 | ||
75 | SRC += $(QUANTUM_DIR)/light_ws2812.c | 75 | SRC += ws2812.c |
76 | SRC += rgbsps.c | 76 | SRC += rgbsps.c |
77 | SRC += $(QUANTUM_DIR)/analog.c | 77 | SRC += analog.c |
78 | SRC += matrix.c | 78 | SRC += matrix.c |
diff --git a/keyboards/lets_split/pro_micro.h b/keyboards/lets_split/pro_micro.h deleted file mode 100644 index f9e7ed75d..000000000 --- a/keyboards/lets_split/pro_micro.h +++ /dev/null | |||
@@ -1,362 +0,0 @@ | |||
1 | /* | ||
2 | pins_arduino.h - Pin definition functions for Arduino | ||
3 | Part of Arduino - http://www.arduino.cc/ | ||
4 | |||
5 | Copyright (c) 2007 David A. Mellis | ||
6 | |||
7 | This library is free software; you can redistribute it and/or | ||
8 | modify it under the terms of the GNU Lesser General Public | ||
9 | License as published by the Free Software Foundation; either | ||
10 | version 2.1 of the License, or (at your option) any later version. | ||
11 | |||
12 | This library is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | Lesser General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU Lesser General | ||
18 | Public License along with this library; if not, write to the | ||
19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, | ||
20 | Boston, MA 02111-1307 USA | ||
21 | |||
22 | $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ | ||
23 | */ | ||
24 | |||
25 | #ifndef Pins_Arduino_h | ||
26 | #define Pins_Arduino_h | ||
27 | |||
28 | #include <avr/pgmspace.h> | ||
29 | |||
30 | // Workaround for wrong definitions in "iom32u4.h". | ||
31 | // This should be fixed in the AVR toolchain. | ||
32 | #undef UHCON | ||
33 | #undef UHINT | ||
34 | #undef UHIEN | ||
35 | #undef UHADDR | ||
36 | #undef UHFNUM | ||
37 | #undef UHFNUML | ||
38 | #undef UHFNUMH | ||
39 | #undef UHFLEN | ||
40 | #undef UPINRQX | ||
41 | #undef UPINTX | ||
42 | #undef UPNUM | ||
43 | #undef UPRST | ||
44 | #undef UPCONX | ||
45 | #undef UPCFG0X | ||
46 | #undef UPCFG1X | ||
47 | #undef UPSTAX | ||
48 | #undef UPCFG2X | ||
49 | #undef UPIENX | ||
50 | #undef UPDATX | ||
51 | #undef TCCR2A | ||
52 | #undef WGM20 | ||
53 | #undef WGM21 | ||
54 | #undef COM2B0 | ||
55 | #undef COM2B1 | ||
56 | #undef COM2A0 | ||
57 | #undef COM2A1 | ||
58 | #undef TCCR2B | ||
59 | #undef CS20 | ||
60 | #undef CS21 | ||
61 | #undef CS22 | ||
62 | #undef WGM22 | ||
63 | #undef FOC2B | ||
64 | #undef FOC2A | ||
65 | #undef TCNT2 | ||
66 | #undef TCNT2_0 | ||
67 | #undef TCNT2_1 | ||
68 | #undef TCNT2_2 | ||
69 | #undef TCNT2_3 | ||
70 | #undef TCNT2_4 | ||
71 | #undef TCNT2_5 | ||
72 | #undef TCNT2_6 | ||
73 | #undef TCNT2_7 | ||
74 | #undef OCR2A | ||
75 | #undef OCR2_0 | ||
76 | #undef OCR2_1 | ||
77 | #undef OCR2_2 | ||
78 | #undef OCR2_3 | ||
79 | #undef OCR2_4 | ||
80 | #undef OCR2_5 | ||
81 | #undef OCR2_6 | ||
82 | #undef OCR2_7 | ||
83 | #undef OCR2B | ||
84 | #undef OCR2_0 | ||
85 | #undef OCR2_1 | ||
86 | #undef OCR2_2 | ||
87 | #undef OCR2_3 | ||
88 | #undef OCR2_4 | ||
89 | #undef OCR2_5 | ||
90 | #undef OCR2_6 | ||
91 | #undef OCR2_7 | ||
92 | |||
93 | #define NUM_DIGITAL_PINS 30 | ||
94 | #define NUM_ANALOG_INPUTS 12 | ||
95 | |||
96 | #define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) | ||
97 | #define TXLED0 PORTD |= (1<<5) | ||
98 | #define TXLED1 PORTD &= ~(1<<5) | ||
99 | #define RXLED0 PORTB |= (1<<0) | ||
100 | #define RXLED1 PORTB &= ~(1<<0) | ||
101 | |||
102 | static const uint8_t SDA = 2; | ||
103 | static const uint8_t SCL = 3; | ||
104 | #define LED_BUILTIN 13 | ||
105 | |||
106 | // Map SPI port to 'new' pins D14..D17 | ||
107 | static const uint8_t SS = 17; | ||
108 | static const uint8_t MOSI = 16; | ||
109 | static const uint8_t MISO = 14; | ||
110 | static const uint8_t SCK = 15; | ||
111 | |||
112 | // Mapping of analog pins as digital I/O | ||
113 | // A6-A11 share with digital pins | ||
114 | static const uint8_t ADC0 = 18; | ||
115 | static const uint8_t ADC1 = 19; | ||
116 | static const uint8_t ADC2 = 20; | ||
117 | static const uint8_t ADC3 = 21; | ||
118 | static const uint8_t ADC4 = 22; | ||
119 | static const uint8_t ADC5 = 23; | ||
120 | static const uint8_t ADC6 = 24; // D4 | ||
121 | static const uint8_t ADC7 = 25; // D6 | ||
122 | static const uint8_t ADC8 = 26; // D8 | ||
123 | static const uint8_t ADC9 = 27; // D9 | ||
124 | static const uint8_t ADC10 = 28; // D10 | ||
125 | static const uint8_t ADC11 = 29; // D12 | ||
126 | |||
127 | #define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0)) | ||
128 | #define digitalPinToPCICRbit(p) 0 | ||
129 | #define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0)) | ||
130 | #define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4)))))) | ||
131 | |||
132 | // __AVR_ATmega32U4__ has an unusual mapping of pins to channels | ||
133 | extern const uint8_t PROGMEM analog_pin_to_channel_PGM[]; | ||
134 | #define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) ) | ||
135 | |||
136 | #define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT))))) | ||
137 | |||
138 | #ifdef ARDUINO_MAIN | ||
139 | |||
140 | // On the Arduino board, digital pins are also used | ||
141 | // for the analog output (software PWM). Analog input | ||
142 | // pins are a separate set. | ||
143 | |||
144 | // ATMEL ATMEGA32U4 / ARDUINO LEONARDO | ||
145 | // | ||
146 | // D0 PD2 RXD1/INT2 | ||
147 | // D1 PD3 TXD1/INT3 | ||
148 | // D2 PD1 SDA SDA/INT1 | ||
149 | // D3# PD0 PWM8/SCL OC0B/SCL/INT0 | ||
150 | // D4 A6 PD4 ADC8 | ||
151 | // D5# PC6 ??? OC3A/#OC4A | ||
152 | // D6# A7 PD7 FastPWM #OC4D/ADC10 | ||
153 | // D7 PE6 INT6/AIN0 | ||
154 | // | ||
155 | // D8 A8 PB4 ADC11/PCINT4 | ||
156 | // D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5 | ||
157 | // D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6 | ||
158 | // D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7 | ||
159 | // D12 A11 PD6 T1/#OC4D/ADC9 | ||
160 | // D13# PC7 PWM10 CLK0/OC4A | ||
161 | // | ||
162 | // A0 D18 PF7 ADC7 | ||
163 | // A1 D19 PF6 ADC6 | ||
164 | // A2 D20 PF5 ADC5 | ||
165 | // A3 D21 PF4 ADC4 | ||
166 | // A4 D22 PF1 ADC1 | ||
167 | // A5 D23 PF0 ADC0 | ||
168 | // | ||
169 | // New pins D14..D17 to map SPI port to digital pins | ||
170 | // | ||
171 | // MISO D14 PB3 MISO,PCINT3 | ||
172 | // SCK D15 PB1 SCK,PCINT1 | ||
173 | // MOSI D16 PB2 MOSI,PCINT2 | ||
174 | // SS D17 PB0 RXLED,SS/PCINT0 | ||
175 | // | ||
176 | // Connected LEDs on board for TX and RX | ||
177 | // TXLED D24 PD5 XCK1 | ||
178 | // RXLED D17 PB0 | ||
179 | // HWB PE2 HWB | ||
180 | |||
181 | // these arrays map port names (e.g. port B) to the | ||
182 | // appropriate addresses for various functions (e.g. reading | ||
183 | // and writing) | ||
184 | const uint16_t PROGMEM port_to_mode_PGM[] = { | ||
185 | NOT_A_PORT, | ||
186 | NOT_A_PORT, | ||
187 | (uint16_t) &DDRB, | ||
188 | (uint16_t) &DDRC, | ||
189 | (uint16_t) &DDRD, | ||
190 | (uint16_t) &DDRE, | ||
191 | (uint16_t) &DDRF, | ||
192 | }; | ||
193 | |||
194 | const uint16_t PROGMEM port_to_output_PGM[] = { | ||
195 | NOT_A_PORT, | ||
196 | NOT_A_PORT, | ||
197 | (uint16_t) &PORTB, | ||
198 | (uint16_t) &PORTC, | ||
199 | (uint16_t) &PORTD, | ||
200 | (uint16_t) &PORTE, | ||
201 | (uint16_t) &PORTF, | ||
202 | }; | ||
203 | |||
204 | const uint16_t PROGMEM port_to_input_PGM[] = { | ||
205 | NOT_A_PORT, | ||
206 | NOT_A_PORT, | ||
207 | (uint16_t) &PINB, | ||
208 | (uint16_t) &PINC, | ||
209 | (uint16_t) &PIND, | ||
210 | (uint16_t) &PINE, | ||
211 | (uint16_t) &PINF, | ||
212 | }; | ||
213 | |||
214 | const uint8_t PROGMEM digital_pin_to_port_PGM[] = { | ||
215 | PD, // D0 - PD2 | ||
216 | PD, // D1 - PD3 | ||
217 | PD, // D2 - PD1 | ||
218 | PD, // D3 - PD0 | ||
219 | PD, // D4 - PD4 | ||
220 | PC, // D5 - PC6 | ||
221 | PD, // D6 - PD7 | ||
222 | PE, // D7 - PE6 | ||
223 | |||
224 | PB, // D8 - PB4 | ||
225 | PB, // D9 - PB5 | ||
226 | PB, // D10 - PB6 | ||
227 | PB, // D11 - PB7 | ||
228 | PD, // D12 - PD6 | ||
229 | PC, // D13 - PC7 | ||
230 | |||
231 | PB, // D14 - MISO - PB3 | ||
232 | PB, // D15 - SCK - PB1 | ||
233 | PB, // D16 - MOSI - PB2 | ||
234 | PB, // D17 - SS - PB0 | ||
235 | |||
236 | PF, // D18 - A0 - PF7 | ||
237 | PF, // D19 - A1 - PF6 | ||
238 | PF, // D20 - A2 - PF5 | ||
239 | PF, // D21 - A3 - PF4 | ||
240 | PF, // D22 - A4 - PF1 | ||
241 | PF, // D23 - A5 - PF0 | ||
242 | |||
243 | PD, // D24 - PD5 | ||
244 | PD, // D25 / D6 - A7 - PD7 | ||
245 | PB, // D26 / D8 - A8 - PB4 | ||
246 | PB, // D27 / D9 - A9 - PB5 | ||
247 | PB, // D28 / D10 - A10 - PB6 | ||
248 | PD, // D29 / D12 - A11 - PD6 | ||
249 | }; | ||
250 | |||
251 | const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { | ||
252 | _BV(2), // D0 - PD2 | ||
253 | _BV(3), // D1 - PD3 | ||
254 | _BV(1), // D2 - PD1 | ||
255 | _BV(0), // D3 - PD0 | ||
256 | _BV(4), // D4 - PD4 | ||
257 | _BV(6), // D5 - PC6 | ||
258 | _BV(7), // D6 - PD7 | ||
259 | _BV(6), // D7 - PE6 | ||
260 | |||
261 | _BV(4), // D8 - PB4 | ||
262 | _BV(5), // D9 - PB5 | ||
263 | _BV(6), // D10 - PB6 | ||
264 | _BV(7), // D11 - PB7 | ||
265 | _BV(6), // D12 - PD6 | ||
266 | _BV(7), // D13 - PC7 | ||
267 | |||
268 | _BV(3), // D14 - MISO - PB3 | ||
269 | _BV(1), // D15 - SCK - PB1 | ||
270 | _BV(2), // D16 - MOSI - PB2 | ||
271 | _BV(0), // D17 - SS - PB0 | ||
272 | |||
273 | _BV(7), // D18 - A0 - PF7 | ||
274 | _BV(6), // D19 - A1 - PF6 | ||
275 | _BV(5), // D20 - A2 - PF5 | ||
276 | _BV(4), // D21 - A3 - PF4 | ||
277 | _BV(1), // D22 - A4 - PF1 | ||
278 | _BV(0), // D23 - A5 - PF0 | ||
279 | |||
280 | _BV(5), // D24 - PD5 | ||
281 | _BV(7), // D25 / D6 - A7 - PD7 | ||
282 | _BV(4), // D26 / D8 - A8 - PB4 | ||
283 | _BV(5), // D27 / D9 - A9 - PB5 | ||
284 | _BV(6), // D28 / D10 - A10 - PB6 | ||
285 | _BV(6), // D29 / D12 - A11 - PD6 | ||
286 | }; | ||
287 | |||
288 | const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { | ||
289 | NOT_ON_TIMER, | ||
290 | NOT_ON_TIMER, | ||
291 | NOT_ON_TIMER, | ||
292 | TIMER0B, /* 3 */ | ||
293 | NOT_ON_TIMER, | ||
294 | TIMER3A, /* 5 */ | ||
295 | TIMER4D, /* 6 */ | ||
296 | NOT_ON_TIMER, | ||
297 | |||
298 | NOT_ON_TIMER, | ||
299 | TIMER1A, /* 9 */ | ||
300 | TIMER1B, /* 10 */ | ||
301 | TIMER0A, /* 11 */ | ||
302 | |||
303 | NOT_ON_TIMER, | ||
304 | TIMER4A, /* 13 */ | ||
305 | |||
306 | NOT_ON_TIMER, | ||
307 | NOT_ON_TIMER, | ||
308 | NOT_ON_TIMER, | ||
309 | NOT_ON_TIMER, | ||
310 | NOT_ON_TIMER, | ||
311 | NOT_ON_TIMER, | ||
312 | |||
313 | NOT_ON_TIMER, | ||
314 | NOT_ON_TIMER, | ||
315 | NOT_ON_TIMER, | ||
316 | NOT_ON_TIMER, | ||
317 | NOT_ON_TIMER, | ||
318 | NOT_ON_TIMER, | ||
319 | NOT_ON_TIMER, | ||
320 | NOT_ON_TIMER, | ||
321 | NOT_ON_TIMER, | ||
322 | NOT_ON_TIMER, | ||
323 | }; | ||
324 | |||
325 | const uint8_t PROGMEM analog_pin_to_channel_PGM[] = { | ||
326 | 7, // A0 PF7 ADC7 | ||
327 | 6, // A1 PF6 ADC6 | ||
328 | 5, // A2 PF5 ADC5 | ||
329 | 4, // A3 PF4 ADC4 | ||
330 | 1, // A4 PF1 ADC1 | ||
331 | 0, // A5 PF0 ADC0 | ||
332 | 8, // A6 D4 PD4 ADC8 | ||
333 | 10, // A7 D6 PD7 ADC10 | ||
334 | 11, // A8 D8 PB4 ADC11 | ||
335 | 12, // A9 D9 PB5 ADC12 | ||
336 | 13, // A10 D10 PB6 ADC13 | ||
337 | 9 // A11 D12 PD6 ADC9 | ||
338 | }; | ||
339 | |||
340 | #endif /* ARDUINO_MAIN */ | ||
341 | |||
342 | // These serial port names are intended to allow libraries and architecture-neutral | ||
343 | // sketches to automatically default to the correct port name for a particular type | ||
344 | // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, | ||
345 | // the first hardware serial port whose RX/TX pins are not dedicated to another use. | ||
346 | // | ||
347 | // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor | ||
348 | // | ||
349 | // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial | ||
350 | // | ||
351 | // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library | ||
352 | // | ||
353 | // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. | ||
354 | // | ||
355 | // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX | ||
356 | // pins are NOT connected to anything by default. | ||
357 | #define SERIAL_PORT_MONITOR Serial | ||
358 | #define SERIAL_PORT_USBVIRTUAL Serial | ||
359 | #define SERIAL_PORT_HARDWARE Serial1 | ||
360 | #define SERIAL_PORT_HARDWARE_OPEN Serial1 | ||
361 | |||
362 | #endif /* Pins_Arduino_h */ | ||
diff --git a/keyboards/lets_split/ssd1306.c b/keyboards/lets_split/ssd1306.c deleted file mode 100644 index 5c6dff27f..000000000 --- a/keyboards/lets_split/ssd1306.c +++ /dev/null | |||
@@ -1,470 +0,0 @@ | |||
1 | #ifdef SSD1306OLED | ||
2 | |||
3 | #include "ssd1306.h" | ||
4 | #include "config.h" | ||
5 | #include "i2c.h" | ||
6 | #include <string.h> | ||
7 | #include "print.h" | ||
8 | #include "lets_split.h" | ||
9 | #include "common/glcdfont.c" | ||
10 | #ifdef ADAFRUIT_BLE_ENABLE | ||
11 | #include "adafruit_ble.h" | ||
12 | #endif | ||
13 | #ifdef PROTOCOL_LUFA | ||
14 | #include "lufa.h" | ||
15 | #endif | ||
16 | #include "sendchar.h" | ||
17 | #include "pincontrol.h" | ||
18 | |||
19 | //assign the right code to your layers | ||
20 | #define _BASE 0 | ||
21 | #define _LOWER 8 | ||
22 | #define _RAISE 16 | ||
23 | #define _FNLAYER 64 | ||
24 | #define _NUMLAY 128 | ||
25 | #define _NLOWER 136 | ||
26 | #define _NFNLAYER 192 | ||
27 | #define _MOUSECURSOR 256 | ||
28 | #define _ADJUST 65560 | ||
29 | |||
30 | // Set this to 1 to help diagnose early startup problems | ||
31 | // when testing power-on with ble. Turn it off otherwise, | ||
32 | // as the latency of printing most of the debug info messes | ||
33 | // with the matrix scan, causing keys to drop. | ||
34 | #define DEBUG_TO_SCREEN 0 | ||
35 | |||
36 | // Controls the SSD1306 128x32 OLED display via i2c | ||
37 | |||
38 | #define i2cAddress 0x3C | ||
39 | |||
40 | #define DisplayHeight 32 | ||
41 | #define DisplayWidth 128 | ||
42 | |||
43 | #define FontHeight 8 | ||
44 | #define FontWidth 6 | ||
45 | |||
46 | #define MatrixRows (DisplayHeight / FontHeight) | ||
47 | #define MatrixCols (DisplayWidth / FontWidth) | ||
48 | |||
49 | struct CharacterMatrix { | ||
50 | uint8_t display[MatrixRows][MatrixCols]; | ||
51 | uint8_t *cursor; | ||
52 | bool dirty; | ||
53 | }; | ||
54 | |||
55 | static struct CharacterMatrix display; | ||
56 | //static uint16_t last_battery_update; | ||
57 | //static uint32_t vbat; | ||
58 | //#define BatteryUpdateInterval 10000 /* milliseconds */ | ||
59 | #define ScreenOffInterval 300000 /* milliseconds */ | ||
60 | #if DEBUG_TO_SCREEN | ||
61 | static uint8_t displaying; | ||
62 | #endif | ||
63 | static uint16_t last_flush; | ||
64 | |||
65 | enum ssd1306_cmds { | ||
66 | DisplayOff = 0xAE, | ||
67 | DisplayOn = 0xAF, | ||
68 | |||
69 | SetContrast = 0x81, | ||
70 | DisplayAllOnResume = 0xA4, | ||
71 | |||
72 | DisplayAllOn = 0xA5, | ||
73 | NormalDisplay = 0xA6, | ||
74 | InvertDisplay = 0xA7, | ||
75 | SetDisplayOffset = 0xD3, | ||
76 | SetComPins = 0xda, | ||
77 | SetVComDetect = 0xdb, | ||
78 | SetDisplayClockDiv = 0xD5, | ||
79 | SetPreCharge = 0xd9, | ||
80 | SetMultiPlex = 0xa8, | ||
81 | SetLowColumn = 0x00, | ||
82 | SetHighColumn = 0x10, | ||
83 | SetStartLine = 0x40, | ||
84 | |||
85 | SetMemoryMode = 0x20, | ||
86 | ColumnAddr = 0x21, | ||
87 | PageAddr = 0x22, | ||
88 | |||
89 | ComScanInc = 0xc0, | ||
90 | ComScanDec = 0xc8, | ||
91 | SegRemap = 0xa0, | ||
92 | SetChargePump = 0x8d, | ||
93 | ExternalVcc = 0x01, | ||
94 | SwitchCapVcc = 0x02, | ||
95 | |||
96 | ActivateScroll = 0x2f, | ||
97 | DeActivateScroll = 0x2e, | ||
98 | SetVerticalScrollArea = 0xa3, | ||
99 | RightHorizontalScroll = 0x26, | ||
100 | LeftHorizontalScroll = 0x27, | ||
101 | VerticalAndRightHorizontalScroll = 0x29, | ||
102 | VerticalAndLeftHorizontalScroll = 0x2a, | ||
103 | }; | ||
104 | |||
105 | |||
106 | // Write command sequence. | ||
107 | // Returns true on success. | ||
108 | static inline bool _send_cmd1(uint8_t cmd) { | ||
109 | bool res = false; | ||
110 | |||
111 | if (i2c_start_write(i2cAddress)) { | ||
112 | xprintf("failed to start write to %d\n", i2cAddress); | ||
113 | goto done; | ||
114 | } | ||
115 | |||
116 | if (i2c_master_write(0x0 /* command byte follows */)) { | ||
117 | print("failed to write control byte\n"); | ||
118 | |||
119 | goto done; | ||
120 | } | ||
121 | |||
122 | if (i2c_master_write(cmd)) { | ||
123 | xprintf("failed to write command %d\n", cmd); | ||
124 | goto done; | ||
125 | } | ||
126 | res = true; | ||
127 | done: | ||
128 | i2c_master_stop(); | ||
129 | return res; | ||
130 | } | ||
131 | |||
132 | // Write 2-byte command sequence. | ||
133 | // Returns true on success | ||
134 | static inline bool _send_cmd2(uint8_t cmd, uint8_t opr) { | ||
135 | if (!_send_cmd1(cmd)) { | ||
136 | return false; | ||
137 | } | ||
138 | return _send_cmd1(opr); | ||
139 | } | ||
140 | |||
141 | // Write 3-byte command sequence. | ||
142 | // Returns true on success | ||
143 | static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) { | ||
144 | if (!_send_cmd1(cmd)) { | ||
145 | return false; | ||
146 | } | ||
147 | if (!_send_cmd1(opr1)) { | ||
148 | return false; | ||
149 | } | ||
150 | return _send_cmd1(opr2); | ||
151 | } | ||
152 | |||
153 | #define send_cmd1(c) if (!_send_cmd1(c)) {goto done;} | ||
154 | #define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;} | ||
155 | #define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;} | ||
156 | |||
157 | static void matrix_clear(struct CharacterMatrix *matrix); | ||
158 | |||
159 | static void clear_display(void) { | ||
160 | matrix_clear(&display); | ||
161 | |||
162 | // Clear all of the display bits (there can be random noise | ||
163 | // in the RAM on startup) | ||
164 | send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1); | ||
165 | send_cmd3(ColumnAddr, 0, DisplayWidth - 1); | ||
166 | |||
167 | if (i2c_start_write(i2cAddress)) { | ||
168 | goto done; | ||
169 | } | ||
170 | if (i2c_master_write(0x40)) { | ||
171 | // Data mode | ||
172 | goto done; | ||
173 | } | ||
174 | for (uint8_t row = 0; row < MatrixRows; ++row) { | ||
175 | for (uint8_t col = 0; col < DisplayWidth; ++col) { | ||
176 | i2c_master_write(0); | ||
177 | } | ||
178 | } | ||
179 | |||
180 | display.dirty = false; | ||
181 | |||
182 | done: | ||
183 | i2c_master_stop(); | ||
184 | } | ||
185 | |||
186 | #if DEBUG_TO_SCREEN | ||
187 | #undef sendchar | ||
188 | static int8_t capture_sendchar(uint8_t c) { | ||
189 | sendchar(c); | ||
190 | iota_gfx_write_char(c); | ||
191 | |||
192 | if (!displaying) { | ||
193 | iota_gfx_flush(); | ||
194 | } | ||
195 | return 0; | ||
196 | } | ||
197 | #endif | ||
198 | |||
199 | bool iota_gfx_init(void) { | ||
200 | bool success = false; | ||
201 | |||
202 | send_cmd1(DisplayOff); | ||
203 | send_cmd2(SetDisplayClockDiv, 0x80); | ||
204 | send_cmd2(SetMultiPlex, DisplayHeight - 1); | ||
205 | |||
206 | send_cmd2(SetDisplayOffset, 0); | ||
207 | |||
208 | |||
209 | send_cmd1(SetStartLine | 0x0); | ||
210 | send_cmd2(SetChargePump, 0x14 /* Enable */); | ||
211 | send_cmd2(SetMemoryMode, 0 /* horizontal addressing */); | ||
212 | |||
213 | /// Flips the display orientation 0 degrees | ||
214 | send_cmd1(SegRemap | 0x1); | ||
215 | send_cmd1(ComScanDec); | ||
216 | /* | ||
217 | // the following Flip the display orientation 180 degrees | ||
218 | send_cmd1(SegRemap); | ||
219 | send_cmd1(ComScanInc); | ||
220 | // end flip */ | ||
221 | send_cmd2(SetComPins, 0x2); | ||
222 | send_cmd2(SetContrast, 0x8f); | ||
223 | send_cmd2(SetPreCharge, 0xf1); | ||
224 | send_cmd2(SetVComDetect, 0x40); | ||
225 | send_cmd1(DisplayAllOnResume); | ||
226 | send_cmd1(NormalDisplay); | ||
227 | send_cmd1(DeActivateScroll); | ||
228 | send_cmd1(DisplayOn); | ||
229 | |||
230 | send_cmd2(SetContrast, 0); // Dim | ||
231 | |||
232 | clear_display(); | ||
233 | |||
234 | success = true; | ||
235 | |||
236 | iota_gfx_flush(); | ||
237 | |||
238 | #if DEBUG_TO_SCREEN | ||
239 | print_set_sendchar(capture_sendchar); | ||
240 | #endif | ||
241 | |||
242 | done: | ||
243 | return success; | ||
244 | } | ||
245 | |||
246 | bool iota_gfx_off(void) { | ||
247 | bool success = false; | ||
248 | |||
249 | send_cmd1(DisplayOff); | ||
250 | success = true; | ||
251 | |||
252 | done: | ||
253 | return success; | ||
254 | } | ||
255 | |||
256 | bool iota_gfx_on(void) { | ||
257 | bool success = false; | ||
258 | |||
259 | send_cmd1(DisplayOn); | ||
260 | success = true; | ||
261 | |||
262 | done: | ||
263 | return success; | ||
264 | } | ||
265 | |||
266 | static void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { | ||
267 | *matrix->cursor = c; | ||
268 | ++matrix->cursor; | ||
269 | |||
270 | if (matrix->cursor - &matrix->display[0][0] == sizeof(matrix->display)) { | ||
271 | // We went off the end; scroll the display upwards by one line | ||
272 | memmove(&matrix->display[0], &matrix->display[1], | ||
273 | MatrixCols * (MatrixRows - 1)); | ||
274 | matrix->cursor = &matrix->display[MatrixRows - 1][0]; | ||
275 | memset(matrix->cursor, ' ', MatrixCols); | ||
276 | } | ||
277 | } | ||
278 | |||
279 | static void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) { | ||
280 | matrix->dirty = true; | ||
281 | |||
282 | if (c == '\n') { | ||
283 | // Clear to end of line from the cursor and then move to the | ||
284 | // start of the next line | ||
285 | uint8_t cursor_col = (matrix->cursor - &matrix->display[0][0]) % MatrixCols; | ||
286 | |||
287 | while (cursor_col++ < MatrixCols) { | ||
288 | matrix_write_char_inner(matrix, ' '); | ||
289 | } | ||
290 | return; | ||
291 | } | ||
292 | |||
293 | matrix_write_char_inner(matrix, c); | ||
294 | } | ||
295 | |||
296 | void iota_gfx_write_char(uint8_t c) { | ||
297 | matrix_write_char(&display, c); | ||
298 | } | ||
299 | |||
300 | static void matrix_write(struct CharacterMatrix *matrix, const char *data) { | ||
301 | const char *end = data + strlen(data); | ||
302 | while (data < end) { | ||
303 | matrix_write_char(matrix, *data); | ||
304 | ++data; | ||
305 | } | ||
306 | } | ||
307 | |||
308 | void iota_gfx_write(const char *data) { | ||
309 | matrix_write(&display, data); | ||
310 | } | ||
311 | |||
312 | static void matrix_write_P(struct CharacterMatrix *matrix, const char *data) { | ||
313 | while (true) { | ||
314 | uint8_t c = pgm_read_byte(data); | ||
315 | if (c == 0) { | ||
316 | return; | ||
317 | } | ||
318 | matrix_write_char(matrix, c); | ||
319 | ++data; | ||
320 | } | ||
321 | } | ||
322 | |||
323 | void iota_gfx_write_P(const char *data) { | ||
324 | matrix_write_P(&display, data); | ||
325 | } | ||
326 | |||
327 | static void matrix_clear(struct CharacterMatrix *matrix) { | ||
328 | memset(matrix->display, ' ', sizeof(matrix->display)); | ||
329 | matrix->cursor = &matrix->display[0][0]; | ||
330 | matrix->dirty = true; | ||
331 | } | ||
332 | |||
333 | void iota_gfx_clear_screen(void) { | ||
334 | matrix_clear(&display); | ||
335 | } | ||
336 | |||
337 | static void matrix_render(struct CharacterMatrix *matrix) { | ||
338 | last_flush = timer_read(); | ||
339 | iota_gfx_on(); | ||
340 | #if DEBUG_TO_SCREEN | ||
341 | ++displaying; | ||
342 | #endif | ||
343 | |||
344 | // Move to the home position | ||
345 | send_cmd3(PageAddr, 0, MatrixRows - 1); | ||
346 | send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1); | ||
347 | |||
348 | if (i2c_start_write(i2cAddress)) { | ||
349 | goto done; | ||
350 | } | ||
351 | if (i2c_master_write(0x40)) { | ||
352 | // Data mode | ||
353 | goto done; | ||
354 | } | ||
355 | |||
356 | for (uint8_t row = 0; row < MatrixRows; ++row) { | ||
357 | for (uint8_t col = 0; col < MatrixCols; ++col) { | ||
358 | const uint8_t *glyph = font + (matrix->display[row][col] * (FontWidth - 1)); | ||
359 | |||
360 | for (uint8_t glyphCol = 0; glyphCol < FontWidth - 1; ++glyphCol) { | ||
361 | uint8_t colBits = pgm_read_byte(glyph + glyphCol); | ||
362 | i2c_master_write(colBits); | ||
363 | } | ||
364 | |||
365 | // 1 column of space between chars (it's not included in the glyph) | ||
366 | i2c_master_write(0); | ||
367 | } | ||
368 | } | ||
369 | |||
370 | matrix->dirty = false; | ||
371 | |||
372 | done: | ||
373 | i2c_master_stop(); | ||
374 | #if DEBUG_TO_SCREEN | ||
375 | --displaying; | ||
376 | #endif | ||
377 | } | ||
378 | |||
379 | void iota_gfx_flush(void) { | ||
380 | matrix_render(&display); | ||
381 | } | ||
382 | |||
383 | static void matrix_update(struct CharacterMatrix *dest, | ||
384 | const struct CharacterMatrix *source) { | ||
385 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { | ||
386 | memcpy(dest->display, source->display, sizeof(dest->display)); | ||
387 | dest->dirty = true; | ||
388 | } | ||
389 | } | ||
390 | |||
391 | static void render_status_info(void) { | ||
392 | #if DEBUG_TO_SCREEN | ||
393 | if (debug_enable) { | ||
394 | return; | ||
395 | } | ||
396 | #endif | ||
397 | |||
398 | struct CharacterMatrix matrix; | ||
399 | |||
400 | matrix_clear(&matrix); | ||
401 | matrix_write_P(&matrix, PSTR("USB: ")); | ||
402 | #ifdef PROTOCOL_LUFA | ||
403 | switch (USB_DeviceState) { | ||
404 | case DEVICE_STATE_Unattached: | ||
405 | matrix_write_P(&matrix, PSTR("Unattached")); | ||
406 | break; | ||
407 | case DEVICE_STATE_Suspended: | ||
408 | matrix_write_P(&matrix, PSTR("Suspended")); | ||
409 | break; | ||
410 | case DEVICE_STATE_Configured: | ||
411 | matrix_write_P(&matrix, PSTR("Connected")); | ||
412 | break; | ||
413 | case DEVICE_STATE_Powered: | ||
414 | matrix_write_P(&matrix, PSTR("Powered")); | ||
415 | break; | ||
416 | case DEVICE_STATE_Default: | ||
417 | matrix_write_P(&matrix, PSTR("Default")); | ||
418 | break; | ||
419 | case DEVICE_STATE_Addressed: | ||
420 | matrix_write_P(&matrix, PSTR("Addressed")); | ||
421 | break; | ||
422 | default: | ||
423 | matrix_write_P(&matrix, PSTR("Invalid")); | ||
424 | } | ||
425 | #endif | ||
426 | |||
427 | // Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below | ||
428 | |||
429 | char buf[40]; | ||
430 | snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); | ||
431 | matrix_write_P(&matrix, PSTR("\n\nLayer: ")); | ||
432 | switch (layer_state) { | ||
433 | case _BASE: | ||
434 | matrix_write_P(&matrix, PSTR("Default")); | ||
435 | break; | ||
436 | case _RAISE: | ||
437 | matrix_write_P(&matrix, PSTR("Raise")); | ||
438 | break; | ||
439 | case _LOWER: | ||
440 | matrix_write_P(&matrix, PSTR("Lower")); | ||
441 | break; | ||
442 | case _ADJUST: | ||
443 | matrix_write_P(&matrix, PSTR("ADJUST")); | ||
444 | break; | ||
445 | default: | ||
446 | matrix_write(&matrix, buf); | ||
447 | } | ||
448 | |||
449 | // Host Keyboard LED Status | ||
450 | char led[40]; | ||
451 | snprintf(led, sizeof(led), "\n%s %s %s", | ||
452 | (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", | ||
453 | (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", | ||
454 | (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); | ||
455 | matrix_write(&matrix, led); | ||
456 | matrix_update(&display, &matrix); | ||
457 | } | ||
458 | |||
459 | void iota_gfx_task(void) { | ||
460 | render_status_info(); | ||
461 | |||
462 | if (display.dirty) { | ||
463 | iota_gfx_flush(); | ||
464 | } | ||
465 | |||
466 | if (timer_elapsed(last_flush) > ScreenOffInterval) { | ||
467 | iota_gfx_off(); | ||
468 | } | ||
469 | } | ||
470 | #endif | ||
diff --git a/keyboards/nyquist/pro_micro.h b/keyboards/nyquist/pro_micro.h deleted file mode 100644 index f9e7ed75d..000000000 --- a/keyboards/nyquist/pro_micro.h +++ /dev/null | |||
@@ -1,362 +0,0 @@ | |||
1 | /* | ||
2 | pins_arduino.h - Pin definition functions for Arduino | ||
3 | Part of Arduino - http://www.arduino.cc/ | ||
4 | |||
5 | Copyright (c) 2007 David A. Mellis | ||
6 | |||
7 | This library is free software; you can redistribute it and/or | ||
8 | modify it under the terms of the GNU Lesser General Public | ||
9 | License as published by the Free Software Foundation; either | ||
10 | version 2.1 of the License, or (at your option) any later version. | ||
11 | |||
12 | This library is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | Lesser General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU Lesser General | ||
18 | Public License along with this library; if not, write to the | ||
19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, | ||
20 | Boston, MA 02111-1307 USA | ||
21 | |||
22 | $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ | ||
23 | */ | ||
24 | |||
25 | #ifndef Pins_Arduino_h | ||
26 | #define Pins_Arduino_h | ||
27 | |||
28 | #include <avr/pgmspace.h> | ||
29 | |||
30 | // Workaround for wrong definitions in "iom32u4.h". | ||
31 | // This should be fixed in the AVR toolchain. | ||
32 | #undef UHCON | ||
33 | #undef UHINT | ||
34 | #undef UHIEN | ||
35 | #undef UHADDR | ||
36 | #undef UHFNUM | ||
37 | #undef UHFNUML | ||
38 | #undef UHFNUMH | ||
39 | #undef UHFLEN | ||
40 | #undef UPINRQX | ||
41 | #undef UPINTX | ||
42 | #undef UPNUM | ||
43 | #undef UPRST | ||
44 | #undef UPCONX | ||
45 | #undef UPCFG0X | ||
46 | #undef UPCFG1X | ||
47 | #undef UPSTAX | ||
48 | #undef UPCFG2X | ||
49 | #undef UPIENX | ||
50 | #undef UPDATX | ||
51 | #undef TCCR2A | ||
52 | #undef WGM20 | ||
53 | #undef WGM21 | ||
54 | #undef COM2B0 | ||
55 | #undef COM2B1 | ||
56 | #undef COM2A0 | ||
57 | #undef COM2A1 | ||
58 | #undef TCCR2B | ||
59 | #undef CS20 | ||
60 | #undef CS21 | ||
61 | #undef CS22 | ||
62 | #undef WGM22 | ||
63 | #undef FOC2B | ||
64 | #undef FOC2A | ||
65 | #undef TCNT2 | ||
66 | #undef TCNT2_0 | ||
67 | #undef TCNT2_1 | ||
68 | #undef TCNT2_2 | ||
69 | #undef TCNT2_3 | ||
70 | #undef TCNT2_4 | ||
71 | #undef TCNT2_5 | ||
72 | #undef TCNT2_6 | ||
73 | #undef TCNT2_7 | ||
74 | #undef OCR2A | ||
75 | #undef OCR2_0 | ||
76 | #undef OCR2_1 | ||
77 | #undef OCR2_2 | ||
78 | #undef OCR2_3 | ||
79 | #undef OCR2_4 | ||
80 | #undef OCR2_5 | ||
81 | #undef OCR2_6 | ||
82 | #undef OCR2_7 | ||
83 | #undef OCR2B | ||
84 | #undef OCR2_0 | ||
85 | #undef OCR2_1 | ||
86 | #undef OCR2_2 | ||
87 | #undef OCR2_3 | ||
88 | #undef OCR2_4 | ||
89 | #undef OCR2_5 | ||
90 | #undef OCR2_6 | ||
91 | #undef OCR2_7 | ||
92 | |||
93 | #define NUM_DIGITAL_PINS 30 | ||
94 | #define NUM_ANALOG_INPUTS 12 | ||
95 | |||
96 | #define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) | ||
97 | #define TXLED0 PORTD |= (1<<5) | ||
98 | #define TXLED1 PORTD &= ~(1<<5) | ||
99 | #define RXLED0 PORTB |= (1<<0) | ||
100 | #define RXLED1 PORTB &= ~(1<<0) | ||
101 | |||
102 | static const uint8_t SDA = 2; | ||
103 | static const uint8_t SCL = 3; | ||
104 | #define LED_BUILTIN 13 | ||
105 | |||
106 | // Map SPI port to 'new' pins D14..D17 | ||
107 | static const uint8_t SS = 17; | ||
108 | static const uint8_t MOSI = 16; | ||
109 | static const uint8_t MISO = 14; | ||
110 | static const uint8_t SCK = 15; | ||
111 | |||
112 | // Mapping of analog pins as digital I/O | ||
113 | // A6-A11 share with digital pins | ||
114 | static const uint8_t ADC0 = 18; | ||
115 | static const uint8_t ADC1 = 19; | ||
116 | static const uint8_t ADC2 = 20; | ||
117 | static const uint8_t ADC3 = 21; | ||
118 | static const uint8_t ADC4 = 22; | ||
119 | static const uint8_t ADC5 = 23; | ||
120 | static const uint8_t ADC6 = 24; // D4 | ||
121 | static const uint8_t ADC7 = 25; // D6 | ||
122 | static const uint8_t ADC8 = 26; // D8 | ||
123 | static const uint8_t ADC9 = 27; // D9 | ||
124 | static const uint8_t ADC10 = 28; // D10 | ||
125 | static const uint8_t ADC11 = 29; // D12 | ||
126 | |||
127 | #define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0)) | ||
128 | #define digitalPinToPCICRbit(p) 0 | ||
129 | #define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0)) | ||
130 | #define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4)))))) | ||
131 | |||
132 | // __AVR_ATmega32U4__ has an unusual mapping of pins to channels | ||
133 | extern const uint8_t PROGMEM analog_pin_to_channel_PGM[]; | ||
134 | #define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) ) | ||
135 | |||
136 | #define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT))))) | ||
137 | |||
138 | #ifdef ARDUINO_MAIN | ||
139 | |||
140 | // On the Arduino board, digital pins are also used | ||
141 | // for the analog output (software PWM). Analog input | ||
142 | // pins are a separate set. | ||
143 | |||
144 | // ATMEL ATMEGA32U4 / ARDUINO LEONARDO | ||
145 | // | ||
146 | // D0 PD2 RXD1/INT2 | ||
147 | // D1 PD3 TXD1/INT3 | ||
148 | // D2 PD1 SDA SDA/INT1 | ||
149 | // D3# PD0 PWM8/SCL OC0B/SCL/INT0 | ||
150 | // D4 A6 PD4 ADC8 | ||
151 | // D5# PC6 ??? OC3A/#OC4A | ||
152 | // D6# A7 PD7 FastPWM #OC4D/ADC10 | ||
153 | // D7 PE6 INT6/AIN0 | ||
154 | // | ||
155 | // D8 A8 PB4 ADC11/PCINT4 | ||
156 | // D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5 | ||
157 | // D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6 | ||
158 | // D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7 | ||
159 | // D12 A11 PD6 T1/#OC4D/ADC9 | ||
160 | // D13# PC7 PWM10 CLK0/OC4A | ||
161 | // | ||
162 | // A0 D18 PF7 ADC7 | ||
163 | // A1 D19 PF6 ADC6 | ||
164 | // A2 D20 PF5 ADC5 | ||
165 | // A3 D21 PF4 ADC4 | ||
166 | // A4 D22 PF1 ADC1 | ||
167 | // A5 D23 PF0 ADC0 | ||
168 | // | ||
169 | // New pins D14..D17 to map SPI port to digital pins | ||
170 | // | ||
171 | // MISO D14 PB3 MISO,PCINT3 | ||
172 | // SCK D15 PB1 SCK,PCINT1 | ||
173 | // MOSI D16 PB2 MOSI,PCINT2 | ||
174 | // SS D17 PB0 RXLED,SS/PCINT0 | ||
175 | // | ||
176 | // Connected LEDs on board for TX and RX | ||
177 | // TXLED D24 PD5 XCK1 | ||
178 | // RXLED D17 PB0 | ||
179 | // HWB PE2 HWB | ||
180 | |||
181 | // these arrays map port names (e.g. port B) to the | ||
182 | // appropriate addresses for various functions (e.g. reading | ||
183 | // and writing) | ||
184 | const uint16_t PROGMEM port_to_mode_PGM[] = { | ||
185 | NOT_A_PORT, | ||
186 | NOT_A_PORT, | ||
187 | (uint16_t) &DDRB, | ||
188 | (uint16_t) &DDRC, | ||
189 | (uint16_t) &DDRD, | ||
190 | (uint16_t) &DDRE, | ||
191 | (uint16_t) &DDRF, | ||
192 | }; | ||
193 | |||
194 | const uint16_t PROGMEM port_to_output_PGM[] = { | ||
195 | NOT_A_PORT, | ||
196 | NOT_A_PORT, | ||
197 | (uint16_t) &PORTB, | ||
198 | (uint16_t) &PORTC, | ||
199 | (uint16_t) &PORTD, | ||
200 | (uint16_t) &PORTE, | ||
201 | (uint16_t) &PORTF, | ||
202 | }; | ||
203 | |||
204 | const uint16_t PROGMEM port_to_input_PGM[] = { | ||
205 | NOT_A_PORT, | ||
206 | NOT_A_PORT, | ||
207 | (uint16_t) &PINB, | ||
208 | (uint16_t) &PINC, | ||
209 | (uint16_t) &PIND, | ||
210 | (uint16_t) &PINE, | ||
211 | (uint16_t) &PINF, | ||
212 | }; | ||
213 | |||
214 | const uint8_t PROGMEM digital_pin_to_port_PGM[] = { | ||
215 | PD, // D0 - PD2 | ||
216 | PD, // D1 - PD3 | ||
217 | PD, // D2 - PD1 | ||
218 | PD, // D3 - PD0 | ||
219 | PD, // D4 - PD4 | ||
220 | PC, // D5 - PC6 | ||
221 | PD, // D6 - PD7 | ||
222 | PE, // D7 - PE6 | ||
223 | |||
224 | PB, // D8 - PB4 | ||
225 | PB, // D9 - PB5 | ||
226 | PB, // D10 - PB6 | ||
227 | PB, // D11 - PB7 | ||
228 | PD, // D12 - PD6 | ||
229 | PC, // D13 - PC7 | ||
230 | |||
231 | PB, // D14 - MISO - PB3 | ||
232 | PB, // D15 - SCK - PB1 | ||
233 | PB, // D16 - MOSI - PB2 | ||
234 | PB, // D17 - SS - PB0 | ||
235 | |||
236 | PF, // D18 - A0 - PF7 | ||
237 | PF, // D19 - A1 - PF6 | ||
238 | PF, // D20 - A2 - PF5 | ||
239 | PF, // D21 - A3 - PF4 | ||
240 | PF, // D22 - A4 - PF1 | ||
241 | PF, // D23 - A5 - PF0 | ||
242 | |||
243 | PD, // D24 - PD5 | ||
244 | PD, // D25 / D6 - A7 - PD7 | ||
245 | PB, // D26 / D8 - A8 - PB4 | ||
246 | PB, // D27 / D9 - A9 - PB5 | ||
247 | PB, // D28 / D10 - A10 - PB6 | ||
248 | PD, // D29 / D12 - A11 - PD6 | ||
249 | }; | ||
250 | |||
251 | const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { | ||
252 | _BV(2), // D0 - PD2 | ||
253 | _BV(3), // D1 - PD3 | ||
254 | _BV(1), // D2 - PD1 | ||
255 | _BV(0), // D3 - PD0 | ||
256 | _BV(4), // D4 - PD4 | ||
257 | _BV(6), // D5 - PC6 | ||
258 | _BV(7), // D6 - PD7 | ||
259 | _BV(6), // D7 - PE6 | ||
260 | |||
261 | _BV(4), // D8 - PB4 | ||
262 | _BV(5), // D9 - PB5 | ||
263 | _BV(6), // D10 - PB6 | ||
264 | _BV(7), // D11 - PB7 | ||
265 | _BV(6), // D12 - PD6 | ||
266 | _BV(7), // D13 - PC7 | ||
267 | |||
268 | _BV(3), // D14 - MISO - PB3 | ||
269 | _BV(1), // D15 - SCK - PB1 | ||
270 | _BV(2), // D16 - MOSI - PB2 | ||
271 | _BV(0), // D17 - SS - PB0 | ||
272 | |||
273 | _BV(7), // D18 - A0 - PF7 | ||
274 | _BV(6), // D19 - A1 - PF6 | ||
275 | _BV(5), // D20 - A2 - PF5 | ||
276 | _BV(4), // D21 - A3 - PF4 | ||
277 | _BV(1), // D22 - A4 - PF1 | ||
278 | _BV(0), // D23 - A5 - PF0 | ||
279 | |||
280 | _BV(5), // D24 - PD5 | ||
281 | _BV(7), // D25 / D6 - A7 - PD7 | ||
282 | _BV(4), // D26 / D8 - A8 - PB4 | ||
283 | _BV(5), // D27 / D9 - A9 - PB5 | ||
284 | _BV(6), // D28 / D10 - A10 - PB6 | ||
285 | _BV(6), // D29 / D12 - A11 - PD6 | ||
286 | }; | ||
287 | |||
288 | const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { | ||
289 | NOT_ON_TIMER, | ||
290 | NOT_ON_TIMER, | ||
291 | NOT_ON_TIMER, | ||
292 | TIMER0B, /* 3 */ | ||
293 | NOT_ON_TIMER, | ||
294 | TIMER3A, /* 5 */ | ||
295 | TIMER4D, /* 6 */ | ||
296 | NOT_ON_TIMER, | ||
297 | |||
298 | NOT_ON_TIMER, | ||
299 | TIMER1A, /* 9 */ | ||
300 | TIMER1B, /* 10 */ | ||
301 | TIMER0A, /* 11 */ | ||
302 | |||
303 | NOT_ON_TIMER, | ||
304 | TIMER4A, /* 13 */ | ||
305 | |||
306 | NOT_ON_TIMER, | ||
307 | NOT_ON_TIMER, | ||
308 | NOT_ON_TIMER, | ||
309 | NOT_ON_TIMER, | ||
310 | NOT_ON_TIMER, | ||
311 | NOT_ON_TIMER, | ||
312 | |||
313 | NOT_ON_TIMER, | ||
314 | NOT_ON_TIMER, | ||
315 | NOT_ON_TIMER, | ||
316 | NOT_ON_TIMER, | ||
317 | NOT_ON_TIMER, | ||
318 | NOT_ON_TIMER, | ||
319 | NOT_ON_TIMER, | ||
320 | NOT_ON_TIMER, | ||
321 | NOT_ON_TIMER, | ||
322 | NOT_ON_TIMER, | ||
323 | }; | ||
324 | |||
325 | const uint8_t PROGMEM analog_pin_to_channel_PGM[] = { | ||
326 | 7, // A0 PF7 ADC7 | ||
327 | 6, // A1 PF6 ADC6 | ||
328 | 5, // A2 PF5 ADC5 | ||
329 | 4, // A3 PF4 ADC4 | ||
330 | 1, // A4 PF1 ADC1 | ||
331 | 0, // A5 PF0 ADC0 | ||
332 | 8, // A6 D4 PD4 ADC8 | ||
333 | 10, // A7 D6 PD7 ADC10 | ||
334 | 11, // A8 D8 PB4 ADC11 | ||
335 | 12, // A9 D9 PB5 ADC12 | ||
336 | 13, // A10 D10 PB6 ADC13 | ||
337 | 9 // A11 D12 PD6 ADC9 | ||
338 | }; | ||
339 | |||
340 | #endif /* ARDUINO_MAIN */ | ||
341 | |||
342 | // These serial port names are intended to allow libraries and architecture-neutral | ||
343 | // sketches to automatically default to the correct port name for a particular type | ||
344 | // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, | ||
345 | // the first hardware serial port whose RX/TX pins are not dedicated to another use. | ||
346 | // | ||
347 | // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor | ||
348 | // | ||
349 | // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial | ||
350 | // | ||
351 | // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library | ||
352 | // | ||
353 | // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. | ||
354 | // | ||
355 | // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX | ||
356 | // pins are NOT connected to anything by default. | ||
357 | #define SERIAL_PORT_MONITOR Serial | ||
358 | #define SERIAL_PORT_USBVIRTUAL Serial | ||
359 | #define SERIAL_PORT_HARDWARE Serial1 | ||
360 | #define SERIAL_PORT_HARDWARE_OPEN Serial1 | ||
361 | |||
362 | #endif /* Pins_Arduino_h */ | ||
diff --git a/keyboards/orthodox/pro_micro.h b/keyboards/orthodox/pro_micro.h deleted file mode 100644 index f9e7ed75d..000000000 --- a/keyboards/orthodox/pro_micro.h +++ /dev/null | |||
@@ -1,362 +0,0 @@ | |||
1 | /* | ||
2 | pins_arduino.h - Pin definition functions for Arduino | ||
3 | Part of Arduino - http://www.arduino.cc/ | ||
4 | |||
5 | Copyright (c) 2007 David A. Mellis | ||
6 | |||
7 | This library is free software; you can redistribute it and/or | ||
8 | modify it under the terms of the GNU Lesser General Public | ||
9 | License as published by the Free Software Foundation; either | ||
10 | version 2.1 of the License, or (at your option) any later version. | ||
11 | |||
12 | This library is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | Lesser General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU Lesser General | ||
18 | Public License along with this library; if not, write to the | ||
19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, | ||
20 | Boston, MA 02111-1307 USA | ||
21 | |||
22 | $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ | ||
23 | */ | ||
24 | |||
25 | #ifndef Pins_Arduino_h | ||
26 | #define Pins_Arduino_h | ||
27 | |||
28 | #include <avr/pgmspace.h> | ||
29 | |||
30 | // Workaround for wrong definitions in "iom32u4.h". | ||
31 | // This should be fixed in the AVR toolchain. | ||
32 | #undef UHCON | ||
33 | #undef UHINT | ||
34 | #undef UHIEN | ||
35 | #undef UHADDR | ||
36 | #undef UHFNUM | ||
37 | #undef UHFNUML | ||
38 | #undef UHFNUMH | ||
39 | #undef UHFLEN | ||
40 | #undef UPINRQX | ||
41 | #undef UPINTX | ||
42 | #undef UPNUM | ||
43 | #undef UPRST | ||
44 | #undef UPCONX | ||
45 | #undef UPCFG0X | ||
46 | #undef UPCFG1X | ||
47 | #undef UPSTAX | ||
48 | #undef UPCFG2X | ||
49 | #undef UPIENX | ||
50 | #undef UPDATX | ||
51 | #undef TCCR2A | ||
52 | #undef WGM20 | ||
53 | #undef WGM21 | ||
54 | #undef COM2B0 | ||
55 | #undef COM2B1 | ||
56 | #undef COM2A0 | ||
57 | #undef COM2A1 | ||
58 | #undef TCCR2B | ||
59 | #undef CS20 | ||
60 | #undef CS21 | ||
61 | #undef CS22 | ||
62 | #undef WGM22 | ||
63 | #undef FOC2B | ||
64 | #undef FOC2A | ||
65 | #undef TCNT2 | ||
66 | #undef TCNT2_0 | ||
67 | #undef TCNT2_1 | ||
68 | #undef TCNT2_2 | ||
69 | #undef TCNT2_3 | ||
70 | #undef TCNT2_4 | ||
71 | #undef TCNT2_5 | ||
72 | #undef TCNT2_6 | ||
73 | #undef TCNT2_7 | ||
74 | #undef OCR2A | ||
75 | #undef OCR2_0 | ||
76 | #undef OCR2_1 | ||
77 | #undef OCR2_2 | ||
78 | #undef OCR2_3 | ||
79 | #undef OCR2_4 | ||
80 | #undef OCR2_5 | ||
81 | #undef OCR2_6 | ||
82 | #undef OCR2_7 | ||
83 | #undef OCR2B | ||
84 | #undef OCR2_0 | ||
85 | #undef OCR2_1 | ||
86 | #undef OCR2_2 | ||
87 | #undef OCR2_3 | ||
88 | #undef OCR2_4 | ||
89 | #undef OCR2_5 | ||
90 | #undef OCR2_6 | ||
91 | #undef OCR2_7 | ||
92 | |||
93 | #define NUM_DIGITAL_PINS 30 | ||
94 | #define NUM_ANALOG_INPUTS 12 | ||
95 | |||
96 | #define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) | ||
97 | #define TXLED0 PORTD |= (1<<5) | ||
98 | #define TXLED1 PORTD &= ~(1<<5) | ||
99 | #define RXLED0 PORTB |= (1<<0) | ||
100 | #define RXLED1 PORTB &= ~(1<<0) | ||
101 | |||
102 | static const uint8_t SDA = 2; | ||
103 | static const uint8_t SCL = 3; | ||
104 | #define LED_BUILTIN 13 | ||
105 | |||
106 | // Map SPI port to 'new' pins D14..D17 | ||
107 | static const uint8_t SS = 17; | ||
108 | static const uint8_t MOSI = 16; | ||
109 | static const uint8_t MISO = 14; | ||
110 | static const uint8_t SCK = 15; | ||
111 | |||
112 | // Mapping of analog pins as digital I/O | ||
113 | // A6-A11 share with digital pins | ||
114 | static const uint8_t ADC0 = 18; | ||
115 | static const uint8_t ADC1 = 19; | ||
116 | static const uint8_t ADC2 = 20; | ||
117 | static const uint8_t ADC3 = 21; | ||
118 | static const uint8_t ADC4 = 22; | ||
119 | static const uint8_t ADC5 = 23; | ||
120 | static const uint8_t ADC6 = 24; // D4 | ||
121 | static const uint8_t ADC7 = 25; // D6 | ||
122 | static const uint8_t ADC8 = 26; // D8 | ||
123 | static const uint8_t ADC9 = 27; // D9 | ||
124 | static const uint8_t ADC10 = 28; // D10 | ||
125 | static const uint8_t ADC11 = 29; // D12 | ||
126 | |||
127 | #define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0)) | ||
128 | #define digitalPinToPCICRbit(p) 0 | ||
129 | #define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0)) | ||
130 | #define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4)))))) | ||
131 | |||
132 | // __AVR_ATmega32U4__ has an unusual mapping of pins to channels | ||
133 | extern const uint8_t PROGMEM analog_pin_to_channel_PGM[]; | ||
134 | #define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) ) | ||
135 | |||
136 | #define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT))))) | ||
137 | |||
138 | #ifdef ARDUINO_MAIN | ||
139 | |||
140 | // On the Arduino board, digital pins are also used | ||
141 | // for the analog output (software PWM). Analog input | ||
142 | // pins are a separate set. | ||
143 | |||
144 | // ATMEL ATMEGA32U4 / ARDUINO LEONARDO | ||
145 | // | ||
146 | // D0 PD2 RXD1/INT2 | ||
147 | // D1 PD3 TXD1/INT3 | ||
148 | // D2 PD1 SDA SDA/INT1 | ||
149 | // D3# PD0 PWM8/SCL OC0B/SCL/INT0 | ||
150 | // D4 A6 PD4 ADC8 | ||
151 | // D5# PC6 ??? OC3A/#OC4A | ||
152 | // D6# A7 PD7 FastPWM #OC4D/ADC10 | ||
153 | // D7 PE6 INT6/AIN0 | ||
154 | // | ||
155 | // D8 A8 PB4 ADC11/PCINT4 | ||
156 | // D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5 | ||
157 | // D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6 | ||
158 | // D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7 | ||
159 | // D12 A11 PD6 T1/#OC4D/ADC9 | ||
160 | // D13# PC7 PWM10 CLK0/OC4A | ||
161 | // | ||
162 | // A0 D18 PF7 ADC7 | ||
163 | // A1 D19 PF6 ADC6 | ||
164 | // A2 D20 PF5 ADC5 | ||
165 | // A3 D21 PF4 ADC4 | ||
166 | // A4 D22 PF1 ADC1 | ||
167 | // A5 D23 PF0 ADC0 | ||
168 | // | ||
169 | // New pins D14..D17 to map SPI port to digital pins | ||
170 | // | ||
171 | // MISO D14 PB3 MISO,PCINT3 | ||
172 | // SCK D15 PB1 SCK,PCINT1 | ||
173 | // MOSI D16 PB2 MOSI,PCINT2 | ||
174 | // SS D17 PB0 RXLED,SS/PCINT0 | ||
175 | // | ||
176 | // Connected LEDs on board for TX and RX | ||
177 | // TXLED D24 PD5 XCK1 | ||
178 | // RXLED D17 PB0 | ||
179 | // HWB PE2 HWB | ||
180 | |||
181 | // these arrays map port names (e.g. port B) to the | ||
182 | // appropriate addresses for various functions (e.g. reading | ||
183 | // and writing) | ||
184 | const uint16_t PROGMEM port_to_mode_PGM[] = { | ||
185 | NOT_A_PORT, | ||
186 | NOT_A_PORT, | ||
187 | (uint16_t) &DDRB, | ||
188 | (uint16_t) &DDRC, | ||
189 | (uint16_t) &DDRD, | ||
190 | (uint16_t) &DDRE, | ||
191 | (uint16_t) &DDRF, | ||
192 | }; | ||
193 | |||
194 | const uint16_t PROGMEM port_to_output_PGM[] = { | ||
195 | NOT_A_PORT, | ||
196 | NOT_A_PORT, | ||
197 | (uint16_t) &PORTB, | ||
198 | (uint16_t) &PORTC, | ||
199 | (uint16_t) &PORTD, | ||
200 | (uint16_t) &PORTE, | ||
201 | (uint16_t) &PORTF, | ||
202 | }; | ||
203 | |||
204 | const uint16_t PROGMEM port_to_input_PGM[] = { | ||
205 | NOT_A_PORT, | ||
206 | NOT_A_PORT, | ||
207 | (uint16_t) &PINB, | ||
208 | (uint16_t) &PINC, | ||
209 | (uint16_t) &PIND, | ||
210 | (uint16_t) &PINE, | ||
211 | (uint16_t) &PINF, | ||
212 | }; | ||
213 | |||
214 | const uint8_t PROGMEM digital_pin_to_port_PGM[] = { | ||
215 | PD, // D0 - PD2 | ||
216 | PD, // D1 - PD3 | ||
217 | PD, // D2 - PD1 | ||
218 | PD, // D3 - PD0 | ||
219 | PD, // D4 - PD4 | ||
220 | PC, // D5 - PC6 | ||
221 | PD, // D6 - PD7 | ||
222 | PE, // D7 - PE6 | ||
223 | |||
224 | PB, // D8 - PB4 | ||
225 | PB, // D9 - PB5 | ||
226 | PB, // D10 - PB6 | ||
227 | PB, // D11 - PB7 | ||
228 | PD, // D12 - PD6 | ||
229 | PC, // D13 - PC7 | ||
230 | |||
231 | PB, // D14 - MISO - PB3 | ||
232 | PB, // D15 - SCK - PB1 | ||
233 | PB, // D16 - MOSI - PB2 | ||
234 | PB, // D17 - SS - PB0 | ||
235 | |||
236 | PF, // D18 - A0 - PF7 | ||
237 | PF, // D19 - A1 - PF6 | ||
238 | PF, // D20 - A2 - PF5 | ||
239 | PF, // D21 - A3 - PF4 | ||
240 | PF, // D22 - A4 - PF1 | ||
241 | PF, // D23 - A5 - PF0 | ||
242 | |||
243 | PD, // D24 - PD5 | ||
244 | PD, // D25 / D6 - A7 - PD7 | ||
245 | PB, // D26 / D8 - A8 - PB4 | ||
246 | PB, // D27 / D9 - A9 - PB5 | ||
247 | PB, // D28 / D10 - A10 - PB6 | ||
248 | PD, // D29 / D12 - A11 - PD6 | ||
249 | }; | ||
250 | |||
251 | const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { | ||
252 | _BV(2), // D0 - PD2 | ||
253 | _BV(3), // D1 - PD3 | ||
254 | _BV(1), // D2 - PD1 | ||
255 | _BV(0), // D3 - PD0 | ||
256 | _BV(4), // D4 - PD4 | ||
257 | _BV(6), // D5 - PC6 | ||
258 | _BV(7), // D6 - PD7 | ||
259 | _BV(6), // D7 - PE6 | ||
260 | |||
261 | _BV(4), // D8 - PB4 | ||
262 | _BV(5), // D9 - PB5 | ||
263 | _BV(6), // D10 - PB6 | ||
264 | _BV(7), // D11 - PB7 | ||
265 | _BV(6), // D12 - PD6 | ||
266 | _BV(7), // D13 - PC7 | ||
267 | |||
268 | _BV(3), // D14 - MISO - PB3 | ||
269 | _BV(1), // D15 - SCK - PB1 | ||
270 | _BV(2), // D16 - MOSI - PB2 | ||
271 | _BV(0), // D17 - SS - PB0 | ||
272 | |||
273 | _BV(7), // D18 - A0 - PF7 | ||
274 | _BV(6), // D19 - A1 - PF6 | ||
275 | _BV(5), // D20 - A2 - PF5 | ||
276 | _BV(4), // D21 - A3 - PF4 | ||
277 | _BV(1), // D22 - A4 - PF1 | ||
278 | _BV(0), // D23 - A5 - PF0 | ||
279 | |||
280 | _BV(5), // D24 - PD5 | ||
281 | _BV(7), // D25 / D6 - A7 - PD7 | ||
282 | _BV(4), // D26 / D8 - A8 - PB4 | ||
283 | _BV(5), // D27 / D9 - A9 - PB5 | ||
284 | _BV(6), // D28 / D10 - A10 - PB6 | ||
285 | _BV(6), // D29 / D12 - A11 - PD6 | ||
286 | }; | ||
287 | |||
288 | const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { | ||
289 | NOT_ON_TIMER, | ||
290 | NOT_ON_TIMER, | ||
291 | NOT_ON_TIMER, | ||
292 | TIMER0B, /* 3 */ | ||
293 | NOT_ON_TIMER, | ||
294 | TIMER3A, /* 5 */ | ||
295 | TIMER4D, /* 6 */ | ||
296 | NOT_ON_TIMER, | ||
297 | |||
298 | NOT_ON_TIMER, | ||
299 | TIMER1A, /* 9 */ | ||
300 | TIMER1B, /* 10 */ | ||
301 | TIMER0A, /* 11 */ | ||
302 | |||
303 | NOT_ON_TIMER, | ||
304 | TIMER4A, /* 13 */ | ||
305 | |||
306 | NOT_ON_TIMER, | ||
307 | NOT_ON_TIMER, | ||
308 | NOT_ON_TIMER, | ||
309 | NOT_ON_TIMER, | ||
310 | NOT_ON_TIMER, | ||
311 | NOT_ON_TIMER, | ||
312 | |||
313 | NOT_ON_TIMER, | ||
314 | NOT_ON_TIMER, | ||
315 | NOT_ON_TIMER, | ||
316 | NOT_ON_TIMER, | ||
317 | NOT_ON_TIMER, | ||
318 | NOT_ON_TIMER, | ||
319 | NOT_ON_TIMER, | ||
320 | NOT_ON_TIMER, | ||
321 | NOT_ON_TIMER, | ||
322 | NOT_ON_TIMER, | ||
323 | }; | ||
324 | |||
325 | const uint8_t PROGMEM analog_pin_to_channel_PGM[] = { | ||
326 | 7, // A0 PF7 ADC7 | ||
327 | 6, // A1 PF6 ADC6 | ||
328 | 5, // A2 PF5 ADC5 | ||
329 | 4, // A3 PF4 ADC4 | ||
330 | 1, // A4 PF1 ADC1 | ||
331 | 0, // A5 PF0 ADC0 | ||
332 | 8, // A6 D4 PD4 ADC8 | ||
333 | 10, // A7 D6 PD7 ADC10 | ||
334 | 11, // A8 D8 PB4 ADC11 | ||
335 | 12, // A9 D9 PB5 ADC12 | ||
336 | 13, // A10 D10 PB6 ADC13 | ||
337 | 9 // A11 D12 PD6 ADC9 | ||
338 | }; | ||
339 | |||
340 | #endif /* ARDUINO_MAIN */ | ||
341 | |||
342 | // These serial port names are intended to allow libraries and architecture-neutral | ||
343 | // sketches to automatically default to the correct port name for a particular type | ||
344 | // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, | ||
345 | // the first hardware serial port whose RX/TX pins are not dedicated to another use. | ||
346 | // | ||
347 | // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor | ||
348 | // | ||
349 | // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial | ||
350 | // | ||
351 | // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library | ||
352 | // | ||
353 | // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. | ||
354 | // | ||
355 | // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX | ||
356 | // pins are NOT connected to anything by default. | ||
357 | #define SERIAL_PORT_MONITOR Serial | ||
358 | #define SERIAL_PORT_USBVIRTUAL Serial | ||
359 | #define SERIAL_PORT_HARDWARE Serial1 | ||
360 | #define SERIAL_PORT_HARDWARE_OPEN Serial1 | ||
361 | |||
362 | #endif /* Pins_Arduino_h */ | ||
diff --git a/keyboards/orthodox/ssd1306.h b/keyboards/orthodox/ssd1306.h deleted file mode 100644 index b0c74f987..000000000 --- a/keyboards/orthodox/ssd1306.h +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | #ifndef SSD1306_H | ||
2 | #define SSD1306_H | ||
3 | |||
4 | #include <stdbool.h> | ||
5 | #include <stdio.h> | ||
6 | |||
7 | bool iota_gfx_init(void); | ||
8 | void iota_gfx_task(void); | ||
9 | bool iota_gfx_off(void); | ||
10 | bool iota_gfx_on(void); | ||
11 | void iota_gfx_flush(void); | ||
12 | void iota_gfx_write_char(uint8_t c); | ||
13 | void iota_gfx_write(const char *data); | ||
14 | void iota_gfx_write_P(const char *data); | ||
15 | void iota_gfx_clear_screen(void); | ||
16 | |||
17 | #endif | ||
diff --git a/quantum/rgblight.h b/quantum/rgblight.h index 92130192c..8fea96a9e 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h | |||
@@ -61,7 +61,7 @@ | |||
61 | #include <stdint.h> | 61 | #include <stdint.h> |
62 | #include <stdbool.h> | 62 | #include <stdbool.h> |
63 | #include "eeconfig.h" | 63 | #include "eeconfig.h" |
64 | #include "light_ws2812.h" | 64 | #include "ws2812.h" |
65 | 65 | ||
66 | extern LED_TYPE led[RGBLED_NUM]; | 66 | extern LED_TYPE led[RGBLED_NUM]; |
67 | 67 | ||
diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk index 6773726ee..4af34ba57 100644 --- a/tmk_core/avr.mk +++ b/tmk_core/avr.mk | |||
@@ -12,7 +12,7 @@ HEX = $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature | |||
12 | EEP = $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) | 12 | EEP = $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) |
13 | BIN = | 13 | BIN = |
14 | 14 | ||
15 | 15 | COMMON_VPATH += $(DRIVER_PATH)/avr | |
16 | 16 | ||
17 | COMPILEFLAGS += -funsigned-char | 17 | COMPILEFLAGS += -funsigned-char |
18 | COMPILEFLAGS += -funsigned-bitfields | 18 | COMPILEFLAGS += -funsigned-bitfields |