b624f32f944acdc59dcb130674c09090c5c404cb
- Author
- skullY <skullydazed@gmail.com>
- Committer
- skullydazed <skullydazed@users.noreply.github.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/drivers/arm/i2c_master.c b/drivers/arm/i2c_master.c
2index cba5a1c679f3fa07f65ce3022d9db3714013b6df..18068d3a6dcd992254d0b57ee0086d8ed3473621 100644
3--- a/drivers/arm/i2c_master.c
4+++ b/drivers/arm/i2c_master.c
5@@ -34,98 +34,83 @@ static uint8_t i2c_address;
6
7 static const I2CConfig i2cconfig = {
8 #ifdef USE_I2CV1
9- I2C1_OPMODE,
10- I2C1_CLOCK_SPEED,
11- I2C1_DUTY_CYCLE,
12+ I2C1_OPMODE,
13+ I2C1_CLOCK_SPEED,
14+ I2C1_DUTY_CYCLE,
15 #else
16- STM32_TIMINGR_PRESC(I2C1_TIMINGR_PRESC) |
17- STM32_TIMINGR_SCLDEL(I2C1_TIMINGR_SCLDEL) | STM32_TIMINGR_SDADEL(I2C1_TIMINGR_SDADEL) |
18- STM32_TIMINGR_SCLH(I2C1_TIMINGR_SCLH) | STM32_TIMINGR_SCLL(I2C1_TIMINGR_SCLL),
19- 0,
20- 0
21+ STM32_TIMINGR_PRESC(I2C1_TIMINGR_PRESC) | STM32_TIMINGR_SCLDEL(I2C1_TIMINGR_SCLDEL) | STM32_TIMINGR_SDADEL(I2C1_TIMINGR_SDADEL) | STM32_TIMINGR_SCLH(I2C1_TIMINGR_SCLH) | STM32_TIMINGR_SCLL(I2C1_TIMINGR_SCLL), 0, 0
22 #endif
23 };
24
25 static i2c_status_t chibios_to_qmk(const msg_t* status) {
26- switch (*status) {
27- case I2C_NO_ERROR:
28- return I2C_STATUS_SUCCESS;
29- case I2C_TIMEOUT:
30- return I2C_STATUS_TIMEOUT;
31- // I2C_BUS_ERROR, I2C_ARBITRATION_LOST, I2C_ACK_FAILURE, I2C_OVERRUN, I2C_PEC_ERROR, I2C_SMB_ALERT
32- default:
33- return I2C_STATUS_ERROR;
34- }
35+ switch (*status) {
36+ case I2C_NO_ERROR:
37+ return I2C_STATUS_SUCCESS;
38+ case I2C_TIMEOUT:
39+ return I2C_STATUS_TIMEOUT;
40+ // I2C_BUS_ERROR, I2C_ARBITRATION_LOST, I2C_ACK_FAILURE, I2C_OVERRUN, I2C_PEC_ERROR, I2C_SMB_ALERT
41+ default:
42+ return I2C_STATUS_ERROR;
43+ }
44 }
45
46-__attribute__ ((weak))
47-void i2c_init(void)
48-{
49- // Try releasing special pins for a short time
50- palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_INPUT);
51- palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_INPUT);
52+__attribute__((weak)) void i2c_init(void) {
53+ // Try releasing special pins for a short time
54+ palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_INPUT);
55+ palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_INPUT);
56
57- chThdSleepMilliseconds(10);
58+ chThdSleepMilliseconds(10);
59
60 #ifdef USE_I2CV1
61- palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_STM32_ALTERNATE_OPENDRAIN);
62- palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_STM32_ALTERNATE_OPENDRAIN);
63+ palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_STM32_ALTERNATE_OPENDRAIN);
64+ palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_STM32_ALTERNATE_OPENDRAIN);
65 #else
66- palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_ALTERNATE(I2C1_SCL_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN);
67- palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_ALTERNATE(I2C1_SDA_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN);
68+ palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_ALTERNATE(I2C1_SCL_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN);
69+ palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_ALTERNATE(I2C1_SDA_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN);
70 #endif
71
72- //i2cInit(); //This is invoked by halInit() so no need to redo it.
73+ // i2cInit(); //This is invoked by halInit() so no need to redo it.
74 }
75
76-i2c_status_t i2c_start(uint8_t address)
77-{
78- i2c_address = address;
79- i2cStart(&I2C_DRIVER, &i2cconfig);
80- return I2C_STATUS_SUCCESS;
81+i2c_status_t i2c_start(uint8_t address) {
82+ i2c_address = address;
83+ i2cStart(&I2C_DRIVER, &i2cconfig);
84+ return I2C_STATUS_SUCCESS;
85 }
86
87-i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout)
88-{
89- i2c_address = address;
90- i2cStart(&I2C_DRIVER, &i2cconfig);
91- msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, 0, 0, MS2ST(timeout));
92- return chibios_to_qmk(&status);
93+i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout) {
94+ i2c_address = address;
95+ i2cStart(&I2C_DRIVER, &i2cconfig);
96+ msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, 0, 0, MS2ST(timeout));
97+ return chibios_to_qmk(&status);
98 }
99
100-i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout)
101-{
102- i2c_address = address;
103- i2cStart(&I2C_DRIVER, &i2cconfig);
104- msg_t status = i2cMasterReceiveTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, MS2ST(timeout));
105diff --git a/drivers/arm/i2c_master.h b/drivers/arm/i2c_master.h
106index c8afa31e28d67e76cbe1a8700c5c684de8281544..b40fa0a9102614bdbb739d8f608915acec71d315 100644
107--- a/drivers/arm/i2c_master.h
108+++ b/drivers/arm/i2c_master.h
109@@ -27,84 +27,83 @@
110 #include "ch.h"
111 #include <hal.h>
112
113-
114 #if defined(STM32F1XX) || defined(STM32F1xx) || defined(STM32F2xx) || defined(STM32F4xx) || defined(STM32L0xx) || defined(STM32L1xx)
115- #define USE_I2CV1
116+# define USE_I2CV1
117 #endif
118
119 #ifdef I2C1_BANK
120- #define I2C1_SCL_BANK I2C1_BANK
121- #define I2C1_SDA_BANK I2C1_BANK
122+# define I2C1_SCL_BANK I2C1_BANK
123+# define I2C1_SDA_BANK I2C1_BANK
124 #endif
125
126 #ifndef I2C1_SCL_BANK
127- #define I2C1_SCL_BANK GPIOB
128+# define I2C1_SCL_BANK GPIOB
129 #endif
130
131 #ifndef I2C1_SDA_BANK
132- #define I2C1_SDA_BANK GPIOB
133+# define I2C1_SDA_BANK GPIOB
134 #endif
135
136 #ifndef I2C1_SCL
137- #define I2C1_SCL 6
138+# define I2C1_SCL 6
139 #endif
140 #ifndef I2C1_SDA
141- #define I2C1_SDA 7
142+# define I2C1_SDA 7
143 #endif
144
145 #ifdef USE_I2CV1
146- #ifndef I2C1_OPMODE
147- #define I2C1_OPMODE OPMODE_I2C
148- #endif
149- #ifndef I2C1_CLOCK_SPEED
150- #define I2C1_CLOCK_SPEED 100000 /* 400000 */
151- #endif
152- #ifndef I2C1_DUTY_CYCLE
153- #define I2C1_DUTY_CYCLE STD_DUTY_CYCLE /* FAST_DUTY_CYCLE_2 */
154- #endif
155+# ifndef I2C1_OPMODE
156+# define I2C1_OPMODE OPMODE_I2C
157+# endif
158+# ifndef I2C1_CLOCK_SPEED
159+# define I2C1_CLOCK_SPEED 100000 /* 400000 */
160+# endif
161+# ifndef I2C1_DUTY_CYCLE
162+# define I2C1_DUTY_CYCLE STD_DUTY_CYCLE /* FAST_DUTY_CYCLE_2 */
163+# endif
164 #else
165- // The default PAL alternate modes are used to signal that the pins are used for I2C
166- #ifndef I2C1_SCL_PAL_MODE
167- #define I2C1_SCL_PAL_MODE 4
168- #endif
169- #ifndef I2C1_SDA_PAL_MODE
170- #define I2C1_SDA_PAL_MODE 4
171- #endif
172+// The default PAL alternate modes are used to signal that the pins are used for I2C
173+# ifndef I2C1_SCL_PAL_MODE
174+# define I2C1_SCL_PAL_MODE 4
175+# endif
176+# ifndef I2C1_SDA_PAL_MODE
177+# define I2C1_SDA_PAL_MODE 4
178+# endif
179
180- // The default timing values below configures the I2C clock to 400khz assuming a 72Mhz clock
181- // For more info : https://www.st.com/en/embedded-software/stsw-stm32126.html
182- #ifndef I2C1_TIMINGR_PRESC
183- #define I2C1_TIMINGR_PRESC 15U
184- #endif
185- #ifndef I2C1_TIMINGR_SCLDEL
186- #define I2C1_TIMINGR_SCLDEL 4U
187- #endif
188- #ifndef I2C1_TIMINGR_SDADEL
189- #define I2C1_TIMINGR_SDADEL 2U
190- #endif
191- #ifndef I2C1_TIMINGR_SCLH
192- #define I2C1_TIMINGR_SCLH 15U
193- #endif
194- #ifndef I2C1_TIMINGR_SCLL
195- #define I2C1_TIMINGR_SCLL 21U
196- #endif
197+// The default timing values below configures the I2C clock to 400khz assuming a 72Mhz clock
198+// For more info : https://www.st.com/en/embedded-software/stsw-stm32126.html
199+# ifndef I2C1_TIMINGR_PRESC
200+# define I2C1_TIMINGR_PRESC 15U
201+# endif
202+# ifndef I2C1_TIMINGR_SCLDEL
203+# define I2C1_TIMINGR_SCLDEL 4U
204+# endif
205+# ifndef I2C1_TIMINGR_SDADEL
206+# define I2C1_TIMINGR_SDADEL 2U
207+# endif
208+# ifndef I2C1_TIMINGR_SCLH
209diff --git a/drivers/avr/analog.c b/drivers/avr/analog.c
210index 1ec38df75df6080d70e00a622d67300c6c06b801..1a8da4261dfe3286c9dd7fc4378a0869f0b45ecf 100644
211--- a/drivers/avr/analog.c
212+++ b/drivers/avr/analog.c
213@@ -21,49 +21,38 @@
214 #include <stdint.h>
215 #include "analog.h"
216
217+static uint8_t aref = (1 << REFS0); // default to AREF = Vcc
218
219-static uint8_t aref = (1<<REFS0); // default to AREF = Vcc
220-
221-
222-void analogReference(uint8_t mode)
223-{
224- aref = mode & 0xC0;
225-}
226-
227+void analogReference(uint8_t mode) { aref = mode & 0xC0; }
228
229 // Arduino compatible pin input
230-int16_t analogRead(uint8_t pin)
231-{
232+int16_t analogRead(uint8_t pin) {
233 #if defined(__AVR_ATmega32U4__)
234- static const uint8_t PROGMEM pin_to_mux[] = {
235- 0x00, 0x01, 0x04, 0x05, 0x06, 0x07,
236- 0x25, 0x24, 0x23, 0x22, 0x21, 0x20};
237- if (pin >= 12) return 0;
238- return adc_read(pgm_read_byte(pin_to_mux + pin));
239+ static const uint8_t PROGMEM pin_to_mux[] = {0x00, 0x01, 0x04, 0x05, 0x06, 0x07, 0x25, 0x24, 0x23, 0x22, 0x21, 0x20};
240+ if (pin >= 12) return 0;
241+ return adc_read(pgm_read_byte(pin_to_mux + pin));
242 #elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
243- if (pin >= 8) return 0;
244- return adc_read(pin);
245+ if (pin >= 8) return 0;
246+ return adc_read(pin);
247 #else
248- return 0;
249+ return 0;
250 #endif
251 }
252
253 // Mux input
254-int16_t adc_read(uint8_t mux)
255-{
256+int16_t adc_read(uint8_t mux) {
257 #if defined(__AVR_AT90USB162__)
258- return 0;
259+ return 0;
260 #else
261- uint8_t low;
262-
263- ADCSRA = (1<<ADEN) | ADC_PRESCALER; // enable ADC
264- ADCSRB = (1<<ADHSM) | (mux & 0x20); // high speed mode
265- ADMUX = aref | (mux & 0x1F); // configure mux input
266- ADCSRA = (1<<ADEN) | ADC_PRESCALER | (1<<ADSC); // start the conversion
267- while (ADCSRA & (1<<ADSC)) ; // wait for result
268- low = ADCL; // must read LSB first
269- return (ADCH << 8) | low; // must read MSB only once!
270+ uint8_t low;
271+
272+ ADCSRA = (1 << ADEN) | ADC_PRESCALER; // enable ADC
273+ ADCSRB = (1 << ADHSM) | (mux & 0x20); // high speed mode
274+ ADMUX = aref | (mux & 0x1F); // configure mux input
275+ ADCSRA = (1 << ADEN) | ADC_PRESCALER | (1 << ADSC); // start the conversion
276+ while (ADCSRA & (1 << ADSC))
277+ ; // wait for result
278+ low = ADCL; // must read LSB first
279+ return (ADCH << 8) | low; // must read MSB only once!
280 #endif
281 }
282-
283-
284diff --git a/drivers/avr/analog.h b/drivers/avr/analog.h
285index 8d93de7dc27f983e1d55620bf3ead95858586aa4..32452a1ec210c14a4daa9b6b865dfe4714480ef2 100644
286--- a/drivers/avr/analog.h
287+++ b/drivers/avr/analog.h
288@@ -19,34 +19,34 @@
289
290 #include <stdint.h>
291
292-void analogReference(uint8_t mode);
293+void analogReference(uint8_t mode);
294 int16_t analogRead(uint8_t pin);
295 int16_t adc_read(uint8_t mux);
296
297-#define ADC_REF_POWER (1<<REFS0)
298-#define ADC_REF_INTERNAL ((1<<REFS1) | (1<<REFS0))
299-#define ADC_REF_EXTERNAL (0)
300+#define ADC_REF_POWER (1 << REFS0)
301+#define ADC_REF_INTERNAL ((1 << REFS1) | (1 << REFS0))
302+#define ADC_REF_EXTERNAL (0)
303
304 // These prescaler values are for high speed mode, ADHSM = 1
305 #if F_CPU == 16000000L
306-#define ADC_PRESCALER ((1<<ADPS2) | (1<<ADPS1))
307+# define ADC_PRESCALER ((1 << ADPS2) | (1 << ADPS1))
308 #elif F_CPU == 8000000L
309-#define ADC_PRESCALER ((1<<ADPS2) | (1<<ADPS0))
310+# define ADC_PRESCALER ((1 << ADPS2) | (1 << ADPS0))
311 #elif F_CPU == 4000000L
312-#define ADC_PRESCALER ((1<<ADPS2))
313+# define ADC_PRESCALER ((1 << ADPS2))
314 #elif F_CPU == 2000000L
315-#define ADC_PRESCALER ((1<<ADPS1) | (1<<ADPS0))
316+# define ADC_PRESCALER ((1 << ADPS1) | (1 << ADPS0))
317 #elif F_CPU == 1000000L
318-#define ADC_PRESCALER ((1<<ADPS1))
319+# define ADC_PRESCALER ((1 << ADPS1))
320 #else
321-#define ADC_PRESCALER ((1<<ADPS0))
322+# define ADC_PRESCALER ((1 << ADPS0))
323 #endif
324
325 // some avr-libc versions do not properly define ADHSM
326 #if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
327-#if !defined(ADHSM)
328-#define ADHSM (7)
329-#endif
330+# if !defined(ADHSM)
331+# define ADHSM (7)
332+# endif
333 #endif
334
335 #endif
336diff --git a/drivers/avr/apa102.c b/drivers/avr/apa102.c
337old mode 100755
338new mode 100644
339index 55a0d5777885c7871200ffa669e5596f97523bc9..f4d97a15891ec512e3507db6cb547ee3217ae589
340--- a/drivers/avr/apa102.c
341+++ b/drivers/avr/apa102.c
342@@ -1,24 +1,24 @@
343 /*
344-* APA102 lib V1.0a
345-*
346-* Controls APA102 RGB-LEDs
347-* Author: Mikkel (Duckle29 on github)
348-*
349-* Dec 22th, 2017 v1.0a Initial Version
350-*
351-* This program is free software: you can redistribute it and/or modify
352-* it under the terms of the GNU General Public License as published by
353-* the Free Software Foundation, either version 2 of the License, or
354-* (at your option) any later version.
355-*
356-* This program is distributed in the hope that it will be useful,
357-* but WITHOUT ANY WARRANTY; without even the implied warranty of
358-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
359-* GNU General Public License for more details.
360-*
361-* You should have received a copy of the GNU General Public License
362-* along with this program. If not, see <http://www.gnu.org/licenses/>.
363-*/
364+ * APA102 lib V1.0a
365+ *
366+ * Controls APA102 RGB-LEDs
367+ * Author: Mikkel (Duckle29 on github)
368+ *
369+ * Dec 22th, 2017 v1.0a Initial Version
370+ *
371+ * This program is free software: you can redistribute it and/or modify
372+ * it under the terms of the GNU General Public License as published by
373+ * the Free Software Foundation, either version 2 of the License, or
374+ * (at your option) any later version.
375+ *
376+ * This program is distributed in the hope that it will be useful,
377+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
378+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
379+ * GNU General Public License for more details.
380+ *
381+ * You should have received a copy of the GNU General Public License
382+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
383+ */
384
385 #include "apa102.h"
386 #include <avr/interrupt.h>
387@@ -27,75 +27,70 @@
388 #include "debug.h"
389
390 // Setleds for standard RGB
391-void inline apa102_setleds(LED_TYPE *ledarray, uint16_t leds){
392- apa102_setleds_pin(ledarray,leds, _BV(RGB_DI_PIN & 0xF), _BV(RGB_CLK_PIN & 0xF));
393-}
394+void inline apa102_setleds(LED_TYPE *ledarray, uint16_t leds) { apa102_setleds_pin(ledarray, leds, _BV(RGB_DI_PIN & 0xF), _BV(RGB_CLK_PIN & 0xF)); }
395
396-void static inline apa102_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask_DI, uint8_t pinmask_CLK){
397- pinMode(RGB_DI_PIN, PinDirectionOutput);
398- pinMode(RGB_CLK_PIN, PinDirectionOutput);
399+void static inline apa102_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask_DI, uint8_t pinmask_CLK) {
400+ pinMode(RGB_DI_PIN, PinDirectionOutput);
401+ pinMode(RGB_CLK_PIN, PinDirectionOutput);
402
403- apa102_send_array((uint8_t*)ledarray,leds)
404+ apa102_send_array((uint8_t *)ledarray, leds)
405 }
406
407-void apa102_send_array(uint8_t *data, uint16_t leds){ // Data is struct of 3 bytes. RGB - leds is number of leds in data
408- apa102_start_frame();
409- while(leds--){
410- apa102_send_frame(0xFF000000 | (data->b << 16) | (data->g << 8) | data->r);
411- data++;
412- }
413- apa102_end_frame(leds);
414+void apa102_send_array(uint8_t *data, uint16_t leds) { // Data is struct of 3 bytes. RGB - leds is number of leds in data
415+ apa102_start_frame();
416+ while (leds--) {
417+ apa102_send_frame(0xFF000000 | (data->b << 16) | (data->g << 8) | data->r);
418+ data++;
419+ }
420+ apa102_end_frame(leds);
421 }
422
423-void apa102_send_frame(uint32_t frame){
424- for(uint32_t i=0xFF; i>0;){
425- apa102_send_byte(frame & i);
426- i = i << 8;
427- }
428+void apa102_send_frame(uint32_t frame) {
429+ for (uint32_t i = 0xFF; i > 0;) {
430+ apa102_send_byte(frame & i);
431+ i = i << 8;
432+ }
433 }
434
435-void apa102_start_frame(){
436- apa102_send_frame(0);
437-}
438+void apa102_start_frame() { apa102_send_frame(0); }
439
440-void apa102_end_frame(uint16_t leds)
441-{
442diff --git a/drivers/avr/apa102.h b/drivers/avr/apa102.h
443old mode 100755
444new mode 100644
445index 5d852e067395bb374ca1678e16c125d8c1bf7371..d4c1e18ee1b7b5834ab6b5ac83d8fbf8a70279a0
446--- a/drivers/avr/apa102.h
447+++ b/drivers/avr/apa102.h
448@@ -27,7 +27,6 @@
449
450 #include "color.h"
451
452-
453 /* User Interface
454 *
455 * Input:
456@@ -41,6 +40,6 @@
457 * - Wait 50�s to reset the LEDs
458 */
459
460-void apa102_setleds (LED_TYPE *ledarray, uint16_t number_of_leds);
461-void apa102_setleds_pin (LED_TYPE *ledarray, uint16_t number_of_leds,uint8_t pinmask);
462+void apa102_setleds(LED_TYPE *ledarray, uint16_t number_of_leds);
463+void apa102_setleds_pin(LED_TYPE *ledarray, uint16_t number_of_leds, uint8_t pinmask);
464 void apa102_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds);
465diff --git a/drivers/avr/glcdfont.c b/drivers/avr/glcdfont.c
466index 6f88bd23a781d6376abbd2815dea9dcbc2508ae9..2c332ea6db41919a8538e7fa7137989b398ad3bd 100644
467--- a/drivers/avr/glcdfont.c
468+++ b/drivers/avr/glcdfont.c
469@@ -5,272 +5,30 @@
470 #define FONT5X7_H
471
472 #ifdef __AVR__
473- #include <avr/io.h>
474- #include <avr/pgmspace.h>
475+# include <avr/io.h>
476+# include <avr/pgmspace.h>
477 #elif defined(ESP8266)
478- #include <pgmspace.h>
479+# include <pgmspace.h>
480 #else
481- #define PROGMEM
482+# define PROGMEM
483 #endif
484
485 // Standard ASCII 5x7 font
486
487 static const unsigned char font[] PROGMEM = {
488- 0x00, 0x00, 0x00, 0x00, 0x00,
489- 0x3E, 0x5B, 0x4F, 0x5B, 0x3E,
490- 0x3E, 0x6B, 0x4F, 0x6B, 0x3E,
491- 0x1C, 0x3E, 0x7C, 0x3E, 0x1C,
492- 0x18, 0x3C, 0x7E, 0x3C, 0x18,
493- 0x1C, 0x57, 0x7D, 0x57, 0x1C,
494- 0x1C, 0x5E, 0x7F, 0x5E, 0x1C,
495- 0x00, 0x18, 0x3C, 0x18, 0x00,
496- 0xFF, 0xE7, 0xC3, 0xE7, 0xFF,
497- 0x00, 0x18, 0x24, 0x18, 0x00,
498- 0xFF, 0xE7, 0xDB, 0xE7, 0xFF,
499- 0x30, 0x48, 0x3A, 0x06, 0x0E,
500- 0x26, 0x29, 0x79, 0x29, 0x26,
501- 0x40, 0x7F, 0x05, 0x05, 0x07,
502- 0x40, 0x7F, 0x05, 0x25, 0x3F,
503- 0x5A, 0x3C, 0xE7, 0x3C, 0x5A,
504- 0x7F, 0x3E, 0x1C, 0x1C, 0x08,
505- 0x08, 0x1C, 0x1C, 0x3E, 0x7F,
506- 0x14, 0x22, 0x7F, 0x22, 0x14,
507- 0x5F, 0x5F, 0x00, 0x5F, 0x5F,
508- 0x06, 0x09, 0x7F, 0x01, 0x7F,
509- 0x00, 0x66, 0x89, 0x95, 0x6A,
510- 0x60, 0x60, 0x60, 0x60, 0x60,
511- 0x94, 0xA2, 0xFF, 0xA2, 0x94,
512- 0x08, 0x04, 0x7E, 0x04, 0x08,
513- 0x10, 0x20, 0x7E, 0x20, 0x10,
514- 0x08, 0x08, 0x2A, 0x1C, 0x08,
515- 0x08, 0x1C, 0x2A, 0x08, 0x08,
516- 0x1E, 0x10, 0x10, 0x10, 0x10,
517- 0x0C, 0x1E, 0x0C, 0x1E, 0x0C,
518- 0x30, 0x38, 0x3E, 0x38, 0x30,
519- 0x06, 0x0E, 0x3E, 0x0E, 0x06,
520- 0x00, 0x00, 0x00, 0x00, 0x00,
521- 0x00, 0x00, 0x5F, 0x00, 0x00,
522- 0x00, 0x07, 0x00, 0x07, 0x00,
523- 0x14, 0x7F, 0x14, 0x7F, 0x14,
524- 0x24, 0x2A, 0x7F, 0x2A, 0x12,
525- 0x23, 0x13, 0x08, 0x64, 0x62,
526- 0x36, 0x49, 0x56, 0x20, 0x50,
527- 0x00, 0x08, 0x07, 0x03, 0x00,
528- 0x00, 0x1C, 0x22, 0x41, 0x00,
529- 0x00, 0x41, 0x22, 0x1C, 0x00,
530- 0x2A, 0x1C, 0x7F, 0x1C, 0x2A,
531- 0x08, 0x08, 0x3E, 0x08, 0x08,
532- 0x00, 0x80, 0x70, 0x30, 0x00,
533- 0x08, 0x08, 0x08, 0x08, 0x08,
534- 0x00, 0x00, 0x60, 0x60, 0x00,
535- 0x20, 0x10, 0x08, 0x04, 0x02,
536- 0x3E, 0x51, 0x49, 0x45, 0x3E,
537- 0x00, 0x42, 0x7F, 0x40, 0x00,
538- 0x72, 0x49, 0x49, 0x49, 0x46,
539- 0x21, 0x41, 0x49, 0x4D, 0x33,
540- 0x18, 0x14, 0x12, 0x7F, 0x10,
541- 0x27, 0x45, 0x45, 0x45, 0x39,
542- 0x3C, 0x4A, 0x49, 0x49, 0x31,
543- 0x41, 0x21, 0x11, 0x09, 0x07,
544- 0x36, 0x49, 0x49, 0x49, 0x36,
545- 0x46, 0x49, 0x49, 0x29, 0x1E,
546- 0x00, 0x00, 0x14, 0x00, 0x00,
547- 0x00, 0x40, 0x34, 0x00, 0x00,
548- 0x00, 0x08, 0x14, 0x22, 0x41,
549- 0x14, 0x14, 0x14, 0x14, 0x14,
550- 0x00, 0x41, 0x22, 0x14, 0x08,
551- 0x02, 0x01, 0x59, 0x09, 0x06,
552- 0x3E, 0x41, 0x5D, 0x59, 0x4E,
553- 0x7C, 0x12, 0x11, 0x12, 0x7C,
554- 0x7F, 0x49, 0x49, 0x49, 0x36,
555- 0x3E, 0x41, 0x41, 0x41, 0x22,
556- 0x7F, 0x41, 0x41, 0x41, 0x3E,
557- 0x7F, 0x49, 0x49, 0x49, 0x41,
558- 0x7F, 0x09, 0x09, 0x09, 0x01,
559- 0x3E, 0x41, 0x41, 0x51, 0x73,
560- 0x7F, 0x08, 0x08, 0x08, 0x7F,
561- 0x00, 0x41, 0x7F, 0x41, 0x00,
562- 0x20, 0x40, 0x41, 0x3F, 0x01,
563- 0x7F, 0x08, 0x14, 0x22, 0x41,
564- 0x7F, 0x40, 0x40, 0x40, 0x40,
565- 0x7F, 0x02, 0x1C, 0x02, 0x7F,
566- 0x7F, 0x04, 0x08, 0x10, 0x7F,
567- 0x3E, 0x41, 0x41, 0x41, 0x3E,
568- 0x7F, 0x09, 0x09, 0x09, 0x06,
569diff --git a/drivers/avr/hd44780.c b/drivers/avr/hd44780.c
570index 51414d8f914359072cf07707f49553d562241be2..f71069dece74c94bb9daa333d75fb5b00a3fadd3 100644
571--- a/drivers/avr/hd44780.c
572+++ b/drivers/avr/hd44780.c
573@@ -3,7 +3,7 @@
574 Author: Peter Fleury <pfleury@gmx.ch> http://tinyurl.com/peterfleury
575 License: GNU General Public License Version 3
576 File: $Id: lcd.c,v 1.15.2.2 2015/01/17 12:16:05 peter Exp $
577- Software: AVR-GCC 3.3
578+ Software: AVR-GCC 3.3
579 Target: any AVR device, memory mapped mode only for AT90S4414/8515/Mega
580
581 DESCRIPTION
582@@ -13,15 +13,15 @@
583 changed lcd_init(), added additional constants for lcd_command(),
584 added 4-bit I/O mode, improved and optimized code.
585
586- Library can be operated in memory mapped mode (LCD_IO_MODE=0) or in
587+ Library can be operated in memory mapped mode (LCD_IO_MODE=0) or in
588 4-bit IO port mode (LCD_IO_MODE=1). 8-bit IO port mode not supported.
589-
590+
591 Memory mapped mode compatible with Kanda STK200, but supports also
592 generation of R/W signal through A8 address line.
593
594 USAGE
595 See the C include lcd.h file for a description of each function
596-
597+
598 *****************************************************************************/
599 #include <inttypes.h>
600 #include <avr/io.h>
601@@ -29,55 +29,54 @@
602 #include <util/delay.h>
603 #include "hd44780.h"
604
605-/*
606-** constants/macros
607+/*
608+** constants/macros
609 */
610-#define DDR(x) (*(&x - 1)) /* address of data direction register of port x */
611+#define DDR(x) (*(&x - 1)) /* address of data direction register of port x */
612 #if defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__)
613- /* on ATmega64/128 PINF is on port 0x00 and not 0x60 */
614- #define PIN(x) ( &PORTF==&(x) ? _SFR_IO8(0x00) : (*(&x - 2)) )
615+/* on ATmega64/128 PINF is on port 0x00 and not 0x60 */
616+# define PIN(x) (&PORTF == &(x) ? _SFR_IO8(0x00) : (*(&x - 2)))
617 #else
618- #define PIN(x) (*(&x - 2)) /* address of input register of port x */
619+# define PIN(x) (*(&x - 2)) /* address of input register of port x */
620 #endif
621
622-
623 #if LCD_IO_MODE
624-#define lcd_e_delay() _delay_us(LCD_DELAY_ENABLE_PULSE)
625-#define lcd_e_high() LCD_E_PORT |= _BV(LCD_E_PIN);
626-#define lcd_e_low() LCD_E_PORT &= ~_BV(LCD_E_PIN);
627-#define lcd_e_toggle() toggle_e()
628-#define lcd_rw_high() LCD_RW_PORT |= _BV(LCD_RW_PIN)
629-#define lcd_rw_low() LCD_RW_PORT &= ~_BV(LCD_RW_PIN)
630-#define lcd_rs_high() LCD_RS_PORT |= _BV(LCD_RS_PIN)
631-#define lcd_rs_low() LCD_RS_PORT &= ~_BV(LCD_RS_PIN)
632+# define lcd_e_delay() _delay_us(LCD_DELAY_ENABLE_PULSE)
633+# define lcd_e_high() LCD_E_PORT |= _BV(LCD_E_PIN);
634+# define lcd_e_low() LCD_E_PORT &= ~_BV(LCD_E_PIN);
635+# define lcd_e_toggle() toggle_e()
636+# define lcd_rw_high() LCD_RW_PORT |= _BV(LCD_RW_PIN)
637+# define lcd_rw_low() LCD_RW_PORT &= ~_BV(LCD_RW_PIN)
638+# define lcd_rs_high() LCD_RS_PORT |= _BV(LCD_RS_PIN)
639+# define lcd_rs_low() LCD_RS_PORT &= ~_BV(LCD_RS_PIN)
640 #endif
641
642 #if LCD_IO_MODE
643-#if LCD_LINES==1
644-#define LCD_FUNCTION_DEFAULT LCD_FUNCTION_4BIT_1LINE
645+# if LCD_LINES == 1
646+# define LCD_FUNCTION_DEFAULT LCD_FUNCTION_4BIT_1LINE
647+# else
648+# define LCD_FUNCTION_DEFAULT LCD_FUNCTION_4BIT_2LINES
649+# endif
650 #else
651-#define LCD_FUNCTION_DEFAULT LCD_FUNCTION_4BIT_2LINES
652-#endif
653-#else
654-#if LCD_LINES==1
655-#define LCD_FUNCTION_DEFAULT LCD_FUNCTION_8BIT_1LINE
656-#else
657-#define LCD_FUNCTION_DEFAULT LCD_FUNCTION_8BIT_2LINES
658-#endif
659+# if LCD_LINES == 1
660+# define LCD_FUNCTION_DEFAULT LCD_FUNCTION_8BIT_1LINE
661+# else
662+# define LCD_FUNCTION_DEFAULT LCD_FUNCTION_8BIT_2LINES
663+# endif
664 #endif
665
666 #if LCD_CONTROLLER_KS0073
667-#if LCD_LINES==4
668+# if LCD_LINES == 4
669
670-#define KS0073_EXTENDED_FUNCTION_REGISTER_ON 0x2C /* |0|010|1100 4-bit mode, extension-bit RE = 1 */
671-#define KS0073_EXTENDED_FUNCTION_REGISTER_OFF 0x28 /* |0|010|1000 4-bit mode, extension-bit RE = 0 */
672-#define KS0073_4LINES_MODE 0x09 /* |0|000|1001 4 lines mode */
673diff --git a/drivers/avr/hd44780.h b/drivers/avr/hd44780.h
674index 7421c8131f8d0ce4dc0c27322082f6175adfcdf0..e60817e9898d7b66ce09628ccaeac4f6ce6a0a47 100644
675--- a/drivers/avr/hd44780.h
676+++ b/drivers/avr/hd44780.h
677@@ -6,7 +6,7 @@
678 License: GNU General Public License Version 3
679 File: $Id: lcd.h,v 1.14.2.4 2015/01/20 17:16:07 peter Exp $
680 Software: AVR-GCC 4.x
681- Hardware: any AVR device, memory mapped mode only for AVR with
682+ Hardware: any AVR device, memory mapped mode only for AVR with
683 memory mapped interface (AT90S8515/ATmega8515/ATmega128)
684 ***************************************************************************/
685
686@@ -15,333 +15,315 @@
687 Collection of libraries for AVR-GCC
688 @author Peter Fleury pfleury@gmx.ch http://tinyurl.com/peterfleury
689 @copyright (C) 2015 Peter Fleury, GNU General Public License Version 3
690-
691+
692 @file
693 @defgroup pfleury_lcd LCD library <lcd.h>
694 @code #include <lcd.h> @endcode
695-
696+
697 @brief Basic routines for interfacing a HD44780U-based character LCD display
698
699- LCD character displays can be found in many devices, like espresso machines, laser printers.
700- The Hitachi HD44780 controller and its compatible controllers like Samsung KS0066U have become an industry standard for these types of displays.
701-
702+ LCD character displays can be found in many devices, like espresso machines, laser printers.
703+ The Hitachi HD44780 controller and its compatible controllers like Samsung KS0066U have become an industry standard for these types of displays.
704+
705 This library allows easy interfacing with a HD44780 compatible display and can be
706- operated in memory mapped mode (LCD_IO_MODE defined as 0 in the include file lcd.h.) or in
707+ operated in memory mapped mode (LCD_IO_MODE defined as 0 in the include file lcd.h.) or in
708 4-bit IO port mode (LCD_IO_MODE defined as 1). 8-bit IO port mode is not supported.
709
710 Memory mapped mode is compatible with old Kanda STK200 starter kit, but also supports
711 generation of R/W signal through A8 address line.
712
713 @see The chapter <a href=" http://homepage.hispeed.ch/peterfleury/avr-lcd44780.html" target="_blank">Interfacing a HD44780 Based LCD to an AVR</a>
714- on my home page, which shows example circuits how to connect an LCD to an AVR controller.
715+ on my home page, which shows example circuits how to connect an LCD to an AVR controller.
716
717 @author Peter Fleury pfleury@gmx.ch http://tinyurl.com/peterfleury
718-
719+
720 @version 2.0
721-
722+
723 @copyright (C) 2015 Peter Fleury, GNU General Public License Version 3
724-
725+
726 */
727
728 #include <inttypes.h>
729 #include <avr/pgmspace.h>
730
731 #if (__GNUC__ * 100 + __GNUC_MINOR__) < 405
732-#error "This library requires AVR-GCC 4.5 or later, update to newer AVR-GCC compiler !"
733+# error "This library requires AVR-GCC 4.5 or later, update to newer AVR-GCC compiler !"
734 #endif
735
736-
737 /**@{*/
738
739 /*
740- * LCD and target specific definitions below can be defined in a separate include file with name lcd_definitions.h instead modifying this file
741+ * LCD and target specific definitions below can be defined in a separate include file with name lcd_definitions.h instead modifying this file
742 * by adding -D_LCD_DEFINITIONS_FILE to the CDEFS section in the Makefile
743 * All definitions added to the file lcd_definitions.h will override the default definitions from lcd.h
744 */
745 #ifdef _LCD_DEFINITIONS_FILE
746-#include "lcd_definitions.h"
747+# include "lcd_definitions.h"
748 #endif
749
750-
751 /**
752 * @name Definition for LCD controller type
753 * Use 0 for HD44780 controller, change to 1 for displays with KS0073 controller.
754 */
755-#ifndef LCD_CONTROLLER_KS0073
756-#define LCD_CONTROLLER_KS0073 0 /**< Use 0 for HD44780 controller, 1 for KS0073 controller */
757+#ifndef LCD_CONTROLLER_KS0073
758+# define LCD_CONTROLLER_KS0073 0 /**< Use 0 for HD44780 controller, 1 for KS0073 controller */
759 #endif
760
761-/**
762- * @name Definitions for Display Size
763+/**
764+ * @name Definitions for Display Size
765 * Change these definitions to adapt setting to your display
766 *
767- * These definitions can be defined in a separate include file \b lcd_definitions.h instead modifying this file by
768+ * These definitions can be defined in a separate include file \b lcd_definitions.h instead modifying this file by
769 * adding -D_LCD_DEFINITIONS_FILE to the CDEFS section in the Makefile.
770 * All definitions added to the file lcd_definitions.h will override the default definitions from lcd.h
771 *
772 */
773 #ifndef LCD_LINES
774-#define LCD_LINES 2 /**< number of visible lines of the display */
775+# define LCD_LINES 2 /**< number of visible lines of the display */
776 #endif
777diff --git a/drivers/avr/i2c_master.c b/drivers/avr/i2c_master.c
778old mode 100755
779new mode 100644
780index 0acc246426460815776263780d0d2f960f36a6c8..52924437e020b940f8576a55ca7bf0af32e15617
781--- a/drivers/avr/i2c_master.c
782+++ b/drivers/avr/i2c_master.c
783@@ -25,200 +25,200 @@
784 #include "wait.h"
785
786 #ifndef F_SCL
787-# define F_SCL 400000UL // SCL frequency
788+# define F_SCL 400000UL // SCL frequency
789 #endif
790 #define Prescaler 1
791 #define TWBR_val ((((F_CPU / F_SCL) / Prescaler) - 16) / 2)
792
793 void i2c_init(void) {
794- TWSR = 0; /* no prescaler */
795- TWBR = (uint8_t)TWBR_val;
796+ TWSR = 0; /* no prescaler */
797+ TWBR = (uint8_t)TWBR_val;
798
799- #ifdef __AVR_ATmega32A__
800- // set pull-up resistors on I2C bus pins
801- PORTC |= 0b11;
802+#ifdef __AVR_ATmega32A__
803+ // set pull-up resistors on I2C bus pins
804+ PORTC |= 0b11;
805
806- // enable TWI (two-wire interface)
807- TWCR |= (1 << TWEN);
808+ // enable TWI (two-wire interface)
809+ TWCR |= (1 << TWEN);
810
811- // enable TWI interrupt and slave address ACK
812- TWCR |= (1 << TWIE);
813- TWCR |= (1 << TWEA);
814- #endif
815+ // enable TWI interrupt and slave address ACK
816+ TWCR |= (1 << TWIE);
817+ TWCR |= (1 << TWEA);
818+#endif
819 }
820
821 i2c_status_t i2c_start(uint8_t address, uint16_t timeout) {
822- // reset TWI control register
823- TWCR = 0;
824- // transmit START condition
825- TWCR = (1 << TWINT) | (1 << TWSTA) | (1 << TWEN);
826-
827- uint16_t timeout_timer = timer_read();
828- while (!(TWCR & (1 << TWINT))) {
829- if ((timeout != I2C_TIMEOUT_INFINITE) && ((timer_read() - timeout_timer) >= timeout)) {
830- return I2C_STATUS_TIMEOUT;
831- }
832- }
833-
834- // check if the start condition was successfully transmitted
835- if (((TW_STATUS & 0xF8) != TW_START) && ((TW_STATUS & 0xF8) != TW_REP_START)) {
836- return I2C_STATUS_ERROR;
837- }
838-
839- // load slave address into data register
840- TWDR = address;
841- // start transmission of address
842- TWCR = (1 << TWINT) | (1 << TWEN);
843-
844- timeout_timer = timer_read();
845- while (!(TWCR & (1 << TWINT))) {
846- if ((timeout != I2C_TIMEOUT_INFINITE) && ((timer_read() - timeout_timer) >= timeout)) {
847- return I2C_STATUS_TIMEOUT;
848- }
849- }
850-
851- // check if the device has acknowledged the READ / WRITE mode
852- uint8_t twst = TW_STATUS & 0xF8;
853- if ((twst != TW_MT_SLA_ACK) && (twst != TW_MR_SLA_ACK)) {
854- return I2C_STATUS_ERROR;
855- }
856-
857- return I2C_STATUS_SUCCESS;
858+ // reset TWI control register
859+ TWCR = 0;
860+ // transmit START condition
861+ TWCR = (1 << TWINT) | (1 << TWSTA) | (1 << TWEN);
862+
863+ uint16_t timeout_timer = timer_read();
864+ while (!(TWCR & (1 << TWINT))) {
865+ if ((timeout != I2C_TIMEOUT_INFINITE) && ((timer_read() - timeout_timer) >= timeout)) {
866+ return I2C_STATUS_TIMEOUT;
867+ }
868+ }
869+
870+ // check if the start condition was successfully transmitted
871+ if (((TW_STATUS & 0xF8) != TW_START) && ((TW_STATUS & 0xF8) != TW_REP_START)) {
872+ return I2C_STATUS_ERROR;
873+ }
874+
875+ // load slave address into data register
876+ TWDR = address;
877+ // start transmission of address
878+ TWCR = (1 << TWINT) | (1 << TWEN);
879+
880+ timeout_timer = timer_read();
881+ while (!(TWCR & (1 << TWINT))) {
882+ if ((timeout != I2C_TIMEOUT_INFINITE) && ((timer_read() - timeout_timer) >= timeout)) {
883diff --git a/drivers/avr/i2c_master.h b/drivers/avr/i2c_master.h
884old mode 100755
885new mode 100644
886index d68142430ae0de6439be5ab5c841eed3f383bd01..0a3b6c508cc596be4116ba11be25c5c4f2136485
887--- a/drivers/avr/i2c_master.h
888+++ b/drivers/avr/i2c_master.h
889@@ -26,21 +26,21 @@
890 typedef int16_t i2c_status_t;
891
892 #define I2C_STATUS_SUCCESS (0)
893-#define I2C_STATUS_ERROR (-1)
894+#define I2C_STATUS_ERROR (-1)
895 #define I2C_STATUS_TIMEOUT (-2)
896
897 #define I2C_TIMEOUT_IMMEDIATE (0)
898 #define I2C_TIMEOUT_INFINITE (0xFFFF)
899
900-void i2c_init(void);
901+void i2c_init(void);
902 i2c_status_t i2c_start(uint8_t address, uint16_t timeout);
903 i2c_status_t i2c_write(uint8_t data, uint16_t timeout);
904-int16_t i2c_read_ack(uint16_t timeout);
905-int16_t i2c_read_nack(uint16_t timeout);
906+int16_t i2c_read_ack(uint16_t timeout);
907+int16_t i2c_read_nack(uint16_t timeout);
908 i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout);
909 i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout);
910 i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout);
911 i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout);
912-void i2c_stop(void);
913+void i2c_stop(void);
914
915-#endif // I2C_MASTER_H
916+#endif // I2C_MASTER_H
917diff --git a/drivers/avr/i2c_slave.c b/drivers/avr/i2c_slave.c
918old mode 100755
919new mode 100644
920index 4958a0f8e5a7e77a781ed1f86d92a6a262f4bd45..3fb684f70ac17dd0625e5811d01edbd60d81e240
921--- a/drivers/avr/i2c_slave.c
922+++ b/drivers/avr/i2c_slave.c
923@@ -27,24 +27,24 @@
924 volatile uint8_t i2c_slave_reg[I2C_SLAVE_REG_COUNT];
925
926 static volatile uint8_t buffer_address;
927-static volatile bool slave_has_register_set = false;
928+static volatile bool slave_has_register_set = false;
929
930-void i2c_slave_init(uint8_t address){
931+void i2c_slave_init(uint8_t address) {
932 // load address into TWI address register
933 TWAR = address;
934 // set the TWCR to enable address matching and enable TWI, clear TWINT, enable TWI interrupt
935 TWCR = (1 << TWIE) | (1 << TWEA) | (1 << TWINT) | (1 << TWEN);
936 }
937
938-void i2c_slave_stop(void){
939+void i2c_slave_stop(void) {
940 // clear acknowledge and enable bits
941 TWCR &= ~((1 << TWEA) | (1 << TWEN));
942 }
943
944-ISR(TWI_vect){
945+ISR(TWI_vect) {
946 uint8_t ack = 1;
947
948- switch(TW_STATUS){
949+ switch (TW_STATUS) {
950 case TW_SR_SLA_ACK:
951 // The device is now a slave receiver
952 slave_has_register_set = false;
953@@ -53,14 +53,14 @@ ISR(TWI_vect){
954 case TW_SR_DATA_ACK:
955 // This device is a slave receiver and has received data
956 // First byte is the location then the bytes will be writen in buffer with auto-incriment
957- if(!slave_has_register_set){
958+ if (!slave_has_register_set) {
959 buffer_address = TWDR;
960
961 if (buffer_address >= I2C_SLAVE_REG_COUNT) { // address out of bounds dont ack
962- ack = 0;
963- buffer_address = 0;
964+ ack = 0;
965+ buffer_address = 0;
966 }
967- slave_has_register_set = true; // address has been receaved now fill in buffer
968+ slave_has_register_set = true; // address has been receaved now fill in buffer
969 } else {
970 i2c_slave_reg[buffer_address] = TWDR;
971 buffer_address++;
972diff --git a/drivers/avr/i2c_slave.h b/drivers/avr/i2c_slave.h
973old mode 100755
974new mode 100644
975index 2f4589e9c7b32fcc45278f80f481e0bcb2d0f888..5ed0b11a8e2731e548a88e6b44a076b88cdd4884
976--- a/drivers/avr/i2c_slave.h
977+++ b/drivers/avr/i2c_slave.h
978@@ -30,4 +30,4 @@ extern volatile uint8_t i2c_slave_reg[I2C_SLAVE_REG_COUNT];
979 void i2c_slave_init(uint8_t address);
980 void i2c_slave_stop(void);
981
982-#endif // I2C_SLAVE_H
983+#endif // I2C_SLAVE_H
984diff --git a/drivers/avr/pro_micro.h b/drivers/avr/pro_micro.h
985index f9e7ed75d9d5b6e878d4b279d5f23a5771329412..762a99a058aa868098a83669b104d46a0faecf48 100644
986--- a/drivers/avr/pro_micro.h
987+++ b/drivers/avr/pro_micro.h
988@@ -90,14 +90,14 @@
989 #undef OCR2_6
990 #undef OCR2_7
991
992-#define NUM_DIGITAL_PINS 30
993+#define NUM_DIGITAL_PINS 30
994 #define NUM_ANALOG_INPUTS 12
995
996-#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0)
997-#define TXLED0 PORTD |= (1<<5)
998-#define TXLED1 PORTD &= ~(1<<5)
999-#define RXLED0 PORTB |= (1<<0)
1000-#define RXLED1 PORTB &= ~(1<<0)
1001+#define TX_RX_LED_INIT DDRD |= (1 << 5), DDRB |= (1 << 0)
1002+#define TXLED0 PORTD |= (1 << 5)
1003+#define TXLED1 PORTD &= ~(1 << 5)
1004+#define RXLED0 PORTB |= (1 << 0)
1005+#define RXLED1 PORTB &= ~(1 << 0)
1006
1007 static const uint8_t SDA = 2;
1008 static const uint8_t SCL = 3;
1009@@ -111,27 +111,27 @@ static const uint8_t SCK = 15;
1010
1011 // Mapping of analog pins as digital I/O
1012 // A6-A11 share with digital pins
1013-static const uint8_t ADC0 = 18;
1014-static const uint8_t ADC1 = 19;
1015-static const uint8_t ADC2 = 20;
1016-static const uint8_t ADC3 = 21;
1017-static const uint8_t ADC4 = 22;
1018-static const uint8_t ADC5 = 23;
1019-static const uint8_t ADC6 = 24; // D4
1020-static const uint8_t ADC7 = 25; // D6
1021-static const uint8_t ADC8 = 26; // D8
1022-static const uint8_t ADC9 = 27; // D9
1023+static const uint8_t ADC0 = 18;
1024+static const uint8_t ADC1 = 19;
1025+static const uint8_t ADC2 = 20;
1026+static const uint8_t ADC3 = 21;
1027+static const uint8_t ADC4 = 22;
1028+static const uint8_t ADC5 = 23;
1029+static const uint8_t ADC6 = 24; // D4
1030+static const uint8_t ADC7 = 25; // D6
1031+static const uint8_t ADC8 = 26; // D8
1032+static const uint8_t ADC9 = 27; // D9
1033 static const uint8_t ADC10 = 28; // D10
1034 static const uint8_t ADC11 = 29; // D12
1035
1036-#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0))
1037+#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0))
1038 #define digitalPinToPCICRbit(p) 0
1039-#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0))
1040-#define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4))))))
1041+#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0))
1042+#define digitalPinToPCMSKbit(p) (((p) >= 8 && (p) <= 11) ? (p)-4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4))))))
1043
1044 // __AVR_ATmega32U4__ has an unusual mapping of pins to channels
1045 extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
1046-#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) )
1047+#define analogPinToChannel(P) (pgm_read_byte(analog_pin_to_channel_PGM + (P)))
1048
1049 #define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT)))))
1050
1051@@ -182,159 +182,121 @@ extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
1052 // appropriate addresses for various functions (e.g. reading
1053 // and writing)
1054 const uint16_t PROGMEM port_to_mode_PGM[] = {
1055- NOT_A_PORT,
1056- NOT_A_PORT,
1057- (uint16_t) &DDRB,
1058- (uint16_t) &DDRC,
1059- (uint16_t) &DDRD,
1060- (uint16_t) &DDRE,
1061- (uint16_t) &DDRF,
1062+ NOT_A_PORT, NOT_A_PORT, (uint16_t)&DDRB, (uint16_t)&DDRC, (uint16_t)&DDRD, (uint16_t)&DDRE, (uint16_t)&DDRF,
1063 };
1064
1065 const uint16_t PROGMEM port_to_output_PGM[] = {
1066- NOT_A_PORT,
1067- NOT_A_PORT,
1068- (uint16_t) &PORTB,
1069- (uint16_t) &PORTC,
1070- (uint16_t) &PORTD,
1071- (uint16_t) &PORTE,
1072- (uint16_t) &PORTF,
1073+ NOT_A_PORT, NOT_A_PORT, (uint16_t)&PORTB, (uint16_t)&PORTC, (uint16_t)&PORTD, (uint16_t)&PORTE, (uint16_t)&PORTF,
1074 };
1075
1076 const uint16_t PROGMEM port_to_input_PGM[] = {
1077- NOT_A_PORT,
1078- NOT_A_PORT,
1079- (uint16_t) &PINB,
1080- (uint16_t) &PINC,
1081- (uint16_t) &PIND,
1082- (uint16_t) &PINE,
1083- (uint16_t) &PINF,
1084+ NOT_A_PORT, NOT_A_PORT, (uint16_t)&PINB, (uint16_t)&PINC, (uint16_t)&PIND, (uint16_t)&PINE, (uint16_t)&PINF,
1085 };
1086
1087 const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
1088diff --git a/drivers/avr/ssd1306.c b/drivers/avr/ssd1306.c
1089index bb8938bba3a5e1d7f61745ad1e0cd5e16f5e9cfc..61d7a99531133deb4cb6aaa0931c85652cdf9f9b 100644
1090--- a/drivers/avr/ssd1306.c
1091+++ b/drivers/avr/ssd1306.c
1092@@ -1,325 +1,320 @@
1093 #ifdef SSD1306OLED
1094
1095-#include "ssd1306.h"
1096-#include "i2c.h"
1097-#include <string.h>
1098-#include "print.h"
1099-#include "glcdfont.c"
1100-#ifdef ADAFRUIT_BLE_ENABLE
1101-#include "adafruit_ble.h"
1102-#endif
1103-#ifdef PROTOCOL_LUFA
1104-#include "lufa.h"
1105-#endif
1106-#include "sendchar.h"
1107-#include "timer.h"
1108+# include "ssd1306.h"
1109+# include "i2c.h"
1110+# include <string.h>
1111+# include "print.h"
1112+# include "glcdfont.c"
1113+# ifdef ADAFRUIT_BLE_ENABLE
1114+# include "adafruit_ble.h"
1115+# endif
1116+# ifdef PROTOCOL_LUFA
1117+# include "lufa.h"
1118+# endif
1119+# include "sendchar.h"
1120+# include "timer.h"
1121
1122 // Set this to 1 to help diagnose early startup problems
1123 // when testing power-on with ble. Turn it off otherwise,
1124 // as the latency of printing most of the debug info messes
1125 // with the matrix scan, causing keys to drop.
1126-#define DEBUG_TO_SCREEN 0
1127+# define DEBUG_TO_SCREEN 0
1128
1129-//static uint16_t last_battery_update;
1130-//static uint32_t vbat;
1131+// static uint16_t last_battery_update;
1132+// static uint32_t vbat;
1133 //#define BatteryUpdateInterval 10000 /* milliseconds */
1134-#define ScreenOffInterval 300000 /* milliseconds */
1135-#if DEBUG_TO_SCREEN
1136+# define ScreenOffInterval 300000 /* milliseconds */
1137+# if DEBUG_TO_SCREEN
1138 static uint8_t displaying;
1139-#endif
1140+# endif
1141 static uint16_t last_flush;
1142
1143 // Write command sequence.
1144 // Returns true on success.
1145 static inline bool _send_cmd1(uint8_t cmd) {
1146- bool res = false;
1147+ bool res = false;
1148
1149- if (i2c_start_write(SSD1306_ADDRESS)) {
1150- xprintf("failed to start write to %d\n", SSD1306_ADDRESS);
1151- goto done;
1152- }
1153+ if (i2c_start_write(SSD1306_ADDRESS)) {
1154+ xprintf("failed to start write to %d\n", SSD1306_ADDRESS);
1155+ goto done;
1156+ }
1157
1158- if (i2c_master_write(0x0 /* command byte follows */)) {
1159- print("failed to write control byte\n");
1160+ if (i2c_master_write(0x0 /* command byte follows */)) {
1161+ print("failed to write control byte\n");
1162
1163- goto done;
1164- }
1165+ goto done;
1166+ }
1167
1168- if (i2c_master_write(cmd)) {
1169- xprintf("failed to write command %d\n", cmd);
1170- goto done;
1171- }
1172- res = true;
1173+ if (i2c_master_write(cmd)) {
1174+ xprintf("failed to write command %d\n", cmd);
1175+ goto done;
1176+ }
1177+ res = true;
1178 done:
1179- i2c_master_stop();
1180- return res;
1181+ i2c_master_stop();
1182+ return res;
1183 }
1184
1185 // Write 2-byte command sequence.
1186 // Returns true on success
1187 static inline bool _send_cmd2(uint8_t cmd, uint8_t opr) {
1188- if (!_send_cmd1(cmd)) {
1189- return false;
1190- }
1191- return _send_cmd1(opr);
1192diff --git a/drivers/avr/ssd1306.h b/drivers/avr/ssd1306.h
1193index df6a75359febc12d07f305e5ef8255c982088d71..825b0d7d5b6722dc3fc143089c378783e09238b7 100644
1194--- a/drivers/avr/ssd1306.h
1195+++ b/drivers/avr/ssd1306.h
1196@@ -7,49 +7,49 @@
1197 #include "config.h"
1198
1199 enum ssd1306_cmds {
1200- DisplayOff = 0xAE,
1201- DisplayOn = 0xAF,
1202-
1203- SetContrast = 0x81,
1204- DisplayAllOnResume = 0xA4,
1205-
1206- DisplayAllOn = 0xA5,
1207- NormalDisplay = 0xA6,
1208- InvertDisplay = 0xA7,
1209- SetDisplayOffset = 0xD3,
1210- SetComPins = 0xda,
1211- SetVComDetect = 0xdb,
1212- SetDisplayClockDiv = 0xD5,
1213- SetPreCharge = 0xd9,
1214- SetMultiPlex = 0xa8,
1215- SetLowColumn = 0x00,
1216- SetHighColumn = 0x10,
1217- SetStartLine = 0x40,
1218-
1219- SetMemoryMode = 0x20,
1220- ColumnAddr = 0x21,
1221- PageAddr = 0x22,
1222-
1223- ComScanInc = 0xc0,
1224- ComScanDec = 0xc8,
1225- SegRemap = 0xa0,
1226- SetChargePump = 0x8d,
1227- ExternalVcc = 0x01,
1228- SwitchCapVcc = 0x02,
1229-
1230- ActivateScroll = 0x2f,
1231- DeActivateScroll = 0x2e,
1232- SetVerticalScrollArea = 0xa3,
1233- RightHorizontalScroll = 0x26,
1234- LeftHorizontalScroll = 0x27,
1235- VerticalAndRightHorizontalScroll = 0x29,
1236- VerticalAndLeftHorizontalScroll = 0x2a,
1237+ DisplayOff = 0xAE,
1238+ DisplayOn = 0xAF,
1239+
1240+ SetContrast = 0x81,
1241+ DisplayAllOnResume = 0xA4,
1242+
1243+ DisplayAllOn = 0xA5,
1244+ NormalDisplay = 0xA6,
1245+ InvertDisplay = 0xA7,
1246+ SetDisplayOffset = 0xD3,
1247+ SetComPins = 0xda,
1248+ SetVComDetect = 0xdb,
1249+ SetDisplayClockDiv = 0xD5,
1250+ SetPreCharge = 0xd9,
1251+ SetMultiPlex = 0xa8,
1252+ SetLowColumn = 0x00,
1253+ SetHighColumn = 0x10,
1254+ SetStartLine = 0x40,
1255+
1256+ SetMemoryMode = 0x20,
1257+ ColumnAddr = 0x21,
1258+ PageAddr = 0x22,
1259+
1260+ ComScanInc = 0xc0,
1261+ ComScanDec = 0xc8,
1262+ SegRemap = 0xa0,
1263+ SetChargePump = 0x8d,
1264+ ExternalVcc = 0x01,
1265+ SwitchCapVcc = 0x02,
1266+
1267+ ActivateScroll = 0x2f,
1268+ DeActivateScroll = 0x2e,
1269+ SetVerticalScrollArea = 0xa3,
1270+ RightHorizontalScroll = 0x26,
1271+ LeftHorizontalScroll = 0x27,
1272+ VerticalAndRightHorizontalScroll = 0x29,
1273+ VerticalAndLeftHorizontalScroll = 0x2a,
1274 };
1275
1276 // Controls the SSD1306 128x32 OLED display via i2c
1277
1278 #ifndef SSD1306_ADDRESS
1279-#define SSD1306_ADDRESS 0x3C
1280+# define SSD1306_ADDRESS 0x3C
1281 #endif
1282
1283 #define DisplayHeight 32
1284@@ -62,9 +62,9 @@ enum ssd1306_cmds {
1285 #define MatrixCols (DisplayWidth / FontWidth)
1286
1287 struct CharacterMatrix {
1288- uint8_t display[MatrixRows][MatrixCols];
1289- uint8_t *cursor;
1290- bool dirty;
1291+ uint8_t display[MatrixRows][MatrixCols];
1292+ uint8_t *cursor;
1293+ bool dirty;
1294 };
1295
1296diff --git a/drivers/avr/ws2812.c b/drivers/avr/ws2812.c
1297index 7c3cb5174df0a86af17a4fb2a70b856c06bc344b..0a02c6f7fd85fa5b2ee65a9462cda941fd106e5f 100644
1298--- a/drivers/avr/ws2812.c
1299+++ b/drivers/avr/ws2812.c
1300@@ -1,25 +1,25 @@
1301 /*
1302-* light weight WS2812 lib V2.0b
1303-*
1304-* Controls WS2811/WS2812/WS2812B RGB-LEDs
1305-* Author: Tim (cpldcpu@gmail.com)
1306-*
1307-* Jan 18th, 2014 v2.0b Initial Version
1308-* Nov 29th, 2015 v2.3 Added SK6812RGBW support
1309-*
1310-* This program is free software: you can redistribute it and/or modify
1311-* it under the terms of the GNU General Public License as published by
1312-* the Free Software Foundation, either version 2 of the License, or
1313-* (at your option) any later version.
1314-*
1315-* This program is distributed in the hope that it will be useful,
1316-* but WITHOUT ANY WARRANTY; without even the implied warranty of
1317-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1318-* GNU General Public License for more details.
1319-*
1320-* You should have received a copy of the GNU General Public License
1321-* along with this program. If not, see <http://www.gnu.org/licenses/>.
1322-*/
1323+ * light weight WS2812 lib V2.0b
1324+ *
1325+ * Controls WS2811/WS2812/WS2812B RGB-LEDs
1326+ * Author: Tim (cpldcpu@gmail.com)
1327+ *
1328+ * Jan 18th, 2014 v2.0b Initial Version
1329+ * Nov 29th, 2015 v2.3 Added SK6812RGBW support
1330+ *
1331+ * This program is free software: you can redistribute it and/or modify
1332+ * it under the terms of the GNU General Public License as published by
1333+ * the Free Software Foundation, either version 2 of the License, or
1334+ * (at your option) any later version.
1335+ *
1336+ * This program is distributed in the hope that it will be useful,
1337+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1338+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1339+ * GNU General Public License for more details.
1340+ *
1341+ * You should have received a copy of the GNU General Public License
1342+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1343+ */
1344
1345 #include "ws2812.h"
1346 #include <avr/interrupt.h>
1347@@ -30,44 +30,40 @@
1348 #if !defined(LED_ARRAY) && defined(RGB_MATRIX_ENABLE)
1349 // LED color buffer
1350 LED_TYPE led[DRIVER_LED_TOTAL];
1351- #define LED_ARRAY led
1352+# define LED_ARRAY led
1353 #endif
1354
1355 #ifdef RGBW_BB_TWI
1356
1357 // Port for the I2C
1358-#define I2C_DDR DDRD
1359-#define I2C_PIN PIND
1360-#define I2C_PORT PORTD
1361+# define I2C_DDR DDRD
1362+# define I2C_PIN PIND
1363+# define I2C_PORT PORTD
1364
1365 // Pins to be used in the bit banging
1366-#define I2C_CLK 0
1367-#define I2C_DAT 1
1368-
1369-#define I2C_DATA_HI()\
1370-I2C_DDR &= ~ (1 << I2C_DAT);\
1371-I2C_PORT |= (1 << I2C_DAT);
1372-#define I2C_DATA_LO()\
1373-I2C_DDR |= (1 << I2C_DAT);\
1374-I2C_PORT &= ~ (1 << I2C_DAT);
1375-
1376-#define I2C_CLOCK_HI()\
1377-I2C_DDR &= ~ (1 << I2C_CLK);\
1378-I2C_PORT |= (1 << I2C_CLK);
1379-#define I2C_CLOCK_LO()\
1380-I2C_DDR |= (1 << I2C_CLK);\
1381-I2C_PORT &= ~ (1 << I2C_CLK);
1382-
1383-#define I2C_DELAY 1
1384-
1385-void I2C_WriteBit(unsigned char c)
1386-{
1387- if (c > 0)
1388- {
1389+# define I2C_CLK 0
1390+# define I2C_DAT 1
1391+
1392+# define I2C_DATA_HI() \
1393+ I2C_DDR &= ~(1 << I2C_DAT); \
1394+ I2C_PORT |= (1 << I2C_DAT);
1395+# define I2C_DATA_LO() \
1396+ I2C_DDR |= (1 << I2C_DAT); \
1397+ I2C_PORT &= ~(1 << I2C_DAT);
1398+
1399+# define I2C_CLOCK_HI() \
1400diff --git a/drivers/avr/ws2812.h b/drivers/avr/ws2812.h
1401index 95f540b1849bf93de4ebd674f54d8d30a13fa5dc..a9dd897185358e4613862f30f2856963e52fd173 100644
1402--- a/drivers/avr/ws2812.h
1403+++ b/drivers/avr/ws2812.h
1404@@ -43,12 +43,12 @@
1405 * - Wait 50�s to reset the LEDs
1406 */
1407 #ifdef RGB_MATRIX_ENABLE
1408-void ws2812_setled (int index, uint8_t r, uint8_t g, uint8_t b);
1409-void ws2812_setled_all (uint8_t r, uint8_t g, uint8_t b);
1410+void ws2812_setled(int index, uint8_t r, uint8_t g, uint8_t b);
1411+void ws2812_setled_all(uint8_t r, uint8_t g, uint8_t b);
1412 #endif
1413
1414-void ws2812_setleds (LED_TYPE *ledarray, uint16_t number_of_leds);
1415-void ws2812_setleds_pin (LED_TYPE *ledarray, uint16_t number_of_leds,uint8_t pinmask);
1416+void ws2812_setleds(LED_TYPE *ledarray, uint16_t number_of_leds);
1417+void ws2812_setleds_pin(LED_TYPE *ledarray, uint16_t number_of_leds, uint8_t pinmask);
1418 void ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds);
1419
1420 /*
1421@@ -58,18 +58,17 @@ void ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds);
1422 * The length is the number of bytes to send - three per LED.
1423 */
1424
1425-void ws2812_sendarray (uint8_t *array,uint16_t length);
1426-void ws2812_sendarray_mask(uint8_t *array,uint16_t length, uint8_t pinmask);
1427-
1428+void ws2812_sendarray(uint8_t *array, uint16_t length);
1429+void ws2812_sendarray_mask(uint8_t *array, uint16_t length, uint8_t pinmask);
1430
1431 /*
1432 * Internal defines
1433 */
1434 #ifndef CONCAT
1435-#define CONCAT(a, b) a ## b
1436+# define CONCAT(a, b) a##b
1437 #endif
1438 #ifndef CONCAT_EXP
1439-#define CONCAT_EXP(a, b) CONCAT(a, b)
1440+# define CONCAT_EXP(a, b) CONCAT(a, b)
1441 #endif
1442
1443 #endif /* LIGHT_WS2812_H_ */
1444diff --git a/drivers/boards/GENERIC_STM32_F303XC/board.c b/drivers/boards/GENERIC_STM32_F303XC/board.c
1445index 4331155df4b6e436053089433e8308b7bbdcd285..60c191d9b1d253387dfa39f6226567378f725ca6 100644
1446--- a/drivers/boards/GENERIC_STM32_F303XC/board.c
1447+++ b/drivers/boards/GENERIC_STM32_F303XC/board.c
1448@@ -23,42 +23,33 @@
1449 * This variable is used by the HAL when initializing the PAL driver.
1450 */
1451 const PALConfig pal_default_config = {
1452-#if STM32_HAS_GPIOA
1453- {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
1454- VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
1455-#endif
1456-#if STM32_HAS_GPIOB
1457- {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR,
1458- VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH},
1459-#endif
1460-#if STM32_HAS_GPIOC
1461- {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR,
1462- VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH},
1463-#endif
1464-#if STM32_HAS_GPIOD
1465- {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR,
1466- VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH},
1467-#endif
1468-#if STM32_HAS_GPIOE
1469- {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR,
1470- VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH},
1471-#endif
1472-#if STM32_HAS_GPIOF
1473- {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR,
1474- VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH},
1475-#endif
1476-#if STM32_HAS_GPIOG
1477- {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR,
1478- VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH},
1479-#endif
1480-#if STM32_HAS_GPIOH
1481- {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR,
1482- VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH},
1483-#endif
1484-#if STM32_HAS_GPIOI
1485- {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
1486- VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH}
1487-#endif
1488+# if STM32_HAS_GPIOA
1489+ {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
1490+# endif
1491+# if STM32_HAS_GPIOB
1492+ {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH},
1493+# endif
1494+# if STM32_HAS_GPIOC
1495+ {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH},
1496+# endif
1497+# if STM32_HAS_GPIOD
1498+ {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH},
1499+# endif
1500+# if STM32_HAS_GPIOE
1501+ {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH},
1502+# endif
1503+# if STM32_HAS_GPIOF
1504+ {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH},
1505+# endif
1506+# if STM32_HAS_GPIOG
1507+ {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR, VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH},
1508+# endif
1509+# if STM32_HAS_GPIOH
1510+ {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH},
1511+# endif
1512+# if STM32_HAS_GPIOI
1513+ {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH}
1514+# endif
1515 };
1516 #endif
1517
1518@@ -70,8 +61,8 @@ void enter_bootloader_mode_if_requested(void);
1519 * and before any other initialization.
1520 */
1521 void __early_init(void) {
1522- enter_bootloader_mode_if_requested();
1523- stm32_clock_init();
1524+ enter_bootloader_mode_if_requested();
1525+ stm32_clock_init();
1526 }
1527
1528 #if HAL_USE_SDC || defined(__DOXYGEN__)
1529@@ -79,20 +70,18 @@ void __early_init(void) {
1530 * @brief SDC card detection.
1531 */
1532 bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
1533-
1534- (void)sdcp;
1535- /* TODO: Fill the implementation.*/
1536- return true;
1537+ (void)sdcp;
1538+ /* TODO: Fill the implementation.*/
1539+ return true;
1540 }
1541
1542 /**
1543 * @brief SDC card write protection detection.
1544 */
1545 bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
1546-
1547- (void)sdcp;
1548diff --git a/drivers/boards/GENERIC_STM32_F303XC/board.h b/drivers/boards/GENERIC_STM32_F303XC/board.h
1549index 11120dfd74637dd95443ed79e1e95c0510e36b87..3579c82770ecd3b17b5545ba5e658c9640e860aa 100644
1550--- a/drivers/boards/GENERIC_STM32_F303XC/board.h
1551+++ b/drivers/boards/GENERIC_STM32_F303XC/board.h
1552@@ -25,20 +25,20 @@
1553 * Board identifier.
1554 */
1555 #define BOARD_GENERIC_STM32_F303XC
1556-#define BOARD_NAME "STM32_F303"
1557+#define BOARD_NAME "STM32_F303"
1558
1559 /*
1560 * Board oscillators-related settings.
1561 * NOTE: LSE not fitted.
1562 */
1563 #if !defined(STM32_LSECLK)
1564-#define STM32_LSECLK 0U
1565+# define STM32_LSECLK 0U
1566 #endif
1567
1568-#define STM32_LSEDRV (3U << 3U)
1569+#define STM32_LSEDRV (3U << 3U)
1570
1571 #if !defined(STM32_HSECLK)
1572-#define STM32_HSECLK 8000000U
1573+# define STM32_HSECLK 8000000U
1574 #endif
1575
1576 // #define STM32_HSE_BYPASS
1577@@ -51,178 +51,177 @@
1578 /*
1579 * IO pins assignments.
1580 */
1581-#define GPIOA_PIN0 0U
1582-#define GPIOA_PIN1 1U
1583-#define GPIOA_PIN2 2U
1584-#define GPIOA_PIN3 3U
1585-#define GPIOA_PIN4 4U
1586-#define GPIOA_PIN5 5U
1587-#define GPIOA_PIN6 6U
1588-#define GPIOA_PIN7 7U
1589-#define GPIOA_PIN8 8U
1590-#define GPIOA_PIN9 9U
1591-#define GPIOA_PIN10 10U
1592-#define GPIOA_USB_DM 11U
1593-#define GPIOA_USB_DP 12U
1594-#define GPIOA_SWDIO 13U
1595-#define GPIOA_SWCLK 14U
1596-#define GPIOA_PIN15 15U
1597-
1598-#define GPIOB_PIN0 0U
1599-#define GPIOB_PIN1 1U
1600-#define GPIOB_PIN2 2U
1601-#define GPIOB_PIN3 3U
1602-#define GPIOB_PIN4 4U
1603-#define GPIOB_PIN5 5U
1604-#define GPIOB_PIN6 6U
1605-#define GPIOB_PIN7 7U
1606-#define GPIOB_PIN8 8U
1607-#define GPIOB_PIN9 9U
1608-#define GPIOB_PIN10 10U
1609-#define GPIOB_PIN11 11U
1610-#define GPIOB_PIN12 12U
1611-#define GPIOB_PIN13 13U
1612-#define GPIOB_PIN14 14U
1613-#define GPIOB_PIN15 15U
1614-
1615-#define GPIOC_PIN0 0U
1616-#define GPIOC_PIN1 1U
1617-#define GPIOC_PIN2 2U
1618-#define GPIOC_PIN3 3U
1619-#define GPIOC_PIN4 4U
1620-#define GPIOC_PIN5 5U
1621-#define GPIOC_PIN6 6U
1622-#define GPIOC_PIN7 7U
1623-#define GPIOC_PIN8 8U
1624-#define GPIOC_PIN9 9U
1625-#define GPIOC_PIN10 10U
1626-#define GPIOC_PIN11 11U
1627-#define GPIOC_PIN12 12U
1628-#define GPIOC_PIN13 13U
1629-#define GPIOC_PIN14 14U
1630-#define GPIOC_PIN15 15U
1631-
1632-#define GPIOD_PIN0 0U
1633-#define GPIOD_PIN1 1U
1634-#define GPIOD_PIN2 2U
1635-#define GPIOD_PIN3 3U
1636-#define GPIOD_PIN4 4U
1637-#define GPIOD_PIN5 5U
1638-#define GPIOD_PIN6 6U
1639-#define GPIOD_PIN7 7U
1640-#define GPIOD_PIN8 8U
1641-#define GPIOD_PIN9 9U
1642-#define GPIOD_PIN10 10U
1643-#define GPIOD_PIN11 11U
1644-#define GPIOD_PIN12 12U
1645-#define GPIOD_PIN13 13U
1646-#define GPIOD_PIN14 14U
1647-#define GPIOD_PIN15 15U
1648-
1649-#define GPIOE_PIN0 0U
1650-#define GPIOE_PIN1 1U
1651-#define GPIOE_PIN2 2U
1652diff --git a/drivers/boards/IC_TEENSY_3_1/board.c b/drivers/boards/IC_TEENSY_3_1/board.c
1653index 1e952883d87d5c59c4353616f54e94504eef1336..63e3f64929da987b0c6b5e8e3565c80bbfbee105 100644
1654--- a/drivers/boards/IC_TEENSY_3_1/board.c
1655+++ b/drivers/boards/IC_TEENSY_3_1/board.c
1656@@ -21,154 +21,109 @@
1657 * @details Digital I/O ports static configuration as defined in @p board.h.
1658 * This variable is used by the HAL when initializing the PAL driver.
1659 */
1660-const PALConfig pal_default_config =
1661-{
1662- .ports = {
1663+const PALConfig pal_default_config = {
1664+ .ports =
1665 {
1666- /*
1667- * PORTA setup.
1668- *
1669- * PTA4 - PIN33
1670- * PTA5 - PIN24
1671- * PTA12 - PIN3
1672- * PTA13 - PIN4
1673- *
1674- * PTA18/19 crystal
1675- * PTA0/3 SWD
1676- */
1677- .port = IOPORT1,
1678- .pads = {
1679- PAL_MODE_ALTERNATIVE_7, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
1680- PAL_MODE_ALTERNATIVE_7, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL,
1681- PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
1682- PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
1683- PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED,
1684- PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
1685- PAL_MODE_INPUT_ANALOG, PAL_MODE_INPUT_ANALOG, PAL_MODE_UNCONNECTED,
1686- PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
1687- PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
1688- PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
1689- PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
1690+ {
1691+ /*
1692+ * PORTA setup.
1693+ *
1694+ * PTA4 - PIN33
1695+ * PTA5 - PIN24
1696+ * PTA12 - PIN3
1697+ * PTA13 - PIN4
1698+ *
1699+ * PTA18/19 crystal
1700+ * PTA0/3 SWD
1701+ */
1702+ .port = IOPORT1,
1703+ .pads =
1704+ {
1705diff --git a/drivers/boards/IC_TEENSY_3_1/board.h b/drivers/boards/IC_TEENSY_3_1/board.h
1706index 8853395efe84b62961ef159484c24480d4d558af..c8259ab0c7bf390ffd4e183cd06cb91e956619f5 100644
1707--- a/drivers/boards/IC_TEENSY_3_1/board.h
1708+++ b/drivers/boards/IC_TEENSY_3_1/board.h
1709@@ -25,13 +25,13 @@
1710 * Board identifier.
1711 */
1712 #define BOARD_PJRC_TEENSY_3_1
1713-#define BOARD_NAME "PJRC Teensy 3.1"
1714+#define BOARD_NAME "PJRC Teensy 3.1"
1715
1716 /* External 16 MHz crystal */
1717-#define KINETIS_XTAL_FREQUENCY 16000000UL
1718+#define KINETIS_XTAL_FREQUENCY 16000000UL
1719
1720 /* Use internal capacitors for the crystal */
1721-#define KINETIS_BOARD_OSCILLATOR_SETTING OSC_CR_SC8P|OSC_CR_SC2P
1722+#define KINETIS_BOARD_OSCILLATOR_SETTING OSC_CR_SC8P | OSC_CR_SC2P
1723
1724 /*
1725 * MCU type
1726@@ -41,79 +41,79 @@
1727 /*
1728 * IO pins assignments.
1729 */
1730-#define PORTA_PIN0 0
1731-#define PORTA_PIN1 1
1732-#define PORTA_PIN2 2
1733-#define PORTA_PIN3 3
1734-#define TEENSY_PIN33 4
1735-#define TEENSY_PIN24 5
1736-#define PORTA_PIN6 6
1737-#define PORTA_PIN7 7
1738-#define PORTA_PIN8 8
1739-#define PORTA_PIN9 9
1740-#define PORTA_PIN10 10
1741-#define PORTA_PIN11 11
1742-#define TEENSY_PIN3 12
1743-#define TEENSY_PIN4 13
1744-#define PORTA_PIN14 14
1745-#define PORTA_PIN15 15
1746-#define PORTA_PIN16 16
1747-#define PORTA_PIN17 17
1748-#define PORTA_PIN18 18
1749-#define PORTA_PIN19 19
1750-#define PORTA_PIN20 20
1751-#define PORTA_PIN21 21
1752-#define PORTA_PIN22 22
1753-#define PORTA_PIN23 23
1754-#define PORTA_PIN24 24
1755-#define PORTA_PIN25 25
1756-#define PORTA_PIN26 26
1757-#define PORTA_PIN27 27
1758-#define PORTA_PIN28 28
1759-#define PORTA_PIN29 29
1760-#define PORTA_PIN30 30
1761-#define PORTA_PIN31 31
1762+#define PORTA_PIN0 0
1763+#define PORTA_PIN1 1
1764+#define PORTA_PIN2 2
1765+#define PORTA_PIN3 3
1766+#define TEENSY_PIN33 4
1767+#define TEENSY_PIN24 5
1768+#define PORTA_PIN6 6
1769+#define PORTA_PIN7 7
1770+#define PORTA_PIN8 8
1771+#define PORTA_PIN9 9
1772+#define PORTA_PIN10 10
1773+#define PORTA_PIN11 11
1774+#define TEENSY_PIN3 12
1775+#define TEENSY_PIN4 13
1776+#define PORTA_PIN14 14
1777+#define PORTA_PIN15 15
1778+#define PORTA_PIN16 16
1779+#define PORTA_PIN17 17
1780+#define PORTA_PIN18 18
1781+#define PORTA_PIN19 19
1782+#define PORTA_PIN20 20
1783+#define PORTA_PIN21 21
1784+#define PORTA_PIN22 22
1785+#define PORTA_PIN23 23
1786+#define PORTA_PIN24 24
1787+#define PORTA_PIN25 25
1788+#define PORTA_PIN26 26
1789+#define PORTA_PIN27 27
1790+#define PORTA_PIN28 28
1791+#define PORTA_PIN29 29
1792+#define PORTA_PIN30 30
1793+#define PORTA_PIN31 31
1794
1795-#define TEENSY_PIN3_IOPORT IOPORT1
1796-#define TEENSY_PIN4_IOPORT IOPORT1
1797+#define TEENSY_PIN3_IOPORT IOPORT1
1798+#define TEENSY_PIN4_IOPORT IOPORT1
1799 #define TEENSY_PIN24_IOPORT IOPORT1
1800 #define TEENSY_PIN33_IOPORT IOPORT1
1801
1802-#define TEENSY_PIN16 0
1803-#define TEENSY_PIN17 1
1804-#define TEENSY_PIN19 2
1805-#define TEENSY_PIN18 3
1806-#define PORTB_PIN4 4
1807-#define PORTB_PIN5 5
1808-#define PORTB_PIN6 6
1809diff --git a/drivers/gpio/pca9555.c b/drivers/gpio/pca9555.c
1810index b0e542d8deffcc8afd9b644d828e3d7464b3b9d4..496bbca04e5f4de011bac52c1fe3e2fbf2241be0 100644
1811--- a/drivers/gpio/pca9555.c
1812+++ b/drivers/gpio/pca9555.c
1813@@ -22,57 +22,57 @@
1814 #define TIMEOUT 100
1815
1816 enum {
1817- CMD_INPUT_0 = 0,
1818- CMD_INPUT_1,
1819- CMD_OUTPUT_0,
1820- CMD_OUTPUT_1,
1821- CMD_INVERSION_0,
1822- CMD_INVERSION_1,
1823- CMD_CONFIG_0,
1824- CMD_CONFIG_1,
1825+ CMD_INPUT_0 = 0,
1826+ CMD_INPUT_1,
1827+ CMD_OUTPUT_0,
1828+ CMD_OUTPUT_1,
1829+ CMD_INVERSION_0,
1830+ CMD_INVERSION_1,
1831+ CMD_CONFIG_0,
1832+ CMD_CONFIG_1,
1833 };
1834
1835 void pca9555_init(uint8_t slave_addr) {
1836- static uint8_t s_init = 0;
1837- if (!s_init) {
1838- i2c_init();
1839+ static uint8_t s_init = 0;
1840+ if (!s_init) {
1841+ i2c_init();
1842
1843- s_init = 1;
1844- }
1845+ s_init = 1;
1846+ }
1847
1848- // TODO: could check device connected
1849- // i2c_start(SLAVE_TO_ADDR(slave) | I2C_WRITE);
1850- // i2c_stop();
1851+ // TODO: could check device connected
1852+ // i2c_start(SLAVE_TO_ADDR(slave) | I2C_WRITE);
1853+ // i2c_stop();
1854 }
1855
1856 void pca9555_set_config(uint8_t slave_addr, uint8_t port, uint8_t conf) {
1857- uint8_t addr = SLAVE_TO_ADDR(slave_addr);
1858- uint8_t cmd = port ? CMD_CONFIG_1 : CMD_CONFIG_0;
1859+ uint8_t addr = SLAVE_TO_ADDR(slave_addr);
1860+ uint8_t cmd = port ? CMD_CONFIG_1 : CMD_CONFIG_0;
1861
1862- i2c_status_t ret = i2c_writeReg(addr, cmd, &conf, sizeof(conf), TIMEOUT);
1863- if (ret != I2C_STATUS_SUCCESS) {
1864- print("pca9555_set_config::FAILED\n");
1865- }
1866+ i2c_status_t ret = i2c_writeReg(addr, cmd, &conf, sizeof(conf), TIMEOUT);
1867+ if (ret != I2C_STATUS_SUCCESS) {
1868+ print("pca9555_set_config::FAILED\n");
1869+ }
1870 }
1871
1872 void pca9555_set_output(uint8_t slave_addr, uint8_t port, uint8_t conf) {
1873- uint8_t addr = SLAVE_TO_ADDR(slave_addr);
1874- uint8_t cmd = port ? CMD_OUTPUT_1 : CMD_OUTPUT_0;
1875+ uint8_t addr = SLAVE_TO_ADDR(slave_addr);
1876+ uint8_t cmd = port ? CMD_OUTPUT_1 : CMD_OUTPUT_0;
1877
1878- i2c_status_t ret = i2c_writeReg(addr, cmd, &conf, sizeof(conf), TIMEOUT);
1879- if (ret != I2C_STATUS_SUCCESS) {
1880- print("pca9555_set_output::FAILED\n");
1881- }
1882+ i2c_status_t ret = i2c_writeReg(addr, cmd, &conf, sizeof(conf), TIMEOUT);
1883+ if (ret != I2C_STATUS_SUCCESS) {
1884+ print("pca9555_set_output::FAILED\n");
1885+ }
1886 }
1887
1888 uint8_t pca9555_readPins(uint8_t slave_addr, uint8_t port) {
1889- uint8_t addr = SLAVE_TO_ADDR(slave_addr);
1890- uint8_t cmd = port ? CMD_INPUT_1 : CMD_INPUT_0;
1891+ uint8_t addr = SLAVE_TO_ADDR(slave_addr);
1892+ uint8_t cmd = port ? CMD_INPUT_1 : CMD_INPUT_0;
1893
1894- uint8_t data = 0;
1895- i2c_status_t ret = i2c_readReg(addr, cmd, &data, sizeof(data), TIMEOUT);
1896- if (ret != I2C_STATUS_SUCCESS) {
1897- print("pca9555_readPins::FAILED\n");
1898- }
1899- return data;
1900+ uint8_t data = 0;
1901+ i2c_status_t ret = i2c_readReg(addr, cmd, &data, sizeof(data), TIMEOUT);
1902+ if (ret != I2C_STATUS_SUCCESS) {
1903+ print("pca9555_readPins::FAILED\n");
1904+ }
1905+ return data;
1906 }
1907diff --git a/drivers/haptic/DRV2605L.c b/drivers/haptic/DRV2605L.c
1908index 215e6be3e7cbd2b779e1e11770e52fe6807ca634..f74c965253750c9fff23b47f1ccd9076bbc6b8d4 100644
1909--- a/drivers/haptic/DRV2605L.c
1910+++ b/drivers/haptic/DRV2605L.c
1911@@ -20,110 +20,102 @@
1912 #include <stdio.h>
1913 #include <math.h>
1914
1915-
1916 uint8_t DRV2605L_transfer_buffer[2];
1917 uint8_t DRV2605L_tx_register[0];
1918 uint8_t DRV2605L_read_buffer[0];
1919 uint8_t DRV2605L_read_register;
1920
1921-
1922 void DRV_write(uint8_t drv_register, uint8_t settings) {
1923- DRV2605L_transfer_buffer[0] = drv_register;
1924- DRV2605L_transfer_buffer[1] = settings;
1925- i2c_transmit(DRV2605L_BASE_ADDRESS << 1, DRV2605L_transfer_buffer, 2, 100);
1926+ DRV2605L_transfer_buffer[0] = drv_register;
1927+ DRV2605L_transfer_buffer[1] = settings;
1928+ i2c_transmit(DRV2605L_BASE_ADDRESS << 1, DRV2605L_transfer_buffer, 2, 100);
1929 }
1930
1931 uint8_t DRV_read(uint8_t regaddress) {
1932 #ifdef __AVR__
1933- i2c_readReg(DRV2605L_BASE_ADDRESS << 1,
1934- regaddress, DRV2605L_read_buffer, 1, 100);
1935- DRV2605L_read_register = (uint8_t)DRV2605L_read_buffer[0];
1936+ i2c_readReg(DRV2605L_BASE_ADDRESS << 1, regaddress, DRV2605L_read_buffer, 1, 100);
1937+ DRV2605L_read_register = (uint8_t)DRV2605L_read_buffer[0];
1938 #else
1939- DRV2605L_tx_register[0] = regaddress;
1940- if (MSG_OK != i2c_transmit_receive(DRV2605L_BASE_ADDRESS << 1,
1941- DRV2605L_tx_register, 1,
1942- DRV2605L_read_buffer, 1
1943-)){
1944- printf("err reading reg \n");
1945- }
1946- DRV2605L_read_register = (uint8_t)DRV2605L_read_buffer[0];
1947+ DRV2605L_tx_register[0] = regaddress;
1948+ if (MSG_OK != i2c_transmit_receive(DRV2605L_BASE_ADDRESS << 1, DRV2605L_tx_register, 1, DRV2605L_read_buffer, 1)) {
1949+ printf("err reading reg \n");
1950+ }
1951+ DRV2605L_read_register = (uint8_t)DRV2605L_read_buffer[0];
1952 #endif
1953-return DRV2605L_read_register;
1954+ return DRV2605L_read_register;
1955 }
1956
1957-void DRV_init(void)
1958-{
1959- i2c_init();
1960- /* 0x07 sets DRV2605 into calibration mode */
1961- DRV_write(DRV_MODE,0x07);
1962+void DRV_init(void) {
1963+ i2c_init();
1964+ /* 0x07 sets DRV2605 into calibration mode */
1965+ DRV_write(DRV_MODE, 0x07);
1966+
1967+ // DRV_write(DRV_FEEDBACK_CTRL,0xB6);
1968
1969-// DRV_write(DRV_FEEDBACK_CTRL,0xB6);
1970-
1971- #if FB_ERM_LRA == 0
1972+#if FB_ERM_LRA == 0
1973 /* ERM settings */
1974- DRV_write(DRV_RATED_VOLT, (RATED_VOLTAGE/21.33)*1000);
1975- #if ERM_OPEN_LOOP == 0
1976- DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, (((V_PEAK*(DRIVE_TIME+BLANKING_TIME+IDISS_TIME))/0.02133)/(DRIVE_TIME-0.0003)));
1977- #elif ERM_OPEN_LOOP == 1
1978- DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, (V_PEAK/0.02196));
1979- #endif
1980- #elif FB_ERM_LRA == 1
1981- DRV_write(DRV_RATED_VOLT, ((V_RMS * sqrt(1 - ((4 * ((150+(SAMPLE_TIME*50))*0.000001)) + 0.0003)* F_LRA)/0.02071)));
1982- #if LRA_OPEN_LOOP == 0
1983- DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, ((V_PEAK/sqrt(1-(F_LRA*0.0008))/0.02133)));
1984- #elif LRA_OPEN_LOOP == 1
1985- DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, (V_PEAK/0.02196));
1986- #endif
1987- #endif
1988-
1989- DRVREG_FBR FB_SET;
1990- FB_SET.Bits.ERM_LRA = FB_ERM_LRA;
1991+ DRV_write(DRV_RATED_VOLT, (RATED_VOLTAGE / 21.33) * 1000);
1992+# if ERM_OPEN_LOOP == 0
1993+ DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, (((V_PEAK * (DRIVE_TIME + BLANKING_TIME + IDISS_TIME)) / 0.02133) / (DRIVE_TIME - 0.0003)));
1994+# elif ERM_OPEN_LOOP == 1
1995+ DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, (V_PEAK / 0.02196));
1996+# endif
1997+#elif FB_ERM_LRA == 1
1998+ DRV_write(DRV_RATED_VOLT, ((V_RMS * sqrt(1 - ((4 * ((150 + (SAMPLE_TIME * 50)) * 0.000001)) + 0.0003) * F_LRA) / 0.02071)));
1999+# if LRA_OPEN_LOOP == 0
2000+ DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, ((V_PEAK / sqrt(1 - (F_LRA * 0.0008)) / 0.02133)));
2001+# elif LRA_OPEN_LOOP == 1
2002+ DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, (V_PEAK / 0.02196));
2003+# endif
2004+#endif
2005+
2006+ DRVREG_FBR FB_SET;
2007+ FB_SET.Bits.ERM_LRA = FB_ERM_LRA;
2008 FB_SET.Bits.BRAKE_FACTOR = FB_BRAKEFACTOR;
2009- FB_SET.Bits.LOOP_GAIN =FB_LOOPGAIN;
2010- FB_SET.Bits.BEMF_GAIN = 0; /* auto-calibration populates this field*/
2011diff --git a/drivers/haptic/DRV2605L.h b/drivers/haptic/DRV2605L.h
2012index 836e9cbcd281fda1fd50b8cb1bbcf702be9ca490..f550b859f7c94008f83c6ea99b3447da2b97b6f1 100644
2013--- a/drivers/haptic/DRV2605L.h
2014+++ b/drivers/haptic/DRV2605L.h
2015@@ -22,383 +22,383 @@
2016
2017 * Feedback Control Settings */
2018 #ifndef FB_ERM_LRA
2019-#define FB_ERM_LRA 1 /* For ERM:0 or LRA:1*/
2020+# define FB_ERM_LRA 1 /* For ERM:0 or LRA:1*/
2021 #endif
2022 #ifndef FB_BRAKEFACTOR
2023-#define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
2024+# define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
2025 #endif
2026 #ifndef FB_LOOPGAIN
2027-#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
2028+# define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
2029 #endif
2030
2031 /* LRA specific settings */
2032 #if FB_ERM_LRA == 1
2033-#ifndef V_RMS
2034-#define V_RMS 2.0
2035-#endif
2036-#ifndef V_PEAK
2037-#define V_PEAK 2.1
2038-#endif
2039-#ifndef F_LRA
2040-#define F_LRA 205
2041-#endif
2042-#ifndef RATED_VOLTAGE
2043-#define RATED_VOLTAGE 2 /* 2v as safe range in case device voltage is not set */
2044-#endif
2045+# ifndef V_RMS
2046+# define V_RMS 2.0
2047+# endif
2048+# ifndef V_PEAK
2049+# define V_PEAK 2.1
2050+# endif
2051+# ifndef F_LRA
2052+# define F_LRA 205
2053+# endif
2054+# ifndef RATED_VOLTAGE
2055+# define RATED_VOLTAGE 2 /* 2v as safe range in case device voltage is not set */
2056+# endif
2057 #endif
2058
2059 #ifndef RATED_VOLTAGE
2060-#define RATED_VOLTAGE 2 /* 2v as safe range in case device voltage is not set */
2061+# define RATED_VOLTAGE 2 /* 2v as safe range in case device voltage is not set */
2062 #endif
2063 #ifndef V_PEAK
2064-#define V_PEAK 2.8
2065+# define V_PEAK 2.8
2066 #endif
2067
2068 /* Library Selection */
2069 #ifndef LIB_SELECTION
2070-#if FB_ERM_LRA == 1
2071-#define LIB_SELECTION 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */
2072-#else
2073-#define LIB_SELECTION 1
2074-#endif
2075+# if FB_ERM_LRA == 1
2076+# define LIB_SELECTION 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */
2077+# else
2078+# define LIB_SELECTION 1
2079+# endif
2080 #endif
2081
2082 #ifndef DRV_GREETING
2083-#define DRV_GREETING alert_750ms
2084+# define DRV_GREETING alert_750ms
2085 #endif
2086 #ifndef DRV_MODE_DEFAULT
2087-#define DRV_MODE_DEFAULT strong_click1
2088+# define DRV_MODE_DEFAULT strong_click1
2089 #endif
2090
2091 /* Control 1 register settings */
2092 #ifndef DRIVE_TIME
2093-#define DRIVE_TIME 25
2094+# define DRIVE_TIME 25
2095 #endif
2096 #ifndef AC_COUPLE
2097-#define AC_COUPLE 0
2098+# define AC_COUPLE 0
2099 #endif
2100 #ifndef STARTUP_BOOST
2101-#define STARTUP_BOOST 1
2102+# define STARTUP_BOOST 1
2103 #endif
2104
2105 /* Control 2 Settings */
2106 #ifndef BIDIR_INPUT
2107-#define BIDIR_INPUT 1
2108+# define BIDIR_INPUT 1
2109 #endif
2110 #ifndef BRAKE_STAB
2111-#define BRAKE_STAB 1 /* Loopgain is reduced when braking is almost complete to improve stability */
2112+# define BRAKE_STAB 1 /* Loopgain is reduced when braking is almost complete to improve stability */
2113 #endif
2114-#ifndef SAMPLE_TIME
2115diff --git a/drivers/haptic/haptic.c b/drivers/haptic/haptic.c
2116index a94f05565c228c8c373ad8cea4f093226e3eeea5..ded6d8a44a0416de83747e6f30ce933920866564 100644
2117--- a/drivers/haptic/haptic.c
2118+++ b/drivers/haptic/haptic.c
2119@@ -19,230 +19,248 @@
2120 #include "progmem.h"
2121 #include "debug.h"
2122 #ifdef DRV2605L
2123-#include "DRV2605L.h"
2124+# include "DRV2605L.h"
2125 #endif
2126 #ifdef SOLENOID_ENABLE
2127-#include "solenoid.h"
2128+# include "solenoid.h"
2129 #endif
2130
2131 haptic_config_t haptic_config;
2132
2133 void haptic_init(void) {
2134- debug_enable = 1; //Debug is ON!
2135- if (!eeconfig_is_enabled()) {
2136- eeconfig_init();
2137- }
2138- haptic_config.raw = eeconfig_read_haptic();
2139- if (haptic_config.mode < 1){
2140- haptic_config.mode = 1;
2141- }
2142- if (!haptic_config.mode){
2143- dprintf("No haptic config found in eeprom, setting default configs\n");
2144- haptic_reset();
2145- }
2146- #ifdef SOLENOID_ENABLE
2147+ debug_enable = 1; // Debug is ON!
2148+ if (!eeconfig_is_enabled()) {
2149+ eeconfig_init();
2150+ }
2151+ haptic_config.raw = eeconfig_read_haptic();
2152+ if (haptic_config.mode < 1) {
2153+ haptic_config.mode = 1;
2154+ }
2155+ if (!haptic_config.mode) {
2156+ dprintf("No haptic config found in eeprom, setting default configs\n");
2157+ haptic_reset();
2158+ }
2159+#ifdef SOLENOID_ENABLE
2160 solenoid_setup();
2161 dprintf("Solenoid driver initialized\n");
2162- #endif
2163- #ifdef DRV2605L
2164+#endif
2165+#ifdef DRV2605L
2166 DRV_init();
2167 dprintf("DRV2605 driver initialized\n");
2168- #endif
2169- eeconfig_debug_haptic();
2170+#endif
2171+ eeconfig_debug_haptic();
2172 }
2173
2174 void haptic_task(void) {
2175- #ifdef SOLENOID_ENABLE
2176- solenoid_check();
2177- #endif
2178+#ifdef SOLENOID_ENABLE
2179+ solenoid_check();
2180+#endif
2181 }
2182
2183 void eeconfig_debug_haptic(void) {
2184- dprintf("haptic_config eprom\n");
2185- dprintf("haptic_config.enable = %d\n", haptic_config.enable);
2186- dprintf("haptic_config.mode = %d\n", haptic_config.mode);
2187+ dprintf("haptic_config eprom\n");
2188+ dprintf("haptic_config.enable = %d\n", haptic_config.enable);
2189+ dprintf("haptic_config.mode = %d\n", haptic_config.mode);
2190 }
2191
2192 void haptic_enable(void) {
2193- haptic_config.enable = 1;
2194- xprintf("haptic_config.enable = %u\n", haptic_config.enable);
2195- eeconfig_update_haptic(haptic_config.raw);
2196+ haptic_config.enable = 1;
2197+ xprintf("haptic_config.enable = %u\n", haptic_config.enable);
2198+ eeconfig_update_haptic(haptic_config.raw);
2199 }
2200
2201 void haptic_disable(void) {
2202- haptic_config.enable = 0;
2203- xprintf("haptic_config.enable = %u\n", haptic_config.enable);
2204- eeconfig_update_haptic(haptic_config.raw);
2205+ haptic_config.enable = 0;
2206+ xprintf("haptic_config.enable = %u\n", haptic_config.enable);
2207+ eeconfig_update_haptic(haptic_config.raw);
2208 }
2209
2210 void haptic_toggle(void) {
2211-if (haptic_config.enable) {
2212- haptic_disable();
2213- } else {
2214- haptic_enable();
2215- }
2216- eeconfig_update_haptic(haptic_config.raw);
2217+ if (haptic_config.enable) {
2218+ haptic_disable();
2219diff --git a/drivers/haptic/haptic.h b/drivers/haptic/haptic.h
2220index d39dc5c3b9d6442bb0e8987dd7869f07d0291ffb..8135d0d43985fddbda7fd89a10f66f09f9fb6837 100644
2221--- a/drivers/haptic/haptic.h
2222+++ b/drivers/haptic/haptic.h
2223@@ -20,63 +20,57 @@
2224 #include <stdbool.h>
2225 #include "quantum.h"
2226 #ifdef DRV2605L
2227-#include "DRV2605L.h"
2228+# include "DRV2605L.h"
2229 #endif
2230
2231-
2232 #ifndef HAPTIC_FEEDBACK_DEFAULT
2233-#define HAPTIC_FEEDBACK_DEFAULT 0
2234+# define HAPTIC_FEEDBACK_DEFAULT 0
2235 #endif
2236 #ifndef HAPTIC_MODE_DEFAULT
2237-#define HAPTIC_MODE_DEFAULT DRV_MODE_DEFAULT
2238+# define HAPTIC_MODE_DEFAULT DRV_MODE_DEFAULT
2239 #endif
2240
2241 /* EEPROM config settings */
2242 typedef union {
2243- uint32_t raw;
2244- struct {
2245- bool enable :1;
2246- uint8_t feedback :2;
2247- uint8_t mode :7;
2248- bool buzz :1;
2249- uint8_t dwell :7;
2250- uint16_t reserved :16;
2251- };
2252+ uint32_t raw;
2253+ struct {
2254+ bool enable : 1;
2255+ uint8_t feedback : 2;
2256+ uint8_t mode : 7;
2257+ bool buzz : 1;
2258+ uint8_t dwell : 7;
2259+ uint16_t reserved : 16;
2260+ };
2261 } haptic_config_t;
2262
2263-typedef enum HAPTIC_FEEDBACK{
2264- KEY_PRESS,
2265- KEY_PRESS_RELEASE,
2266- KEY_RELEASE,
2267- HAPTIC_FEEDBACK_MAX,
2268+typedef enum HAPTIC_FEEDBACK {
2269+ KEY_PRESS,
2270+ KEY_PRESS_RELEASE,
2271+ KEY_RELEASE,
2272+ HAPTIC_FEEDBACK_MAX,
2273 } HAPTIC_FEEDBACK;
2274
2275-bool process_haptic(uint16_t keycode, keyrecord_t *record);
2276-void haptic_init(void);
2277-void haptic_task(void);
2278-void eeconfig_debug_haptic(void);
2279-void haptic_enable(void);
2280-void haptic_disable(void);
2281-void haptic_toggle(void);
2282-void haptic_feedback_toggle(void);
2283-void haptic_mode_increase(void);
2284-void haptic_mode_decrease(void);
2285-void haptic_mode(uint8_t mode);
2286-void haptic_reset(void);
2287-void haptic_set_feedback(uint8_t feedback);
2288-void haptic_set_mode(uint8_t mode);
2289-void haptic_set_dwell(uint8_t dwell);
2290-void haptic_set_buzz(uint8_t buzz);
2291-void haptic_buzz_toggle(void);
2292+bool process_haptic(uint16_t keycode, keyrecord_t *record);
2293+void haptic_init(void);
2294+void haptic_task(void);
2295+void eeconfig_debug_haptic(void);
2296+void haptic_enable(void);
2297+void haptic_disable(void);
2298+void haptic_toggle(void);
2299+void haptic_feedback_toggle(void);
2300+void haptic_mode_increase(void);
2301+void haptic_mode_decrease(void);
2302+void haptic_mode(uint8_t mode);
2303+void haptic_reset(void);
2304+void haptic_set_feedback(uint8_t feedback);
2305+void haptic_set_mode(uint8_t mode);
2306+void haptic_set_dwell(uint8_t dwell);
2307+void haptic_set_buzz(uint8_t buzz);
2308+void haptic_buzz_toggle(void);
2309 uint8_t haptic_get_mode(void);
2310 uint8_t haptic_get_feedback(void);
2311-void haptic_dwell_increase(void);
2312-void haptic_dwell_decrease(void);
2313+void haptic_dwell_increase(void);
2314+void haptic_dwell_decrease(void);
2315
2316 void haptic_play(void);
2317 void haptic_shutdown(void);
2318-
2319-
2320-
2321-
2322-
2323diff --git a/drivers/haptic/solenoid.c b/drivers/haptic/solenoid.c
2324index 2d39dbc1794c97945dd6054d9dc7049720856037..d645c379ae9704dbc22c5d60d7c14d74c80e9bca 100644
2325--- a/drivers/haptic/solenoid.c
2326+++ b/drivers/haptic/solenoid.c
2327@@ -19,91 +19,77 @@
2328 #include "solenoid.h"
2329 #include "haptic.h"
2330
2331-bool solenoid_on = false;
2332-bool solenoid_buzzing = false;
2333-uint16_t solenoid_start = 0;
2334-uint8_t solenoid_dwell = SOLENOID_DEFAULT_DWELL;
2335+bool solenoid_on = false;
2336+bool solenoid_buzzing = false;
2337+uint16_t solenoid_start = 0;
2338+uint8_t solenoid_dwell = SOLENOID_DEFAULT_DWELL;
2339
2340 extern haptic_config_t haptic_config;
2341
2342+void solenoid_buzz_on(void) { haptic_set_buzz(1); }
2343
2344-void solenoid_buzz_on(void) {
2345- haptic_set_buzz(1);
2346-}
2347-
2348-void solenoid_buzz_off(void) {
2349- haptic_set_buzz(0);
2350-}
2351-
2352-void solenoid_set_buzz(int buzz) {
2353- haptic_set_buzz(buzz);
2354-}
2355+void solenoid_buzz_off(void) { haptic_set_buzz(0); }
2356
2357+void solenoid_set_buzz(int buzz) { haptic_set_buzz(buzz); }
2358
2359 void solenoid_dwell_minus(uint8_t solenoid_dwell) {
2360- if (solenoid_dwell > 0) solenoid_dwell--;
2361+ if (solenoid_dwell > 0) solenoid_dwell--;
2362 }
2363
2364 void solenoid_dwell_plus(uint8_t solenoid_dwell) {
2365- if (solenoid_dwell < SOLENOID_MAX_DWELL) solenoid_dwell++;
2366+ if (solenoid_dwell < SOLENOID_MAX_DWELL) solenoid_dwell++;
2367 }
2368
2369-void solenoid_set_dwell(uint8_t dwell) {
2370- solenoid_dwell = dwell;
2371-}
2372+void solenoid_set_dwell(uint8_t dwell) { solenoid_dwell = dwell; }
2373
2374 void solenoid_stop(void) {
2375- writePinLow(SOLENOID_PIN);
2376- solenoid_on = false;
2377- solenoid_buzzing = false;
2378+ writePinLow(SOLENOID_PIN);
2379+ solenoid_on = false;
2380+ solenoid_buzzing = false;
2381 }
2382
2383 void solenoid_fire(void) {
2384- if (!haptic_config.buzz && solenoid_on) return;
2385- if (haptic_config.buzz && solenoid_buzzing) return;
2386+ if (!haptic_config.buzz && solenoid_on) return;
2387+ if (haptic_config.buzz && solenoid_buzzing) return;
2388
2389- solenoid_on = true;
2390- solenoid_buzzing = true;
2391- solenoid_start = timer_read();
2392- writePinHigh(SOLENOID_PIN);
2393+ solenoid_on = true;
2394+ solenoid_buzzing = true;
2395+ solenoid_start = timer_read();
2396+ writePinHigh(SOLENOID_PIN);
2397 }
2398
2399 void solenoid_check(void) {
2400- uint16_t elapsed = 0;
2401-
2402- if (!solenoid_on) return;
2403+ uint16_t elapsed = 0;
2404
2405- elapsed = timer_elapsed(solenoid_start);
2406+ if (!solenoid_on) return;
2407
2408- //Check if it's time to finish this solenoid click cycle
2409- if (elapsed > solenoid_dwell) {
2410- solenoid_stop();
2411- return;
2412- }
2413+ elapsed = timer_elapsed(solenoid_start);
2414
2415- //Check whether to buzz the solenoid on and off
2416- if (haptic_config.buzz) {
2417- if (elapsed / SOLENOID_MIN_DWELL % 2 == 0){
2418- if (!solenoid_buzzing) {
2419- solenoid_buzzing = true;
2420- writePinHigh(SOLENOID_PIN);
2421- }
2422+ // Check if it's time to finish this solenoid click cycle
2423+ if (elapsed > solenoid_dwell) {
2424+ solenoid_stop();
2425+ return;
2426 }
2427diff --git a/drivers/haptic/solenoid.h b/drivers/haptic/solenoid.h
2428index a08f62a11ee06efe861fe73c3583a50c0a358081..53dc626e33f89545ee11a1c9b493d36f7d1db0b3 100644
2429--- a/drivers/haptic/solenoid.h
2430+++ b/drivers/haptic/solenoid.h
2431@@ -18,23 +18,23 @@
2432 #pragma once
2433
2434 #ifndef SOLENOID_DEFAULT_DWELL
2435-#define SOLENOID_DEFAULT_DWELL 12
2436+# define SOLENOID_DEFAULT_DWELL 12
2437 #endif
2438
2439 #ifndef SOLENOID_MAX_DWELL
2440-#define SOLENOID_MAX_DWELL 100
2441+# define SOLENOID_MAX_DWELL 100
2442 #endif
2443
2444 #ifndef SOLENOID_MIN_DWELL
2445-#define SOLENOID_MIN_DWELL 4
2446+# define SOLENOID_MIN_DWELL 4
2447 #endif
2448
2449 #ifndef SOLENOID_ACTIVE
2450-#define SOLENOID_ACTIVE false
2451+# define SOLENOID_ACTIVE false
2452 #endif
2453
2454 #ifndef SOLENOID_PIN
2455-#define SOLENOID_PIN F6
2456+# define SOLENOID_PIN F6
2457 #endif
2458
2459 void solenoid_buzz_on(void);
2460diff --git a/drivers/issi/is31fl3218.c b/drivers/issi/is31fl3218.c
2461index db44f725644ff411de180a37d68dbd32a8ffaa75..d43863ac4beeec055e15ce7a1a331cf1b54b3a67 100644
2462--- a/drivers/issi/is31fl3218.c
2463+++ b/drivers/issi/is31fl3218.c
2464@@ -35,68 +35,62 @@ uint8_t g_twi_transfer_buffer[20];
2465 // IS31FL3218 has 18 PWM outputs and a fixed I2C address, so no chaining.
2466 // If used as RGB LED driver, LEDs are assigned RGB,RGB,RGB,RGB,RGB,RGB
2467 uint8_t g_pwm_buffer[18];
2468-bool g_pwm_buffer_update_required = false;
2469+bool g_pwm_buffer_update_required = false;
2470
2471-void IS31FL3218_write_register( uint8_t reg, uint8_t data )
2472-{
2473- g_twi_transfer_buffer[0] = reg;
2474- g_twi_transfer_buffer[1] = data;
2475- i2c_transmit( ISSI_ADDRESS, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
2476+void IS31FL3218_write_register(uint8_t reg, uint8_t data) {
2477+ g_twi_transfer_buffer[0] = reg;
2478+ g_twi_transfer_buffer[1] = data;
2479+ i2c_transmit(ISSI_ADDRESS, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
2480 }
2481
2482-void IS31FL3218_write_pwm_buffer( uint8_t *pwm_buffer )
2483-{
2484- g_twi_transfer_buffer[0] = ISSI_REG_PWM;
2485- for ( int i=0; i<18; i++ ) {
2486- g_twi_transfer_buffer[1+i] = pwm_buffer[i];
2487- }
2488-
2489- i2c_transmit( ISSI_ADDRESS, g_twi_transfer_buffer, 19, ISSI_TIMEOUT);
2490+void IS31FL3218_write_pwm_buffer(uint8_t *pwm_buffer) {
2491+ g_twi_transfer_buffer[0] = ISSI_REG_PWM;
2492+ for (int i = 0; i < 18; i++) {
2493+ g_twi_transfer_buffer[1 + i] = pwm_buffer[i];
2494+ }
2495+
2496+ i2c_transmit(ISSI_ADDRESS, g_twi_transfer_buffer, 19, ISSI_TIMEOUT);
2497 }
2498
2499-void IS31FL3218_init(void)
2500-{
2501- // In case we ever want to reinitialize (?)
2502- IS31FL3218_write_register( ISSI_REG_RESET, 0x00 );
2503-
2504- // Turn off software shutdown
2505- IS31FL3218_write_register( ISSI_REG_SHUTDOWN, 0x01 );
2506-
2507- // Set all PWM values to zero
2508- for ( uint8_t i = 0; i < 18; i++ ) {
2509- IS31FL3218_write_register( ISSI_REG_PWM+i, 0x00 );
2510- }
2511-
2512- // Enable all channels
2513- for ( uint8_t i = 0; i < 3; i++ ) {
2514- IS31FL3218_write_register( ISSI_REG_CONTROL+i, 0b00111111 );
2515- }
2516-
2517- // Load PWM registers and LED Control register data
2518- IS31FL3218_write_register( ISSI_REG_UPDATE, 0x01 );
2519+void IS31FL3218_init(void) {
2520+ // In case we ever want to reinitialize (?)
2521+ IS31FL3218_write_register(ISSI_REG_RESET, 0x00);
2522+
2523+ // Turn off software shutdown
2524+ IS31FL3218_write_register(ISSI_REG_SHUTDOWN, 0x01);
2525+
2526+ // Set all PWM values to zero
2527+ for (uint8_t i = 0; i < 18; i++) {
2528+ IS31FL3218_write_register(ISSI_REG_PWM + i, 0x00);
2529+ }
2530+
2531+ // Enable all channels
2532+ for (uint8_t i = 0; i < 3; i++) {
2533+ IS31FL3218_write_register(ISSI_REG_CONTROL + i, 0b00111111);
2534+ }
2535+
2536+ // Load PWM registers and LED Control register data
2537+ IS31FL3218_write_register(ISSI_REG_UPDATE, 0x01);
2538 }
2539
2540-void IS31FL3218_set_color( int index, uint8_t red, uint8_t green, uint8_t blue )
2541-{
2542- g_pwm_buffer[index * 3 + 0] = red;
2543- g_pwm_buffer[index * 3 + 1] = green;
2544- g_pwm_buffer[index * 3 + 2] = blue;
2545- g_pwm_buffer_update_required = true;
2546+void IS31FL3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
2547+ g_pwm_buffer[index * 3 + 0] = red;
2548+ g_pwm_buffer[index * 3 + 1] = green;
2549+ g_pwm_buffer[index * 3 + 2] = blue;
2550+ g_pwm_buffer_update_required = true;
2551 }
2552
2553-void IS31FL3218_set_color_all( uint8_t red, uint8_t green, uint8_t blue )
2554-{
2555- for ( int i = 0; i < 6; i++ ) {
2556- IS31FL3218_set_color( i, red, green, blue );
2557- }
2558+void IS31FL3218_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
2559+ for (int i = 0; i < 6; i++) {
2560+ IS31FL3218_set_color(i, red, green, blue);
2561+ }
2562 }
2563
2564diff --git a/drivers/issi/is31fl3218.h b/drivers/issi/is31fl3218.h
2565index 2d24e514638eb6e33878ba6cdeecd24725938951..a70cc1e79380e12d03a82a8a442641d18eef47c9 100644
2566--- a/drivers/issi/is31fl3218.h
2567+++ b/drivers/issi/is31fl3218.h
2568@@ -19,6 +19,6 @@
2569 #include <stdbool.h>
2570
2571 void IS31FL3218_init(void);
2572-void IS31FL3218_set_color( int index, uint8_t red, uint8_t green, uint8_t blue );
2573-void IS31FL3218_set_color_all( uint8_t red, uint8_t green, uint8_t blue );
2574+void IS31FL3218_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
2575+void IS31FL3218_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
2576 void IS31FL3218_update_pwm_buffers(void);
2577diff --git a/drivers/issi/is31fl3731-simple.c b/drivers/issi/is31fl3731-simple.c
2578index a7faa9c38c0bf73e395afc3a8cb01efe0a455d25..fad4676defd4aa42ccd72a1bb10e64968304685a 100644
2579--- a/drivers/issi/is31fl3731-simple.c
2580+++ b/drivers/issi/is31fl3731-simple.c
2581@@ -17,11 +17,11 @@
2582 */
2583
2584 #ifdef __AVR__
2585-#include <avr/interrupt.h>
2586-#include <avr/io.h>
2587-#include <util/delay.h>
2588+# include <avr/interrupt.h>
2589+# include <avr/io.h>
2590+# include <util/delay.h>
2591 #else
2592-#include "wait.h"
2593+# include "wait.h"
2594 #endif
2595
2596 #include <stdint.h>
2597@@ -41,7 +41,7 @@
2598 // 0b1110110 AD <-> SDA
2599 #define ISSI_ADDR_DEFAULT 0x74
2600
2601-#define ISSI_REG_CONFIG 0x00
2602+#define ISSI_REG_CONFIG 0x00
2603 #define ISSI_REG_CONFIG_PICTUREMODE 0x00
2604 #define ISSI_REG_CONFIG_AUTOPLAYMODE 0x08
2605 #define ISSI_REG_CONFIG_AUDIOPLAYMODE 0x18
2606@@ -50,20 +50,20 @@
2607 #define ISSI_CONF_AUTOFRAMEMODE 0x04
2608 #define ISSI_CONF_AUDIOMODE 0x08
2609
2610-#define ISSI_REG_PICTUREFRAME 0x01
2611+#define ISSI_REG_PICTUREFRAME 0x01
2612
2613 #define ISSI_REG_SHUTDOWN 0x0A
2614 #define ISSI_REG_AUDIOSYNC 0x06
2615
2616 #define ISSI_COMMANDREGISTER 0xFD
2617-#define ISSI_BANK_FUNCTIONREG 0x0B // helpfully called 'page nine'
2618+#define ISSI_BANK_FUNCTIONREG 0x0B // helpfully called 'page nine'
2619
2620 #ifndef ISSI_TIMEOUT
2621- #define ISSI_TIMEOUT 100
2622+# define ISSI_TIMEOUT 100
2623 #endif
2624
2625 #ifndef ISSI_PERSISTENCE
2626- #define ISSI_PERSISTENCE 0
2627+# define ISSI_PERSISTENCE 0
2628 #endif
2629
2630 // Transfer buffer for TWITransmitData()
2631@@ -75,17 +75,17 @@ uint8_t g_twi_transfer_buffer[20];
2632 // buffers and the transfers in IS31FL3731_write_pwm_buffer() but it's
2633 // probably not worth the extra complexity.
2634 uint8_t g_pwm_buffer[LED_DRIVER_COUNT][144];
2635-bool g_pwm_buffer_update_required = false;
2636+bool g_pwm_buffer_update_required = false;
2637
2638 /* There's probably a better way to init this... */
2639 #if LED_DRIVER_COUNT == 1
2640- uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}};
2641+uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}};
2642 #elif LED_DRIVER_COUNT == 2
2643- uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}};
2644+uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}};
2645 #elif LED_DRIVER_COUNT == 3
2646- uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}};
2647+uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}};
2648 #elif LED_DRIVER_COUNT == 4
2649- uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}, {0}};
2650+uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}, {0}};
2651 #endif
2652 bool g_led_control_registers_update_required = false;
2653
2654@@ -103,20 +103,19 @@ bool g_led_control_registers_update_required = false;
2655 // 0x0E - R17,G15,G14,G13,G12,G11,G10,G09
2656 // 0x10 - R16,R15,R14,R13,R12,R11,R10,R09
2657
2658-
2659 void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
2660 g_twi_transfer_buffer[0] = reg;
2661 g_twi_transfer_buffer[1] = data;
2662
2663- #if ISSI_PERSISTENCE > 0
2664- for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
2665- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) {
2666- break;
2667- }
2668+#if ISSI_PERSISTENCE > 0
2669+ for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
2670+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) {
2671+ break;
2672 }
2673- #else
2674- i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
2675- #endif
2676+ }
2677+#else
2678+ i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
2679+#endif
2680 }
2681diff --git a/drivers/issi/is31fl3731-simple.h b/drivers/issi/is31fl3731-simple.h
2682index dbe49828179183f3d1ceac78cfb95df6cb14ae88..a223c351e885beb1aee464648f864d8fe129b93a 100644
2683--- a/drivers/issi/is31fl3731-simple.h
2684+++ b/drivers/issi/is31fl3731-simple.h
2685@@ -16,14 +16,12 @@
2686 * along with this program. If not, see <http://www.gnu.org/licenses/>.
2687 */
2688
2689-
2690 #ifndef IS31FL3731_DRIVER_H
2691 #define IS31FL3731_DRIVER_H
2692
2693-
2694 typedef struct is31_led {
2695- uint8_t driver:2;
2696- uint8_t v;
2697+ uint8_t driver : 2;
2698+ uint8_t v;
2699 } __attribute__((packed)) is31_led;
2700
2701 extern const is31_led g_is31_leds[LED_DRIVER_LED_COUNT];
2702@@ -44,16 +42,16 @@ void IS31FL3731_set_led_control_register(uint8_t index, bool value);
2703 void IS31FL3731_update_pwm_buffers(uint8_t addr, uint8_t index);
2704 void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index);
2705
2706-#define C1_1 0x24
2707-#define C1_2 0x25
2708-#define C1_3 0x26
2709-#define C1_4 0x27
2710-#define C1_5 0x28
2711-#define C1_6 0x29
2712-#define C1_7 0x2A
2713-#define C1_8 0x2B
2714+#define C1_1 0x24
2715+#define C1_2 0x25
2716+#define C1_3 0x26
2717+#define C1_4 0x27
2718+#define C1_5 0x28
2719+#define C1_6 0x29
2720+#define C1_7 0x2A
2721+#define C1_8 0x2B
2722
2723-#define C1_9 0x2C
2724+#define C1_9 0x2C
2725 #define C1_10 0x2D
2726 #define C1_11 0x2E
2727 #define C1_12 0x2F
2728@@ -62,16 +60,16 @@ void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index);
2729 #define C1_15 0x32
2730 #define C1_16 0x33
2731
2732-#define C2_1 0x34
2733-#define C2_2 0x35
2734-#define C2_3 0x36
2735-#define C2_4 0x37
2736-#define C2_5 0x38
2737-#define C2_6 0x39
2738-#define C2_7 0x3A
2739-#define C2_8 0x3B
2740+#define C2_1 0x34
2741+#define C2_2 0x35
2742+#define C2_3 0x36
2743+#define C2_4 0x37
2744+#define C2_5 0x38
2745+#define C2_6 0x39
2746+#define C2_7 0x3A
2747+#define C2_8 0x3B
2748
2749-#define C2_9 0x3C
2750+#define C2_9 0x3C
2751 #define C2_10 0x3D
2752 #define C2_11 0x3E
2753 #define C2_12 0x3F
2754@@ -80,16 +78,16 @@ void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index);
2755 #define C2_15 0x42
2756 #define C2_16 0x43
2757
2758-#define C3_1 0x44
2759-#define C3_2 0x45
2760-#define C3_3 0x46
2761-#define C3_4 0x47
2762-#define C3_5 0x48
2763-#define C3_6 0x49
2764-#define C3_7 0x4A
2765-#define C3_8 0x4B
2766+#define C3_1 0x44
2767+#define C3_2 0x45
2768+#define C3_3 0x46
2769+#define C3_4 0x47
2770+#define C3_5 0x48
2771+#define C3_6 0x49
2772+#define C3_7 0x4A
2773+#define C3_8 0x4B
2774
2775-#define C3_9 0x4C
2776+#define C3_9 0x4C
2777 #define C3_10 0x4D
2778 #define C3_11 0x4E
2779 #define C3_12 0x4F
2780@@ -98,16 +96,16 @@ void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index);
2781 #define C3_15 0x52
2782 #define C3_16 0x53
2783
2784-#define C4_1 0x54
2785diff --git a/drivers/issi/is31fl3731.c b/drivers/issi/is31fl3731.c
2786index 30c7dd0530c0b8bea98eee86d1cf94560ea020ee..0b6f3e985de1530dd5880c9ac61851065f167f30 100644
2787--- a/drivers/issi/is31fl3731.c
2788+++ b/drivers/issi/is31fl3731.c
2789@@ -16,11 +16,11 @@
2790 */
2791
2792 #ifdef __AVR__
2793-#include <avr/interrupt.h>
2794-#include <avr/io.h>
2795-#include <util/delay.h>
2796+# include <avr/interrupt.h>
2797+# include <avr/io.h>
2798+# include <util/delay.h>
2799 #else
2800-#include "wait.h"
2801+# include "wait.h"
2802 #endif
2803
2804 #include "is31fl3731.h"
2805@@ -37,7 +37,7 @@
2806 // 0b1110110 AD <-> SDA
2807 #define ISSI_ADDR_DEFAULT 0x74
2808
2809-#define ISSI_REG_CONFIG 0x00
2810+#define ISSI_REG_CONFIG 0x00
2811 #define ISSI_REG_CONFIG_PICTUREMODE 0x00
2812 #define ISSI_REG_CONFIG_AUTOPLAYMODE 0x08
2813 #define ISSI_REG_CONFIG_AUDIOPLAYMODE 0x18
2814@@ -46,20 +46,20 @@
2815 #define ISSI_CONF_AUTOFRAMEMODE 0x04
2816 #define ISSI_CONF_AUDIOMODE 0x08
2817
2818-#define ISSI_REG_PICTUREFRAME 0x01
2819+#define ISSI_REG_PICTUREFRAME 0x01
2820
2821 #define ISSI_REG_SHUTDOWN 0x0A
2822 #define ISSI_REG_AUDIOSYNC 0x06
2823
2824 #define ISSI_COMMANDREGISTER 0xFD
2825-#define ISSI_BANK_FUNCTIONREG 0x0B // helpfully called 'page nine'
2826+#define ISSI_BANK_FUNCTIONREG 0x0B // helpfully called 'page nine'
2827
2828 #ifndef ISSI_TIMEOUT
2829- #define ISSI_TIMEOUT 100
2830+# define ISSI_TIMEOUT 100
2831 #endif
2832
2833 #ifndef ISSI_PERSISTENCE
2834- #define ISSI_PERSISTENCE 0
2835+# define ISSI_PERSISTENCE 0
2836 #endif
2837
2838 // Transfer buffer for TWITransmitData()
2839@@ -71,10 +71,10 @@ uint8_t g_twi_transfer_buffer[20];
2840 // buffers and the transfers in IS31FL3731_write_pwm_buffer() but it's
2841 // probably not worth the extra complexity.
2842 uint8_t g_pwm_buffer[DRIVER_COUNT][144];
2843-bool g_pwm_buffer_update_required[DRIVER_COUNT] = { false };
2844+bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
2845
2846-uint8_t g_led_control_registers[DRIVER_COUNT][18] = { { 0 }, { 0 } };
2847-bool g_led_control_registers_update_required[DRIVER_COUNT] = { false };
2848+uint8_t g_led_control_registers[DRIVER_COUNT][18] = {{0}, {0}};
2849+bool g_led_control_registers_update_required[DRIVER_COUNT] = {false};
2850
2851 // This is the bit pattern in the LED control registers
2852 // (for matrix A, add one to register for matrix B)
2853@@ -90,179 +90,159 @@ bool g_led_control_registers_update_required[DRIVER_COUNT] = { false };
2854 // 0x0E - R17,G15,G14,G13,G12,G11,G10,G09
2855 // 0x10 - R16,R15,R14,R13,R12,R11,R10,R09
2856
2857-
2858-void IS31FL3731_write_register( uint8_t addr, uint8_t reg, uint8_t data )
2859-{
2860+void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
2861 g_twi_transfer_buffer[0] = reg;
2862 g_twi_transfer_buffer[1] = data;
2863
2864- #if ISSI_PERSISTENCE > 0
2865+#if ISSI_PERSISTENCE > 0
2866 for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
2867- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0)
2868- break;
2869+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break;
2870 }
2871- #else
2872+#else
2873 i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
2874- #endif
2875+#endif
2876 }
2877
2878-void IS31FL3731_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer )
2879-{
2880+void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
2881 // assumes bank is already selected
2882
2883 // transmit PWM registers in 9 transfers of 16 bytes
2884 // g_twi_transfer_buffer[] is 20 bytes
2885
2886 // iterate over the pwm_buffer contents at 16 byte intervals
2887- for ( int i = 0; i < 144; i += 16 ) {
2888+ for (int i = 0; i < 144; i += 16) {
2889diff --git a/drivers/issi/is31fl3731.h b/drivers/issi/is31fl3731.h
2890index 968638f86af8460c7fc87f08cb148b5e6035fc32..6a7a45d8fff01f3795d54a4a4429485eb9e7aa92 100644
2891--- a/drivers/issi/is31fl3731.h
2892+++ b/drivers/issi/is31fl3731.h
2893@@ -15,7 +15,6 @@
2894 * along with this program. If not, see <http://www.gnu.org/licenses/>.
2895 */
2896
2897-
2898 #ifndef IS31FL3731_DRIVER_H
2899 #define IS31FL3731_DRIVER_H
2900
2901@@ -23,40 +22,40 @@
2902 #include <stdbool.h>
2903
2904 typedef struct is31_led {
2905- uint8_t driver:2;
2906- uint8_t r;
2907- uint8_t g;
2908- uint8_t b;
2909+ uint8_t driver : 2;
2910+ uint8_t r;
2911+ uint8_t g;
2912+ uint8_t b;
2913 } __attribute__((packed)) is31_led;
2914
2915 extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
2916
2917-void IS31FL3731_init( uint8_t addr );
2918-void IS31FL3731_write_register( uint8_t addr, uint8_t reg, uint8_t data );
2919-void IS31FL3731_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer );
2920+void IS31FL3731_init(uint8_t addr);
2921+void IS31FL3731_write_register(uint8_t addr, uint8_t reg, uint8_t data);
2922+void IS31FL3731_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
2923
2924-void IS31FL3731_set_color( int index, uint8_t red, uint8_t green, uint8_t blue );
2925-void IS31FL3731_set_color_all( uint8_t red, uint8_t green, uint8_t blue );
2926+void IS31FL3731_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
2927+void IS31FL3731_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
2928
2929-void IS31FL3731_set_led_control_register( uint8_t index, bool red, bool green, bool blue );
2930+void IS31FL3731_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
2931
2932 // This should not be called from an interrupt
2933 // (eg. from a timer interrupt).
2934 // Call this while idle (in between matrix scans).
2935 // If the buffer is dirty, it will update the driver with the buffer.
2936-void IS31FL3731_update_pwm_buffers( uint8_t addr, uint8_t index );
2937-void IS31FL3731_update_led_control_registers( uint8_t addr, uint8_t index );
2938-
2939-#define C1_1 0x24
2940-#define C1_2 0x25
2941-#define C1_3 0x26
2942-#define C1_4 0x27
2943-#define C1_5 0x28
2944-#define C1_6 0x29
2945-#define C1_7 0x2A
2946-#define C1_8 0x2B
2947-
2948-#define C1_9 0x2C
2949+void IS31FL3731_update_pwm_buffers(uint8_t addr, uint8_t index);
2950+void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index);
2951+
2952+#define C1_1 0x24
2953+#define C1_2 0x25
2954+#define C1_3 0x26
2955+#define C1_4 0x27
2956+#define C1_5 0x28
2957+#define C1_6 0x29
2958+#define C1_7 0x2A
2959+#define C1_8 0x2B
2960+
2961+#define C1_9 0x2C
2962 #define C1_10 0x2D
2963 #define C1_11 0x2E
2964 #define C1_12 0x2F
2965@@ -65,16 +64,16 @@ void IS31FL3731_update_led_control_registers( uint8_t addr, uint8_t index );
2966 #define C1_15 0x32
2967 #define C1_16 0x33
2968
2969-#define C2_1 0x34
2970-#define C2_2 0x35
2971-#define C2_3 0x36
2972-#define C2_4 0x37
2973-#define C2_5 0x38
2974-#define C2_6 0x39
2975-#define C2_7 0x3A
2976-#define C2_8 0x3B
2977+#define C2_1 0x34
2978+#define C2_2 0x35
2979+#define C2_3 0x36
2980+#define C2_4 0x37
2981+#define C2_5 0x38
2982+#define C2_6 0x39
2983+#define C2_7 0x3A
2984+#define C2_8 0x3B
2985
2986-#define C2_9 0x3C
2987+#define C2_9 0x3C
2988 #define C2_10 0x3D
2989 #define C2_11 0x3E
2990 #define C2_12 0x3F
2991@@ -83,16 +82,16 @@ void IS31FL3731_update_led_control_registers( uint8_t addr, uint8_t index );
2992 #define C2_15 0x42
2993diff --git a/drivers/issi/is31fl3733.c b/drivers/issi/is31fl3733.c
2994index aa247f4e8a2a1de9816cc45452fa586f8f57639d..968f072de8768f15728cd6eaa5b800b808b4a5e7 100644
2995--- a/drivers/issi/is31fl3733.c
2996+++ b/drivers/issi/is31fl3733.c
2997@@ -17,11 +17,11 @@
2998 */
2999
3000 #ifdef __AVR__
3001-#include <avr/interrupt.h>
3002-#include <avr/io.h>
3003-#include <util/delay.h>
3004+# include <avr/interrupt.h>
3005+# include <avr/io.h>
3006+# include <util/delay.h>
3007 #else
3008-#include "wait.h"
3009+# include "wait.h"
3010 #endif
3011
3012 #include "is31fl3733.h"
3013@@ -46,23 +46,23 @@
3014 #define ISSI_INTERRUPTMASKREGISTER 0xF0
3015 #define ISSI_INTERRUPTSTATUSREGISTER 0xF1
3016
3017-#define ISSI_PAGE_LEDCONTROL 0x00 //PG0
3018-#define ISSI_PAGE_PWM 0x01 //PG1
3019-#define ISSI_PAGE_AUTOBREATH 0x02 //PG2
3020-#define ISSI_PAGE_FUNCTION 0x03 //PG3
3021+#define ISSI_PAGE_LEDCONTROL 0x00 // PG0
3022+#define ISSI_PAGE_PWM 0x01 // PG1
3023+#define ISSI_PAGE_AUTOBREATH 0x02 // PG2
3024+#define ISSI_PAGE_FUNCTION 0x03 // PG3
3025
3026-#define ISSI_REG_CONFIGURATION 0x00 //PG3
3027-#define ISSI_REG_GLOBALCURRENT 0x01 //PG3
3028-#define ISSI_REG_RESET 0x11// PG3
3029-#define ISSI_REG_SWPULLUP 0x0F //PG3
3030-#define ISSI_REG_CSPULLUP 0x10 //PG3
3031+#define ISSI_REG_CONFIGURATION 0x00 // PG3
3032+#define ISSI_REG_GLOBALCURRENT 0x01 // PG3
3033+#define ISSI_REG_RESET 0x11 // PG3
3034+#define ISSI_REG_SWPULLUP 0x0F // PG3
3035+#define ISSI_REG_CSPULLUP 0x10 // PG3
3036
3037 #ifndef ISSI_TIMEOUT
3038- #define ISSI_TIMEOUT 100
3039+# define ISSI_TIMEOUT 100
3040 #endif
3041
3042 #ifndef ISSI_PERSISTENCE
3043- #define ISSI_PERSISTENCE 0
3044+# define ISSI_PERSISTENCE 0
3045 #endif
3046
3047 // Transfer buffer for TWITransmitData()
3048@@ -75,56 +75,51 @@ uint8_t g_twi_transfer_buffer[20];
3049 // buffers and the transfers in IS31FL3733_write_pwm_buffer() but it's
3050 // probably not worth the extra complexity.
3051 uint8_t g_pwm_buffer[DRIVER_COUNT][192];
3052-bool g_pwm_buffer_update_required[DRIVER_COUNT] = { false };
3053+bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
3054
3055-uint8_t g_led_control_registers[DRIVER_COUNT][24] = { { 0 }, { 0 } };
3056-bool g_led_control_registers_update_required[DRIVER_COUNT] = { false };
3057+uint8_t g_led_control_registers[DRIVER_COUNT][24] = {{0}, {0}};
3058+bool g_led_control_registers_update_required[DRIVER_COUNT] = {false};
3059
3060-void IS31FL3733_write_register( uint8_t addr, uint8_t reg, uint8_t data )
3061-{
3062+void IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
3063 g_twi_transfer_buffer[0] = reg;
3064 g_twi_transfer_buffer[1] = data;
3065
3066- #if ISSI_PERSISTENCE > 0
3067+#if ISSI_PERSISTENCE > 0
3068 for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
3069- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0)
3070- break;
3071+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break;
3072 }
3073- #else
3074+#else
3075 i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
3076- #endif
3077+#endif
3078 }
3079
3080-void IS31FL3733_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer )
3081-{
3082+void IS31FL3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
3083 // assumes PG1 is already selected
3084
3085 // transmit PWM registers in 12 transfers of 16 bytes
3086 // g_twi_transfer_buffer[] is 20 bytes
3087
3088 // iterate over the pwm_buffer contents at 16 byte intervals
3089- for ( int i = 0; i < 192; i += 16 ) {
3090+ for (int i = 0; i < 192; i += 16) {
3091 g_twi_transfer_buffer[0] = i;
3092 // copy the data from i to i+15
3093 // device will auto-increment register for data after the first byte
3094 // thus this sets registers 0x00-0x0F, 0x10-0x1F, etc. in one transfer
3095- for ( int j = 0; j < 16; j++ ) {
3096+ for (int j = 0; j < 16; j++) {
3097diff --git a/drivers/issi/is31fl3733.h b/drivers/issi/is31fl3733.h
3098index e117b2546009ad7d15d2869846bddbd946b71b26..5b3283e035f63120134320e23db5eb0072947c5c 100644
3099--- a/drivers/issi/is31fl3733.h
3100+++ b/drivers/issi/is31fl3733.h
3101@@ -16,7 +16,6 @@
3102 * along with this program. If not, see <http://www.gnu.org/licenses/>.
3103 */
3104
3105-
3106 #ifndef IS31FL3733_DRIVER_H
3107 #define IS31FL3733_DRIVER_H
3108
3109@@ -24,232 +23,232 @@
3110 #include <stdbool.h>
3111
3112 typedef struct is31_led {
3113- uint8_t driver:2;
3114- uint8_t r;
3115- uint8_t g;
3116- uint8_t b;
3117+ uint8_t driver : 2;
3118+ uint8_t r;
3119+ uint8_t g;
3120+ uint8_t b;
3121 } __attribute__((packed)) is31_led;
3122
3123 extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
3124
3125-void IS31FL3733_init( uint8_t addr, uint8_t sync );
3126-void IS31FL3733_write_register( uint8_t addr, uint8_t reg, uint8_t data );
3127-void IS31FL3733_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer );
3128+void IS31FL3733_init(uint8_t addr, uint8_t sync);
3129+void IS31FL3733_write_register(uint8_t addr, uint8_t reg, uint8_t data);
3130+void IS31FL3733_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
3131
3132-void IS31FL3733_set_color( int index, uint8_t red, uint8_t green, uint8_t blue );
3133-void IS31FL3733_set_color_all( uint8_t red, uint8_t green, uint8_t blue );
3134+void IS31FL3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
3135+void IS31FL3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
3136
3137-void IS31FL3733_set_led_control_register( uint8_t index, bool red, bool green, bool blue );
3138+void IS31FL3733_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
3139
3140 // This should not be called from an interrupt
3141 // (eg. from a timer interrupt).
3142 // Call this while idle (in between matrix scans).
3143 // If the buffer is dirty, it will update the driver with the buffer.
3144-void IS31FL3733_update_pwm_buffers( uint8_t addr, uint8_t index );
3145-void IS31FL3733_update_led_control_registers( uint8_t addr, uint8_t index );
3146-
3147-#define A_1 0x00
3148-#define A_2 0x01
3149-#define A_3 0x02
3150-#define A_4 0x03
3151-#define A_5 0x04
3152-#define A_6 0x05
3153-#define A_7 0x06
3154-#define A_8 0x07
3155-#define A_9 0x08
3156-#define A_10 0x09
3157-#define A_11 0x0A
3158-#define A_12 0x0B
3159-#define A_13 0x0C
3160-#define A_14 0x0D
3161-#define A_15 0x0E
3162-#define A_16 0x0F
3163-
3164-#define B_1 0x10
3165-#define B_2 0x11
3166-#define B_3 0x12
3167-#define B_4 0x13
3168-#define B_5 0x14
3169-#define B_6 0x15
3170-#define B_7 0x16
3171-#define B_8 0x17
3172-#define B_9 0x18
3173-#define B_10 0x19
3174-#define B_11 0x1A
3175-#define B_12 0x1B
3176-#define B_13 0x1C
3177-#define B_14 0x1D
3178-#define B_15 0x1E
3179-#define B_16 0x1F
3180-
3181-#define C_1 0x20
3182-#define C_2 0x21
3183-#define C_3 0x22
3184-#define C_4 0x23
3185-#define C_5 0x24
3186-#define C_6 0x25
3187-#define C_7 0x26
3188-#define C_8 0x27
3189-#define C_9 0x28
3190-#define C_10 0x29
3191-#define C_11 0x2A
3192-#define C_12 0x2B
3193-#define C_13 0x2C
3194-#define C_14 0x2D
3195-#define C_15 0x2E
3196-#define C_16 0x2F
3197-
3198-#define D_1 0x30
3199-#define D_2 0x31
3200-#define D_3 0x32
3201diff --git a/drivers/issi/is31fl3736.c b/drivers/issi/is31fl3736.c
3202index c5d43109719880714f4373aa9a83b432547997ec..754292425ec8d57ff670f7b9e45a7e3e12fc8b6f 100644
3203--- a/drivers/issi/is31fl3736.c
3204+++ b/drivers/issi/is31fl3736.c
3205@@ -14,13 +14,12 @@
3206 * along with this program. If not, see <http://www.gnu.org/licenses/>.
3207 */
3208
3209-
3210 #ifdef __AVR__
3211-#include <avr/interrupt.h>
3212-#include <avr/io.h>
3213-#include <util/delay.h>
3214+# include <avr/interrupt.h>
3215+# include <avr/io.h>
3216+# include <util/delay.h>
3217 #else
3218-#include "wait.h"
3219+# include "wait.h"
3220 #endif
3221
3222 #include "is31fl3736.h"
3223@@ -28,8 +27,6 @@
3224 #include "i2c_master.h"
3225 #include "progmem.h"
3226
3227-
3228-
3229 // This is a 7-bit address, that gets left-shifted and bit 0
3230 // set to 0 for write, 1 for read (as per I2C protocol)
3231 // The address will vary depending on your wiring:
3232@@ -47,23 +44,23 @@
3233 #define ISSI_INTERRUPTMASKREGISTER 0xF0
3234 #define ISSI_INTERRUPTSTATUSREGISTER 0xF1
3235
3236-#define ISSI_PAGE_LEDCONTROL 0x00 //PG0
3237-#define ISSI_PAGE_PWM 0x01 //PG1
3238-#define ISSI_PAGE_AUTOBREATH 0x02 //PG2
3239-#define ISSI_PAGE_FUNCTION 0x03 //PG3
3240+#define ISSI_PAGE_LEDCONTROL 0x00 // PG0
3241+#define ISSI_PAGE_PWM 0x01 // PG1
3242+#define ISSI_PAGE_AUTOBREATH 0x02 // PG2
3243+#define ISSI_PAGE_FUNCTION 0x03 // PG3
3244
3245-#define ISSI_REG_CONFIGURATION 0x00 //PG3
3246-#define ISSI_REG_GLOBALCURRENT 0x01 //PG3
3247-#define ISSI_REG_RESET 0x11// PG3
3248-#define ISSI_REG_SWPULLUP 0x0F //PG3
3249-#define ISSI_REG_CSPULLUP 0x10 //PG3
3250+#define ISSI_REG_CONFIGURATION 0x00 // PG3
3251+#define ISSI_REG_GLOBALCURRENT 0x01 // PG3
3252+#define ISSI_REG_RESET 0x11 // PG3
3253+#define ISSI_REG_SWPULLUP 0x0F // PG3
3254+#define ISSI_REG_CSPULLUP 0x10 // PG3
3255
3256 #ifndef ISSI_TIMEOUT
3257- #define ISSI_TIMEOUT 100
3258+# define ISSI_TIMEOUT 100
3259 #endif
3260
3261 #ifndef ISSI_PERSISTENCE
3262- #define ISSI_PERSISTENCE 0
3263+# define ISSI_PERSISTENCE 0
3264 #endif
3265
3266 // Transfer buffer for TWITransmitData()
3267@@ -76,124 +73,113 @@ uint8_t g_twi_transfer_buffer[20];
3268 // buffers and the transfers in IS31FL3736_write_pwm_buffer() but it's
3269 // probably not worth the extra complexity.
3270 uint8_t g_pwm_buffer[DRIVER_COUNT][192];
3271-bool g_pwm_buffer_update_required = false;
3272+bool g_pwm_buffer_update_required = false;
3273
3274-uint8_t g_led_control_registers[DRIVER_COUNT][24] = { { 0 }, { 0 } };
3275-bool g_led_control_registers_update_required = false;
3276+uint8_t g_led_control_registers[DRIVER_COUNT][24] = {{0}, {0}};
3277+bool g_led_control_registers_update_required = false;
3278
3279-void IS31FL3736_write_register( uint8_t addr, uint8_t reg, uint8_t data )
3280-{
3281+void IS31FL3736_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
3282 g_twi_transfer_buffer[0] = reg;
3283 g_twi_transfer_buffer[1] = data;
3284
3285- #if ISSI_PERSISTENCE > 0
3286+#if ISSI_PERSISTENCE > 0
3287 for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
3288- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0)
3289- break;
3290+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break;
3291 }
3292- #else
3293+#else
3294 i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
3295- #endif
3296+#endif
3297 }
3298
3299-void IS31FL3736_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer )
3300-{
3301+void IS31FL3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
3302 // assumes PG1 is already selected
3303
3304 // transmit PWM registers in 12 transfers of 16 bytes
3305diff --git a/drivers/issi/is31fl3736.h b/drivers/issi/is31fl3736.h
3306index cff50fd0d8863c5837f19d90bb3b9261403e28ee..e48e31c27917c59368b351643330e507027b7d9b 100644
3307--- a/drivers/issi/is31fl3736.h
3308+++ b/drivers/issi/is31fl3736.h
3309@@ -19,154 +19,150 @@
3310 #include <stdint.h>
3311 #include <stdbool.h>
3312
3313-
3314 // Simple interface option.
3315 // If these aren't defined, just define them to make it compile
3316
3317-
3318 #ifndef DRIVER_COUNT
3319-#define DRIVER_COUNT 2
3320+# define DRIVER_COUNT 2
3321 #endif
3322
3323 #ifndef DRIVER_LED_TOTAL
3324-#define DRIVER_LED_TOTAL 96
3325+# define DRIVER_LED_TOTAL 96
3326 #endif
3327
3328-
3329 typedef struct is31_led {
3330- uint8_t driver:2;
3331- uint8_t r;
3332- uint8_t g;
3333- uint8_t b;
3334+ uint8_t driver : 2;
3335+ uint8_t r;
3336+ uint8_t g;
3337+ uint8_t b;
3338 } __attribute__((packed)) is31_led;
3339
3340 extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
3341
3342-void IS31FL3736_init( uint8_t addr );
3343-void IS31FL3736_write_register( uint8_t addr, uint8_t reg, uint8_t data );
3344-void IS31FL3736_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer );
3345+void IS31FL3736_init(uint8_t addr);
3346+void IS31FL3736_write_register(uint8_t addr, uint8_t reg, uint8_t data);
3347+void IS31FL3736_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
3348
3349-void IS31FL3736_set_color( int index, uint8_t red, uint8_t green, uint8_t blue );
3350-void IS31FL3736_set_color_all( uint8_t red, uint8_t green, uint8_t blue );
3351+void IS31FL3736_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
3352+void IS31FL3736_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
3353
3354-void IS31FL3736_set_led_control_register( uint8_t index, bool red, bool green, bool blue );
3355+void IS31FL3736_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
3356
3357-void IS31FL3736_mono_set_brightness( int index, uint8_t value );
3358-void IS31FL3736_mono_set_brightness_all( uint8_t value );
3359-void IS31FL3736_mono_set_led_control_register( uint8_t index, bool enabled );
3360+void IS31FL3736_mono_set_brightness(int index, uint8_t value);
3361+void IS31FL3736_mono_set_brightness_all(uint8_t value);
3362+void IS31FL3736_mono_set_led_control_register(uint8_t index, bool enabled);
3363
3364 // This should not be called from an interrupt
3365 // (eg. from a timer interrupt).
3366 // Call this while idle (in between matrix scans).
3367 // If the buffer is dirty, it will update the driver with the buffer.
3368-void IS31FL3736_update_pwm_buffers( uint8_t addr1, uint8_t addr2 );
3369-void IS31FL3736_update_led_control_registers( uint8_t addr1, uint8_t addr2 );
3370-
3371-#define A_1 0x00
3372-#define A_2 0x02
3373-#define A_3 0x04
3374-#define A_4 0x06
3375-#define A_5 0x08
3376-#define A_6 0x0A
3377-#define A_7 0x0C
3378-#define A_8 0x0E
3379-
3380-#define B_1 0x10
3381-#define B_2 0x12
3382-#define B_3 0x14
3383-#define B_4 0x16
3384-#define B_5 0x18
3385-#define B_6 0x1A
3386-#define B_7 0x1C
3387-#define B_8 0x1E
3388-
3389-#define C_1 0x20
3390-#define C_2 0x22
3391-#define C_3 0x24
3392-#define C_4 0x26
3393-#define C_5 0x28
3394-#define C_6 0x2A
3395-#define C_7 0x2C
3396-#define C_8 0x2E
3397-
3398-#define D_1 0x30
3399-#define D_2 0x32
3400-#define D_3 0x34
3401-#define D_4 0x36
3402-#define D_5 0x38
3403-#define D_6 0x3A
3404-#define D_7 0x3C
3405-#define D_8 0x3E
3406-
3407-#define E_1 0x40
3408-#define E_2 0x42
3409diff --git a/drivers/issi/is31fl3737.c b/drivers/issi/is31fl3737.c
3410index 6491049274b5cf0515750ee841fba4cff4906489..4cc46272e24142ecd19bf92712d88a7945e76550 100644
3411--- a/drivers/issi/is31fl3737.c
3412+++ b/drivers/issi/is31fl3737.c
3413@@ -17,11 +17,11 @@
3414 */
3415
3416 #ifdef __AVR__
3417-#include <avr/interrupt.h>
3418-#include <avr/io.h>
3419-#include <util/delay.h>
3420+# include <avr/interrupt.h>
3421+# include <avr/io.h>
3422+# include <util/delay.h>
3423 #else
3424-#include "wait.h"
3425+# include "wait.h"
3426 #endif
3427
3428 #include <string.h>
3429@@ -46,23 +46,23 @@
3430 #define ISSI_INTERRUPTMASKREGISTER 0xF0
3431 #define ISSI_INTERRUPTSTATUSREGISTER 0xF1
3432
3433-#define ISSI_PAGE_LEDCONTROL 0x00 //PG0
3434-#define ISSI_PAGE_PWM 0x01 //PG1
3435-#define ISSI_PAGE_AUTOBREATH 0x02 //PG2
3436-#define ISSI_PAGE_FUNCTION 0x03 //PG3
3437+#define ISSI_PAGE_LEDCONTROL 0x00 // PG0
3438+#define ISSI_PAGE_PWM 0x01 // PG1
3439+#define ISSI_PAGE_AUTOBREATH 0x02 // PG2
3440+#define ISSI_PAGE_FUNCTION 0x03 // PG3
3441
3442-#define ISSI_REG_CONFIGURATION 0x00 //PG3
3443-#define ISSI_REG_GLOBALCURRENT 0x01 //PG3
3444-#define ISSI_REG_RESET 0x11// PG3
3445-#define ISSI_REG_SWPULLUP 0x0F //PG3
3446-#define ISSI_REG_CSPULLUP 0x10 //PG3
3447+#define ISSI_REG_CONFIGURATION 0x00 // PG3
3448+#define ISSI_REG_GLOBALCURRENT 0x01 // PG3
3449+#define ISSI_REG_RESET 0x11 // PG3
3450+#define ISSI_REG_SWPULLUP 0x0F // PG3
3451+#define ISSI_REG_CSPULLUP 0x10 // PG3
3452
3453 #ifndef ISSI_TIMEOUT
3454- #define ISSI_TIMEOUT 100
3455+# define ISSI_TIMEOUT 100
3456 #endif
3457
3458 #ifndef ISSI_PERSISTENCE
3459- #define ISSI_PERSISTENCE 0
3460+# define ISSI_PERSISTENCE 0
3461 #endif
3462
3463 // Transfer buffer for TWITransmitData()
3464@@ -75,178 +75,161 @@ uint8_t g_twi_transfer_buffer[20];
3465 // buffers and the transfers in IS31FL3737_write_pwm_buffer() but it's
3466 // probably not worth the extra complexity.
3467 uint8_t g_pwm_buffer[DRIVER_COUNT][192];
3468-bool g_pwm_buffer_update_required = false;
3469+bool g_pwm_buffer_update_required = false;
3470
3471-uint8_t g_led_control_registers[DRIVER_COUNT][24] = { { 0 } };
3472-bool g_led_control_registers_update_required = false;
3473+uint8_t g_led_control_registers[DRIVER_COUNT][24] = {{0}};
3474+bool g_led_control_registers_update_required = false;
3475
3476-void IS31FL3737_write_register( uint8_t addr, uint8_t reg, uint8_t data )
3477-{
3478+void IS31FL3737_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
3479 g_twi_transfer_buffer[0] = reg;
3480 g_twi_transfer_buffer[1] = data;
3481
3482- #if ISSI_PERSISTENCE > 0
3483+#if ISSI_PERSISTENCE > 0
3484 for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
3485- if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0)
3486- break;
3487+ if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break;
3488 }
3489- #else
3490+#else
3491 i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
3492- #endif
3493+#endif
3494 }
3495
3496-void IS31FL3737_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer )
3497-{
3498+void IS31FL3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
3499 // assumes PG1 is already selected
3500
3501 // transmit PWM registers in 12 transfers of 16 bytes
3502 // g_twi_transfer_buffer[] is 20 bytes
3503
3504 // iterate over the pwm_buffer contents at 16 byte intervals
3505- for ( int i = 0; i < 192; i += 16 ) {
3506+ for (int i = 0; i < 192; i += 16) {
3507 g_twi_transfer_buffer[0] = i;
3508 // copy the data from i to i+15
3509 // device will auto-increment register for data after the first byte
3510 // thus this sets registers 0x00-0x0F, 0x10-0x1F, etc. in one transfer
3511- for ( int j = 0; j < 16; j++ ) {
3512+ for (int j = 0; j < 16; j++) {
3513diff --git a/drivers/issi/is31fl3737.h b/drivers/issi/is31fl3737.h
3514index 69c4b9b538f8e9cc7dc13165276021d97f60753c..2c2fb19641371bbf136bff21ad3267e13e88f24c 100644
3515--- a/drivers/issi/is31fl3737.h
3516+++ b/drivers/issi/is31fl3737.h
3517@@ -16,7 +16,6 @@
3518 * along with this program. If not, see <http://www.gnu.org/licenses/>.
3519 */
3520
3521-
3522 #ifndef IS31FL3737_DRIVER_H
3523 #define IS31FL3737_DRIVER_H
3524
3525@@ -24,184 +23,184 @@
3526 #include <stdbool.h>
3527
3528 typedef struct is31_led {
3529- uint8_t driver:2;
3530- uint8_t r;
3531- uint8_t g;
3532- uint8_t b;
3533+ uint8_t driver : 2;
3534+ uint8_t r;
3535+ uint8_t g;
3536+ uint8_t b;
3537 } __attribute__((packed)) is31_led;
3538
3539 extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
3540
3541-void IS31FL3737_init( uint8_t addr );
3542-void IS31FL3737_write_register( uint8_t addr, uint8_t reg, uint8_t data );
3543-void IS31FL3737_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer );
3544+void IS31FL3737_init(uint8_t addr);
3545+void IS31FL3737_write_register(uint8_t addr, uint8_t reg, uint8_t data);
3546+void IS31FL3737_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
3547
3548-void IS31FL3737_set_color( int index, uint8_t red, uint8_t green, uint8_t blue );
3549-void IS31FL3737_set_color_all( uint8_t red, uint8_t green, uint8_t blue );
3550+void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
3551+void IS31FL3737_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
3552
3553-void IS31FL3737_set_led_control_register( uint8_t index, bool red, bool green, bool blue );
3554+void IS31FL3737_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
3555
3556 // This should not be called from an interrupt
3557 // (eg. from a timer interrupt).
3558 // Call this while idle (in between matrix scans).
3559 // If the buffer is dirty, it will update the driver with the buffer.
3560-void IS31FL3737_update_pwm_buffers( uint8_t addr1, uint8_t addr2 );
3561-void IS31FL3737_update_led_control_registers( uint8_t addr1, uint8_t addr2 );
3562-
3563-#define A_1 0x00
3564-#define A_2 0x01
3565-#define A_3 0x02
3566-#define A_4 0x03
3567-#define A_5 0x04
3568-#define A_6 0x05
3569-#define A_7 0x08
3570-#define A_8 0x09
3571-#define A_9 0x0A
3572-#define A_10 0x0B
3573-#define A_11 0x0C
3574-#define A_12 0x0D
3575-
3576-#define B_1 0x10
3577-#define B_2 0x11
3578-#define B_3 0x12
3579-#define B_4 0x13
3580-#define B_5 0x14
3581-#define B_6 0x15
3582-#define B_7 0x18
3583-#define B_8 0x19
3584-#define B_9 0x1A
3585-#define B_10 0x1B
3586-#define B_11 0x1C
3587-#define B_12 0x1D
3588-
3589-#define C_1 0x20
3590-#define C_2 0x21
3591-#define C_3 0x22
3592-#define C_4 0x23
3593-#define C_5 0x24
3594-#define C_6 0x25
3595-#define C_7 0x28
3596-#define C_8 0x29
3597-#define C_9 0x2A
3598-#define C_10 0x2B
3599-#define C_11 0x2C
3600-#define C_12 0x2D
3601-
3602-#define D_1 0x30
3603-#define D_2 0x31
3604-#define D_3 0x32
3605-#define D_4 0x33
3606-#define D_5 0x34
3607-#define D_6 0x35
3608-#define D_7 0x38
3609-#define D_8 0x39
3610-#define D_9 0x3A
3611-#define D_10 0x3B
3612-#define D_11 0x3C
3613-#define D_12 0x3D
3614-
3615-#define E_1 0x40
3616-#define E_2 0x41
3617diff --git a/drivers/oled/glcdfont.c b/drivers/oled/glcdfont.c
3618index 8b969057e531b37798d3d094885cf7f384d21307..95c5d2ebf417cb562b4d328fa21fbdbb5a52bc0a 100644
3619--- a/drivers/oled/glcdfont.c
3620+++ b/drivers/oled/glcdfont.c
3621@@ -1,240 +1,25 @@
3622 #pragma once
3623
3624 #ifdef __AVR__
3625- #include <avr/io.h>
3626- #include <avr/pgmspace.h>
3627+# include <avr/io.h>
3628+# include <avr/pgmspace.h>
3629 #elif defined(ESP8266)
3630- #include <pgmspace.h>
3631+# include <pgmspace.h>
3632 #else
3633- #define PROGMEM
3634+# define PROGMEM
3635 #endif
3636
3637 // Helidox 8x6 font with QMK Firmware Logo
3638 // Online editor: http://teripom.x0.com/
3639
3640 static const unsigned char font[] PROGMEM = {
3641- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3642- 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00,
3643- 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00,
3644- 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00,
3645- 0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00,
3646- 0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00,
3647- 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00,
3648- 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00,
3649- 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00,
3650- 0x00, 0x18, 0x24, 0x18, 0x00, 0x00,
3651- 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00,
3652- 0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00,
3653- 0x26, 0x29, 0x79, 0x29, 0x26, 0x00,
3654- 0x40, 0x7F, 0x05, 0x05, 0x07, 0x00,
3655- 0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00,
3656- 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00,
3657- 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00,
3658- 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00,
3659- 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00,
3660- 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00,
3661- 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00,
3662- 0x00, 0x66, 0x89, 0x95, 0x6A, 0x00,
3663- 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
3664- 0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00,
3665- 0x08, 0x04, 0x7E, 0x04, 0x08, 0x00,
3666- 0x10, 0x20, 0x7E, 0x20, 0x10, 0x00,
3667- 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00,
3668- 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00,
3669- 0x1E, 0x10, 0x10, 0x10, 0x10, 0x00,
3670- 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00,
3671- 0x30, 0x38, 0x3E, 0x38, 0x30, 0x00,
3672- 0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00,
3673- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3674- 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00,
3675- 0x00, 0x07, 0x00, 0x07, 0x00, 0x00,
3676- 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00,
3677- 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00,
3678- 0x23, 0x13, 0x08, 0x64, 0x62, 0x00,
3679- 0x36, 0x49, 0x56, 0x20, 0x50, 0x00,
3680- 0x00, 0x08, 0x07, 0x03, 0x00, 0x00,
3681- 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00,
3682- 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00,
3683- 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00,
3684- 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00,
3685- 0x00, 0x80, 0x70, 0x30, 0x00, 0x00,
3686- 0x08, 0x08, 0x08, 0x08, 0x08, 0x00,
3687- 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
3688- 0x20, 0x10, 0x08, 0x04, 0x02, 0x00,
3689- 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00,
3690- 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00,
3691- 0x72, 0x49, 0x49, 0x49, 0x46, 0x00,
3692- 0x21, 0x41, 0x49, 0x4D, 0x33, 0x00,
3693- 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00,
3694- 0x27, 0x45, 0x45, 0x45, 0x39, 0x00,
3695- 0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00,
3696- 0x41, 0x21, 0x11, 0x09, 0x07, 0x00,
3697- 0x36, 0x49, 0x49, 0x49, 0x36, 0x00,
3698- 0x46, 0x49, 0x49, 0x29, 0x1E, 0x00,
3699- 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
3700- 0x00, 0x40, 0x34, 0x00, 0x00, 0x00,
3701- 0x00, 0x08, 0x14, 0x22, 0x41, 0x00,
3702- 0x14, 0x14, 0x14, 0x14, 0x14, 0x00,
3703- 0x00, 0x41, 0x22, 0x14, 0x08, 0x00,
3704- 0x02, 0x01, 0x59, 0x09, 0x06, 0x00,
3705- 0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00,
3706- 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00,
3707- 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00,
3708- 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00,
3709- 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00,
3710- 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00,
3711- 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00,
3712- 0x3E, 0x41, 0x41, 0x51, 0x73, 0x00,
3713- 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00,
3714- 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00,
3715- 0x20, 0x40, 0x41, 0x3F, 0x01, 0x00,
3716- 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00,
3717- 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00,
3718- 0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00,
3719- 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00,
3720- 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00,
3721diff --git a/drivers/oled/oled_driver.c b/drivers/oled/oled_driver.c
3722index 3dad72addb57acd67fefdd2e483ce511b05d8490..1a1b7299bba10402144502109dd48387cc68ca79 100644
3723--- a/drivers/oled/oled_driver.c
3724+++ b/drivers/oled/oled_driver.c
3725@@ -23,64 +23,64 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
3726 #include <string.h>
3727
3728 #if defined(__AVR__)
3729- #include <avr/io.h>
3730- #include <avr/pgmspace.h>
3731+# include <avr/io.h>
3732+# include <avr/pgmspace.h>
3733 #elif defined(ESP8266)
3734- #include <pgmspace.h>
3735-#else // defined(ESP8266)
3736- #define PROGMEM
3737- #define memcpy_P(des, src, len) memcpy(des, src, len)
3738-#endif // defined(__AVR__)
3739+# include <pgmspace.h>
3740+#else // defined(ESP8266)
3741+# define PROGMEM
3742+# define memcpy_P(des, src, len) memcpy(des, src, len)
3743+#endif // defined(__AVR__)
3744
3745 // Used commands from spec sheet: https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf
3746 // for SH1106: https://www.velleman.eu/downloads/29/infosheets/sh1106_datasheet.pdf
3747
3748 // Fundamental Commands
3749-#define CONTRAST 0x81
3750-#define DISPLAY_ALL_ON 0xA5
3751-#define DISPLAY_ALL_ON_RESUME 0xA4
3752-#define NORMAL_DISPLAY 0xA6
3753-#define DISPLAY_ON 0xAF
3754-#define DISPLAY_OFF 0xAE
3755-#define NOP 0xE3
3756+#define CONTRAST 0x81
3757+#define DISPLAY_ALL_ON 0xA5
3758+#define DISPLAY_ALL_ON_RESUME 0xA4
3759+#define NORMAL_DISPLAY 0xA6
3760+#define DISPLAY_ON 0xAF
3761+#define DISPLAY_OFF 0xAE
3762+#define NOP 0xE3
3763
3764 // Scrolling Commands
3765-#define ACTIVATE_SCROLL 0x2F
3766-#define DEACTIVATE_SCROLL 0x2E
3767-#define SCROLL_RIGHT 0x26
3768-#define SCROLL_LEFT 0x27
3769-#define SCROLL_RIGHT_UP 0x29
3770-#define SCROLL_LEFT_UP 0x2A
3771+#define ACTIVATE_SCROLL 0x2F
3772+#define DEACTIVATE_SCROLL 0x2E
3773+#define SCROLL_RIGHT 0x26
3774+#define SCROLL_LEFT 0x27
3775+#define SCROLL_RIGHT_UP 0x29
3776+#define SCROLL_LEFT_UP 0x2A
3777
3778 // Addressing Setting Commands
3779-#define MEMORY_MODE 0x20
3780-#define COLUMN_ADDR 0x21
3781-#define PAGE_ADDR 0x22
3782-#define PAM_SETCOLUMN_LSB 0x00
3783-#define PAM_SETCOLUMN_MSB 0x10
3784-#define PAM_PAGE_ADDR 0xB0 // 0xb0 -- 0xb7
3785+#define MEMORY_MODE 0x20
3786+#define COLUMN_ADDR 0x21
3787+#define PAGE_ADDR 0x22
3788+#define PAM_SETCOLUMN_LSB 0x00
3789+#define PAM_SETCOLUMN_MSB 0x10
3790+#define PAM_PAGE_ADDR 0xB0 // 0xb0 -- 0xb7
3791
3792 // Hardware Configuration Commands
3793-#define DISPLAY_START_LINE 0x40
3794-#define SEGMENT_REMAP 0xA0
3795-#define SEGMENT_REMAP_INV 0xA1
3796-#define MULTIPLEX_RATIO 0xA8
3797-#define COM_SCAN_INC 0xC0
3798-#define COM_SCAN_DEC 0xC8
3799-#define DISPLAY_OFFSET 0xD3
3800-#define COM_PINS 0xDA
3801-#define COM_PINS_SEQ 0x02
3802-#define COM_PINS_ALT 0x12
3803-#define COM_PINS_SEQ_LR 0x22
3804-#define COM_PINS_ALT_LR 0x32
3805+#define DISPLAY_START_LINE 0x40
3806+#define SEGMENT_REMAP 0xA0
3807+#define SEGMENT_REMAP_INV 0xA1
3808+#define MULTIPLEX_RATIO 0xA8
3809+#define COM_SCAN_INC 0xC0
3810+#define COM_SCAN_DEC 0xC8
3811+#define DISPLAY_OFFSET 0xD3
3812+#define COM_PINS 0xDA
3813+#define COM_PINS_SEQ 0x02
3814+#define COM_PINS_ALT 0x12
3815+#define COM_PINS_SEQ_LR 0x22
3816+#define COM_PINS_ALT_LR 0x32
3817
3818 // Timing & Driving Commands
3819-#define DISPLAY_CLOCK 0xD5
3820-#define PRE_CHARGE_PERIOD 0xD9
3821-#define VCOM_DETECT 0xDB
3822+#define DISPLAY_CLOCK 0xD5
3823+#define PRE_CHARGE_PERIOD 0xD9
3824+#define VCOM_DETECT 0xDB
3825diff --git a/drivers/oled/oled_driver.h b/drivers/oled/oled_driver.h
3826index 4f6254c98cea0646434795e30b50d382b4bbf89b..ac8a1c7651d34021665a5e6a64d0ce76ccdfc782 100644
3827--- a/drivers/oled/oled_driver.h
3828+++ b/drivers/oled/oled_driver.h
3829@@ -21,129 +21,133 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
3830
3831 // an enumeration of the chips this driver supports
3832 #define OLED_IC_SSD1306 0
3833-#define OLED_IC_SH1106 1
3834+#define OLED_IC_SH1106 1
3835
3836 #if defined(OLED_DISPLAY_CUSTOM)
3837- // Expected user to implement the necessary defines
3838+// Expected user to implement the necessary defines
3839 #elif defined(OLED_DISPLAY_128X64)
3840- // Double height 128x64
3841-#ifndef OLED_DISPLAY_WIDTH
3842- #define OLED_DISPLAY_WIDTH 128
3843-#endif
3844-#ifndef OLED_DISPLAY_HEIGHT
3845- #define OLED_DISPLAY_HEIGHT 64
3846-#endif
3847-#ifndef OLED_MATRIX_SIZE
3848- #define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 1024 (compile time mathed)
3849-#endif
3850-#ifndef OLED_BLOCK_TYPE
3851- #define OLED_BLOCK_TYPE uint16_t
3852-#endif
3853-#ifndef OLED_BLOCK_COUNT
3854- #define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 32 (compile time mathed)
3855-#endif
3856-#ifndef OLED_BLOCK_SIZE
3857- #define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 32 (compile time mathed)
3858-#endif
3859-#ifndef OLED_COM_PINS
3860- #define OLED_COM_PINS COM_PINS_ALT
3861-#endif
3862-
3863- // For 90 degree rotation, we map our internal matrix to oled matrix using fixed arrays
3864- // The OLED writes to it's memory horizontally, starting top left, but our memory starts bottom left in this mode
3865-#ifndef OLED_SOURCE_MAP
3866- #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 }
3867-#endif
3868-#ifndef OLED_TARGET_MAP
3869- #define OLED_TARGET_MAP { 56, 48, 40, 32, 24, 16, 8, 0 }
3870-#endif
3871- // If OLED_BLOCK_TYPE is uint32_t, these tables would look like:
3872- // #define OLED_SOURCE_MAP { 32, 40, 48, 56 }
3873- // #define OLED_TARGET_MAP { 24, 16, 8, 0 }
3874- // If OLED_BLOCK_TYPE is uint16_t, these tables would look like:
3875- // #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 }
3876- // #define OLED_TARGET_MAP { 56, 48, 40, 32, 24, 16, 8, 0 }
3877- // If OLED_BLOCK_TYPE is uint8_t, these tables would look like:
3878- // #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }
3879- // #define OLED_TARGET_MAP { 56, 120, 48, 112, 40, 104, 32, 96, 24, 88, 16, 80, 8, 72, 0, 64 }
3880-#else // defined(OLED_DISPLAY_128X64)
3881- // Default 128x32
3882-#ifndef OLED_DISPLAY_WIDTH
3883- #define OLED_DISPLAY_WIDTH 128
3884-#endif
3885-#ifndef OLED_DISPLAY_HEIGHT
3886- #define OLED_DISPLAY_HEIGHT 32
3887-#endif
3888-#ifndef OLED_MATRIX_SIZE
3889- #define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 512 (compile time mathed)
3890-#endif
3891-#ifndef OLED_BLOCK_TYPE
3892- #define OLED_BLOCK_TYPE uint16_t // Type to use for segmenting the oled display for smart rendering, use unsigned types only
3893-#endif
3894-#ifndef OLED_BLOCK_COUNT
3895- #define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 16 (compile time mathed)
3896-#endif
3897-#ifndef OLED_BLOCK_SIZE
3898- #define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 32 (compile time mathed)
3899-#endif
3900-#ifndef OLED_COM_PINS
3901- #define OLED_COM_PINS COM_PINS_SEQ
3902-#endif
3903-
3904- // For 90 degree rotation, we map our internal matrix to oled matrix using fixed arrays
3905- // The OLED writes to it's memory horizontally, starting top left, but our memory starts bottom left in this mode
3906-#ifndef OLED_SOURCE_MAP
3907- #define OLED_SOURCE_MAP { 0, 8, 16, 24 }
3908-#endif
3909-#ifndef OLED_TARGET_MAP
3910- #define OLED_TARGET_MAP { 24, 16, 8, 0 }
3911-#endif
3912- // If OLED_BLOCK_TYPE is uint8_t, these tables would look like:
3913- // #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 }
3914- // #define OLED_TARGET_MAP { 48, 32, 16, 0, 56, 40, 24, 8 }
3915-#endif // defined(OLED_DISPLAY_CUSTOM)
3916+// Double height 128x64
3917+# ifndef OLED_DISPLAY_WIDTH
3918+# define OLED_DISPLAY_WIDTH 128
3919+# endif
3920+# ifndef OLED_DISPLAY_HEIGHT
3921+# define OLED_DISPLAY_HEIGHT 64
3922+# endif
3923+# ifndef OLED_MATRIX_SIZE
3924+# define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 1024 (compile time mathed)
3925+# endif
3926+# ifndef OLED_BLOCK_TYPE
3927+# define OLED_BLOCK_TYPE uint16_t
3928+# endif
3929diff --git a/drivers/qwiic/micro_oled.c b/drivers/qwiic/micro_oled.c
3930index 092dd551e386857f12b0efa6649dc00ad4a4e69f..597810f339c27c2d19bfcd3f2a535f1b629b7c39 100644
3931--- a/drivers/qwiic/micro_oled.c
3932+++ b/drivers/qwiic/micro_oled.c
3933@@ -35,16 +35,21 @@
3934 #include "string.h"
3935
3936 #define TOTALFONTS 2
3937-const unsigned char * fonts_pointer[]= { font5x7, font8x16 };
3938+const unsigned char* fonts_pointer[] = {font5x7, font8x16};
3939
3940-uint8_t foreColor,drawMode,fontWidth, fontHeight, fontType, fontStartChar, fontTotalChar, cursorX, cursorY;
3941+uint8_t foreColor, drawMode, fontWidth, fontHeight, fontType, fontStartChar, fontTotalChar, cursorX, cursorY;
3942 uint16_t fontMapWidth;
3943
3944 #define _BV(x) (1 << (x))
3945-#define swap(a, b) { uint8_t t = a; a = b; b = t; }
3946+#define swap(a, b) \
3947+ { \
3948+ uint8_t t = a; \
3949+ a = b; \
3950+ b = t; \
3951+ }
3952
3953-uint8_t micro_oled_transfer_buffer[20];
3954-static uint8_t micro_oled_screen_current[LCDWIDTH*LCDWIDTH/8] = { 0 };
3955+uint8_t micro_oled_transfer_buffer[20];
3956+static uint8_t micro_oled_screen_current[LCDWIDTH * LCDWIDTH / 8] = {0};
3957
3958 /* LCD Memory organised in 64 horizontal pixel and 6 rows of byte
3959 B B .............B -----
3960@@ -64,628 +69,399 @@ static uint8_t micro_oled_screen_current[LCDWIDTH*LCDWIDTH/8] = { 0 };
3961 */
3962
3963 #if LCDWIDTH == 64
3964- #if LCDWIDTH == 48
3965+# if LCDWIDTH == 48
3966 static uint8_t micro_oled_screen_buffer[] = {
3967-// QMK Logo - generated at http://www.majer.ch/lcd/adf_bitmap.php
3968-//64x48 image
3969-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3970-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3971-0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00,
3972-0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x00,
3973-0x00, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3974-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3975-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3976-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60,
3977-0xF8, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF,
3978-0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF,
3979-0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFE,
3980-0xFE, 0xF8, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00,
3981-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3982-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3983-0x8C, 0x8C, 0x8C, 0x8C, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
3984-0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
3985-0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
3986-0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8C, 0x8C, 0x8C, 0x8C,
3987-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3988-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3989-0x00, 0x00, 0x00, 0x00, 0x31, 0x31, 0x31, 0x31, 0xFF, 0xFF,
3990-0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xF8, 0xF1, 0xE3, 0xE7, 0xCF,
3991-0xCF, 0xCF, 0xCF, 0x00, 0x00, 0xCF, 0xCF, 0xCF, 0xC7, 0xE7,
3992-0xE3, 0xF1, 0xF8, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
3993-0x31, 0x31, 0x31, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3994-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3995-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06,
3996-0x06, 0x06, 0x1F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
3997-0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xF8, 0xFF,
3998-0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
3999-0xFF, 0x7F, 0x7F, 0x1F, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00,
4000-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4001-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4002-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4003-0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00,
4004-0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00,
4005-0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4006-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4007-0x00, 0x00, 0x00, 0x00
4008-};
4009- #endif
4010+ // QMK Logo - generated at http://www.majer.ch/lcd/adf_bitmap.php
4011+ // 64x48 image
4012diff --git a/drivers/qwiic/micro_oled.h b/drivers/qwiic/micro_oled.h
4013index 5d6a1029ed7a958d8786b771dca87ca1614d1d92..814143df11fee5d443971cea30aecc5845e71092 100644
4014--- a/drivers/qwiic/micro_oled.h
4015+++ b/drivers/qwiic/micro_oled.h
4016@@ -49,86 +49,86 @@ void draw_rect_soft(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t
4017 void draw_rect_filled(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode);
4018 void draw_rect_filled_soft(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t color, uint8_t mode);
4019 void draw_char(uint8_t x, uint8_t y, uint8_t c, uint8_t color, uint8_t mode, uint8_t font);
4020-void draw_string(uint8_t x, uint8_t y, char * string, uint8_t color, uint8_t mode, uint8_t font);
4021+void draw_string(uint8_t x, uint8_t y, char* string, uint8_t color, uint8_t mode, uint8_t font);
4022
4023 #define I2C_ADDRESS_SA0_0 0b0111100
4024 #ifndef I2C_ADDRESS_SA0_1
4025-#define I2C_ADDRESS_SA0_1 0b0111101
4026+# define I2C_ADDRESS_SA0_1 0b0111101
4027 #endif
4028 #define I2C_COMMAND 0x00
4029 #define I2C_DATA 0x40
4030 #define PIXEL_OFF 0
4031-#define PIXEL_ON 1
4032+#define PIXEL_ON 1
4033
4034 #ifndef LCDWIDTH
4035-#define LCDWIDTH 64
4036+# define LCDWIDTH 64
4037 #endif
4038 #ifndef LCDWIDTH
4039-#define LCDHEIGHT 48
4040+# define LCDHEIGHT 48
4041 #endif
4042-#define FONTHEADERSIZE 6
4043+#define FONTHEADERSIZE 6
4044
4045-#define NORM 0
4046-#define XOR 1
4047+#define NORM 0
4048+#define XOR 1
4049
4050-#define PAGE 0
4051-#define ALL 1
4052+#define PAGE 0
4053+#define ALL 1
4054
4055-#define WIDGETSTYLE0 0
4056-#define WIDGETSTYLE1 1
4057-#define WIDGETSTYLE2 2
4058+#define WIDGETSTYLE0 0
4059+#define WIDGETSTYLE1 1
4060+#define WIDGETSTYLE2 2
4061
4062-#define SETCONTRAST 0x81
4063-#define DISPLAYALLONRESUME 0xA4
4064-#define DISPLAYALLON 0xA5
4065-#define NORMALDISPLAY 0xA6
4066-#define INVERTDISPLAY 0xA7
4067-#define DISPLAYOFF 0xAE
4068-#define DISPLAYON 0xAF
4069-#define SETDISPLAYOFFSET 0xD3
4070-#define SETCOMPINS 0xDA
4071-#define SETVCOMDESELECT 0xDB
4072-#define SETDISPLAYCLOCKDIV 0xD5
4073-#define SETPRECHARGE 0xD9
4074-#define SETMULTIPLEX 0xA8
4075-#define SETLOWCOLUMN 0x00
4076-#define SETHIGHCOLUMN 0x10
4077-#define SETSTARTLINE 0x40
4078-#define MEMORYMODE 0x20
4079-#define COMSCANINC 0xC0
4080-#define COMSCANDEC 0xC8
4081-#define SEGREMAP 0xA0
4082-#define CHARGEPUMP 0x8D
4083-#define EXTERNALVCC 0x01
4084-#define SWITCHCAPVCC 0x02
4085+#define SETCONTRAST 0x81
4086+#define DISPLAYALLONRESUME 0xA4
4087+#define DISPLAYALLON 0xA5
4088+#define NORMALDISPLAY 0xA6
4089+#define INVERTDISPLAY 0xA7
4090+#define DISPLAYOFF 0xAE
4091+#define DISPLAYON 0xAF
4092+#define SETDISPLAYOFFSET 0xD3
4093+#define SETCOMPINS 0xDA
4094+#define SETVCOMDESELECT 0xDB
4095+#define SETDISPLAYCLOCKDIV 0xD5
4096+#define SETPRECHARGE 0xD9
4097+#define SETMULTIPLEX 0xA8
4098+#define SETLOWCOLUMN 0x00
4099+#define SETHIGHCOLUMN 0x10
4100+#define SETSTARTLINE 0x40
4101+#define MEMORYMODE 0x20
4102+#define COMSCANINC 0xC0
4103+#define COMSCANDEC 0xC8
4104+#define SEGREMAP 0xA0
4105+#define CHARGEPUMP 0x8D
4106+#define EXTERNALVCC 0x01
4107+#define SWITCHCAPVCC 0x02
4108
4109 // Scroll
4110-#define ACTIVATESCROLL 0x2F
4111-#define DEACTIVATESCROLL 0x2E
4112-#define SETVERTICALSCROLLAREA 0xA3
4113-#define RIGHTHORIZONTALSCROLL 0x26
4114-#define LEFT_HORIZONTALSCROLL 0x27
4115+#define ACTIVATESCROLL 0x2F
4116diff --git a/drivers/qwiic/qwiic.c b/drivers/qwiic/qwiic.c
4117index 9047919927e1e9c8c13a7af57bb5e8e100bb0bb0..316d6539cbe2232f2217a77ecfec7f43c947be2f 100644
4118--- a/drivers/qwiic/qwiic.c
4119+++ b/drivers/qwiic/qwiic.c
4120@@ -16,16 +16,16 @@
4121 #include "qwiic.h"
4122
4123 void qwiic_init(void) {
4124- #ifdef QWIIC_JOYSTIIC_ENABLE
4125+#ifdef QWIIC_JOYSTIIC_ENABLE
4126 joystiic_init();
4127- #endif
4128- #ifdef QWIIC_MICRO_OLED_ENABLE
4129+#endif
4130+#ifdef QWIIC_MICRO_OLED_ENABLE
4131 micro_oled_init();
4132- #endif
4133+#endif
4134 }
4135
4136 void qwiic_task(void) {
4137- #ifdef QWIIC_JOYSTIIC_ENABLE
4138+#ifdef QWIIC_JOYSTIIC_ENABLE
4139 joystiic_task();
4140- #endif
4141+#endif
4142 }
4143diff --git a/drivers/qwiic/qwiic.h b/drivers/qwiic/qwiic.h
4144index 160fb28dfde4aba09e1d011e8672b02dd221bfc1..8c3d1c8d632b0f4d9b417ea447765b2a5d39db4d 100644
4145--- a/drivers/qwiic/qwiic.h
4146+++ b/drivers/qwiic/qwiic.h
4147@@ -18,10 +18,10 @@
4148 #include "i2c_master.h"
4149
4150 #ifdef QWIIC_JOYSTIIC_ENABLE
4151- #include "joystiic.h"
4152+# include "joystiic.h"
4153 #endif
4154 #ifdef QWIIC_MICRO_OLED_ENABLE
4155- #include "micro_oled.h"
4156+# include "micro_oled.h"
4157 #endif
4158
4159 void qwiic_init(void);
4160diff --git a/drivers/qwiic/util/font5x7.h b/drivers/qwiic/util/font5x7.h
4161index 0bad206b7c7712f0d95607b7681d6de7d819924a..a641945aaed43af60ff9e9522288144bc4b1ce49 100644
4162--- a/drivers/qwiic/util/font5x7.h
4163+++ b/drivers/qwiic/util/font5x7.h
4164@@ -29,260 +29,11 @@ https://github.com/emil01/SparkFun_Micro_OLED_Arduino_Library/
4165 // Standard ASCII 5x7 font
4166 static const unsigned char font5x7[] PROGMEM = {
4167 // first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256)
4168- 5,8,0,255,12,75,
4169- 0x00, 0x00, 0x00, 0x00, 0x00,
4170- 0x3E, 0x5B, 0x4F, 0x5B, 0x3E,
4171- 0x3E, 0x6B, 0x4F, 0x6B, 0x3E,
4172- 0x1C, 0x3E, 0x7C, 0x3E, 0x1C,
4173- 0x18, 0x3C, 0x7E, 0x3C, 0x18,
4174- 0x1C, 0x57, 0x7D, 0x57, 0x1C,
4175- 0x1C, 0x5E, 0x7F, 0x5E, 0x1C,
4176- 0x00, 0x18, 0x3C, 0x18, 0x00,
4177- 0xFF, 0xE7, 0xC3, 0xE7, 0xFF,
4178- 0x00, 0x18, 0x24, 0x18, 0x00,
4179- 0xFF, 0xE7, 0xDB, 0xE7, 0xFF,
4180- 0x30, 0x48, 0x3A, 0x06, 0x0E,
4181- 0x26, 0x29, 0x79, 0x29, 0x26,
4182- 0x40, 0x7F, 0x05, 0x05, 0x07,
4183- 0x40, 0x7F, 0x05, 0x25, 0x3F,
4184- 0x5A, 0x3C, 0xE7, 0x3C, 0x5A,
4185- 0x7F, 0x3E, 0x1C, 0x1C, 0x08,
4186- 0x08, 0x1C, 0x1C, 0x3E, 0x7F,
4187- 0x14, 0x22, 0x7F, 0x22, 0x14,
4188- 0x5F, 0x5F, 0x00, 0x5F, 0x5F,
4189- 0x06, 0x09, 0x7F, 0x01, 0x7F,
4190- 0x00, 0x66, 0x89, 0x95, 0x6A,
4191- 0x60, 0x60, 0x60, 0x60, 0x60,
4192- 0x94, 0xA2, 0xFF, 0xA2, 0x94,
4193- 0x08, 0x04, 0x7E, 0x04, 0x08,
4194- 0x10, 0x20, 0x7E, 0x20, 0x10,
4195- 0x08, 0x08, 0x2A, 0x1C, 0x08,
4196- 0x08, 0x1C, 0x2A, 0x08, 0x08,
4197- 0x1E, 0x10, 0x10, 0x10, 0x10,
4198- 0x0C, 0x1E, 0x0C, 0x1E, 0x0C,
4199- 0x30, 0x38, 0x3E, 0x38, 0x30,
4200- 0x06, 0x0E, 0x3E, 0x0E, 0x06,
4201- 0x00, 0x00, 0x00, 0x00, 0x00,
4202- 0x00, 0x00, 0x5F, 0x00, 0x00,
4203- 0x00, 0x07, 0x00, 0x07, 0x00,
4204- 0x14, 0x7F, 0x14, 0x7F, 0x14,
4205- 0x24, 0x2A, 0x7F, 0x2A, 0x12,
4206- 0x23, 0x13, 0x08, 0x64, 0x62,
4207- 0x36, 0x49, 0x56, 0x20, 0x50,
4208- 0x00, 0x08, 0x07, 0x03, 0x00,
4209- 0x00, 0x1C, 0x22, 0x41, 0x00,
4210- 0x00, 0x41, 0x22, 0x1C, 0x00,
4211- 0x2A, 0x1C, 0x7F, 0x1C, 0x2A,
4212- 0x08, 0x08, 0x3E, 0x08, 0x08,
4213- 0x00, 0x80, 0x70, 0x30, 0x00,
4214- 0x08, 0x08, 0x08, 0x08, 0x08,
4215- 0x00, 0x00, 0x60, 0x60, 0x00,
4216- 0x20, 0x10, 0x08, 0x04, 0x02,
4217- 0x3E, 0x51, 0x49, 0x45, 0x3E,
4218- 0x00, 0x42, 0x7F, 0x40, 0x00,
4219- 0x72, 0x49, 0x49, 0x49, 0x46,
4220- 0x21, 0x41, 0x49, 0x4D, 0x33,
4221- 0x18, 0x14, 0x12, 0x7F, 0x10,
4222- 0x27, 0x45, 0x45, 0x45, 0x39,
4223- 0x3C, 0x4A, 0x49, 0x49, 0x31,
4224- 0x41, 0x21, 0x11, 0x09, 0x07,
4225- 0x36, 0x49, 0x49, 0x49, 0x36,
4226- 0x46, 0x49, 0x49, 0x29, 0x1E,
4227- 0x00, 0x00, 0x14, 0x00, 0x00,
4228- 0x00, 0x40, 0x34, 0x00, 0x00,
4229- 0x00, 0x08, 0x14, 0x22, 0x41,
4230- 0x14, 0x14, 0x14, 0x14, 0x14,
4231- 0x00, 0x41, 0x22, 0x14, 0x08,
4232- 0x02, 0x01, 0x59, 0x09, 0x06,
4233- 0x3E, 0x41, 0x5D, 0x59, 0x4E,
4234- 0x7C, 0x12, 0x11, 0x12, 0x7C,
4235- 0x7F, 0x49, 0x49, 0x49, 0x36,
4236- 0x3E, 0x41, 0x41, 0x41, 0x22,
4237- 0x7F, 0x41, 0x41, 0x41, 0x3E,
4238- 0x7F, 0x49, 0x49, 0x49, 0x41,
4239- 0x7F, 0x09, 0x09, 0x09, 0x01,
4240- 0x3E, 0x41, 0x41, 0x51, 0x73,
4241- 0x7F, 0x08, 0x08, 0x08, 0x7F,
4242- 0x00, 0x41, 0x7F, 0x41, 0x00,
4243- 0x20, 0x40, 0x41, 0x3F, 0x01,
4244- 0x7F, 0x08, 0x14, 0x22, 0x41,
4245- 0x7F, 0x40, 0x40, 0x40, 0x40,
4246- 0x7F, 0x02, 0x1C, 0x02, 0x7F,
4247- 0x7F, 0x04, 0x08, 0x10, 0x7F,
4248- 0x3E, 0x41, 0x41, 0x41, 0x3E,
4249- 0x7F, 0x09, 0x09, 0x09, 0x06,
4250- 0x3E, 0x41, 0x51, 0x21, 0x5E,
4251- 0x7F, 0x09, 0x19, 0x29, 0x46,
4252- 0x26, 0x49, 0x49, 0x49, 0x32,
4253- 0x03, 0x01, 0x7F, 0x01, 0x03,
4254- 0x3F, 0x40, 0x40, 0x40, 0x3F,
4255- 0x1F, 0x20, 0x40, 0x20, 0x1F,
4256- 0x3F, 0x40, 0x38, 0x40, 0x3F,
4257- 0x63, 0x14, 0x08, 0x14, 0x63,
4258- 0x03, 0x04, 0x78, 0x04, 0x03,
4259- 0x61, 0x59, 0x49, 0x4D, 0x43,
4260- 0x00, 0x7F, 0x41, 0x41, 0x41,
4261- 0x02, 0x04, 0x08, 0x10, 0x20,
4262- 0x00, 0x41, 0x41, 0x41, 0x7F,
4263- 0x04, 0x02, 0x01, 0x02, 0x04,
4264diff --git a/drivers/qwiic/util/font8x16.h b/drivers/qwiic/util/font8x16.h
4265index c070e4ec8ca1dc9bc5271fe02ac9332d95b7a73b..4d3c23786620dc48c5e5bb1e54395f8bfd62cdad 100644
4266--- a/drivers/qwiic/util/font8x16.h
4267+++ b/drivers/qwiic/util/font8x16.h
4268@@ -27,101 +27,13 @@ https://github.com/emil01/SparkFun_Micro_OLED_Arduino_Library/
4269
4270 static const unsigned char font8x16[] PROGMEM = {
4271 // first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256)
4272- 8,16,32,96,2,56,
4273- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00,
4274- 0x00, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xBE, 0x90, 0xD0, 0xBE, 0x90, 0x00,
4275- 0x00, 0x1C, 0x62, 0xFF, 0xC2, 0x80, 0x00, 0x00, 0x0C, 0x12, 0x92, 0x4C, 0xB0, 0x88, 0x06, 0x00,
4276- 0x80, 0x7C, 0x62, 0xB2, 0x1C, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x0E, 0x00, 0x00, 0x00, 0x00,
4277- 0x00, 0xE0, 0x18, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x18, 0xE0, 0x00, 0x00,
4278- 0x00, 0x24, 0x18, 0x7E, 0x18, 0x24, 0x00, 0x00, 0x80, 0x80, 0x80, 0xF0, 0x80, 0x80, 0x80, 0x00,
4279- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00,
4280- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x60, 0x18, 0x06, 0x00, 0x00,
4281- 0xF8, 0x04, 0xC2, 0x32, 0x0C, 0xF8, 0x00, 0x00, 0x00, 0x04, 0x04, 0xFE, 0x00, 0x00, 0x00, 0x00,
4282- 0x00, 0x02, 0x82, 0x42, 0x22, 0x1C, 0x00, 0x00, 0x00, 0x02, 0x22, 0x22, 0x22, 0xDC, 0x00, 0x00,
4283- 0xC0, 0xA0, 0x98, 0x84, 0xFE, 0x80, 0x80, 0x00, 0x00, 0x1E, 0x12, 0x12, 0x22, 0xC2, 0x00, 0x00,
4284- 0xF8, 0x44, 0x22, 0x22, 0x22, 0xC0, 0x00, 0x00, 0x00, 0x02, 0x02, 0xC2, 0x32, 0x0A, 0x06, 0x00,
4285- 0x00, 0x8C, 0x52, 0x22, 0x52, 0x8C, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, 0x26, 0xF8, 0x00, 0x00,
4286- 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
4287- 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00,
4288- 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00, 0x00, 0x02, 0x82, 0x42, 0x22, 0x1C, 0x00, 0x00,
4289- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
4290- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
4291- 0x00, 0x04, 0x04, 0x0F, 0x04, 0x03, 0x00, 0x00, 0x04, 0x02, 0x01, 0x03, 0x04, 0x04, 0x03, 0x00,
4292- 0x03, 0x04, 0x04, 0x04, 0x05, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4293- 0x00, 0x03, 0x06, 0x08, 0x10, 0x10, 0x00, 0x00, 0x00, 0x10, 0x10, 0x08, 0x06, 0x03, 0x00, 0x00,
4294- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
4295- 0x00, 0x00, 0x16, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4296- 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
4297- 0x01, 0x03, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x04, 0x04, 0x07, 0x04, 0x04, 0x00, 0x00,
4298- 0x00, 0x07, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00,
4299- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00,
4300- 0x01, 0x02, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
4301- 0x00, 0x03, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00,
4302- 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x0E, 0x00, 0x00, 0x00, 0x00,
4303- 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x04, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00,
4304- 0x04, 0x02, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
4305- 0xF8, 0x04, 0x72, 0x8A, 0xFA, 0x84, 0x78, 0x00, 0x00, 0xC0, 0x38, 0x06, 0x38, 0xC0, 0x00, 0x00,
4306- 0x00, 0xFE, 0x22, 0x22, 0x22, 0xDC, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00,
4307- 0xFE, 0x02, 0x02, 0x02, 0x04, 0xF8, 0x00, 0x00, 0x00, 0xFE, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00,
4308- 0x00, 0xFE, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x22, 0xE2, 0x00, 0x00,
4309- 0xFE, 0x20, 0x20, 0x20, 0x20, 0xFE, 0x00, 0x00, 0x00, 0x02, 0x02, 0xFE, 0x02, 0x02, 0x00, 0x00,
4310- 0x00, 0x00, 0x00, 0x02, 0x02, 0xFE, 0x00, 0x00, 0xFE, 0x40, 0xB0, 0x08, 0x04, 0x02, 0x00, 0x00,
4311- 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x0C, 0x70, 0x80, 0x70, 0x0C, 0xFE, 0x00,
4312- 0xFE, 0x0C, 0x30, 0xC0, 0x00, 0xFE, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x04, 0xF8, 0x00, 0x00,
4313- 0xFE, 0x42, 0x42, 0x42, 0x22, 0x1C, 0x00, 0x00, 0xF8, 0x04, 0x02, 0x02, 0x04, 0xF8, 0x00, 0x00,
4314- 0x00, 0xFE, 0x42, 0x42, 0xA2, 0x1C, 0x00, 0x00, 0x00, 0x1C, 0x22, 0x42, 0x42, 0x80, 0x00, 0x00,
4315- 0x02, 0x02, 0x02, 0xFE, 0x02, 0x02, 0x02, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00,
4316- 0x06, 0x38, 0xC0, 0x00, 0xC0, 0x38, 0x06, 0x00, 0x3E, 0xC0, 0xF0, 0x0E, 0xF0, 0xC0, 0x3E, 0x00,
4317- 0x00, 0x06, 0x98, 0x60, 0x98, 0x06, 0x00, 0x00, 0x00, 0x06, 0x18, 0xE0, 0x18, 0x06, 0x00, 0x00,
4318- 0x02, 0x02, 0xC2, 0x32, 0x0A, 0x06, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x02, 0x02, 0x02, 0x02, 0x00,
4319- 0x00, 0x06, 0x18, 0x60, 0x80, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0xFE, 0x00, 0x00, 0x00,
4320- 0x40, 0x30, 0x0C, 0x0C, 0x30, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4321- 0x01, 0x02, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x06, 0x01, 0x01, 0x01, 0x01, 0x01, 0x06, 0x00,
4322- 0x00, 0x07, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00,
4323- 0x07, 0x04, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00,
4324- 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x04, 0x07, 0x00, 0x00,
4325- 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x04, 0x07, 0x04, 0x04, 0x00, 0x00,
4326- 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x01, 0x02, 0x04, 0x00, 0x00,
4327- 0x00, 0x07, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07, 0x00,
4328- 0x07, 0x00, 0x00, 0x00, 0x03, 0x07, 0x00, 0x00, 0x01, 0x02, 0x04, 0x04, 0x02, 0x01, 0x00, 0x00,
4329- 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x0C, 0x12, 0x11, 0x10, 0x00,
4330- 0x00, 0x07, 0x00, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00,
4331- 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00,
4332- 0x00, 0x00, 0x01, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00,
4333- 0x00, 0x06, 0x01, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
4334- 0x06, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x10, 0x10, 0x00,
4335- 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x00, 0x10, 0x10, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00,
4336- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00,
4337- 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00,
4338- 0x00, 0xFE, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00,
4339- 0x00, 0xE0, 0x10, 0x10, 0x10, 0xFE, 0x00, 0x00, 0x00, 0xE0, 0x90, 0x90, 0x90, 0xE0, 0x00, 0x00,
4340- 0x00, 0x20, 0xFC, 0x22, 0x22, 0x22, 0x02, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00,
4341- 0x00, 0xFE, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x10, 0x10, 0xF2, 0x00, 0x00, 0x00, 0x00, 0x00,
4342- 0x00, 0x10, 0x10, 0x10, 0xF2, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x80, 0x40, 0x20, 0x10, 0x00, 0x00,
4343- 0x00, 0x02, 0x02, 0xFE, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x20, 0x10, 0xF0, 0x20, 0x10, 0xF0, 0x00,
4344- 0x00, 0xF0, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xE0, 0x00, 0x00,
4345- 0x00, 0xF0, 0x20, 0x10, 0x10, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00,
4346- 0x00, 0xF0, 0x20, 0x10, 0x10, 0x70, 0x00, 0x00, 0x00, 0x60, 0x90, 0x90, 0x90, 0x20, 0x00, 0x00,
4347- 0x00, 0x20, 0x20, 0xFC, 0x20, 0x20, 0x20, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00,
4348- 0x00, 0x70, 0x80, 0x00, 0x80, 0x70, 0x00, 0x00, 0xF0, 0x00, 0xC0, 0x30, 0xC0, 0x00, 0xF0, 0x00,
4349- 0x00, 0x30, 0xC0, 0xC0, 0x30, 0x00, 0x00, 0x00, 0x00, 0x30, 0xC0, 0x00, 0x80, 0x70, 0x00, 0x00,
4350- 0x00, 0x10, 0x10, 0x90, 0x50, 0x30, 0x00, 0x00, 0x00, 0x80, 0x80, 0x7E, 0x02, 0x02, 0x00, 0x00,
4351- 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x7E, 0x80, 0x80, 0x00, 0x00,
4352- 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4353- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x02, 0x07, 0x00, 0x00,
4354- 0x00, 0x07, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00,
4355- 0x00, 0x03, 0x04, 0x04, 0x02, 0x07, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00,
4356- 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x24, 0x24, 0x22, 0x1F, 0x00, 0x00,
4357- 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x00, 0x00, 0x00,
4358- 0x20, 0x20, 0x20, 0x20, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x01, 0x02, 0x04, 0x00, 0x00,
4359- 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00,
4360- 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00,
4361- 0x00, 0x3F, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x02, 0x3F, 0x00, 0x00,
4362- 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00,
4363- 0x00, 0x00, 0x00, 0x03, 0x04, 0x04, 0x04, 0x00, 0x00, 0x03, 0x04, 0x04, 0x02, 0x07, 0x00, 0x00,
4364- 0x00, 0x00, 0x03, 0x04, 0x03, 0x00, 0x00, 0x00, 0x01, 0x06, 0x01, 0x00, 0x01, 0x06, 0x01, 0x00,
4365- 0x00, 0x06, 0x01, 0x01, 0x06, 0x00, 0x00, 0x00, 0x20, 0x20, 0x31, 0x0E, 0x03, 0x00, 0x00, 0x00,
4366- 0x00, 0x06, 0x05, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x00, 0x00,
4367- 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x00,