aboutsummaryrefslogtreecommitdiff
path: root/quantum/quantum.h
diff options
context:
space:
mode:
authorskullY <skullydazed@gmail.com>2019-08-30 11:19:03 -0700
committerskullydazed <skullydazed@users.noreply.github.com>2019-08-30 15:01:52 -0700
commitb624f32f944acdc59dcb130674c09090c5c404cb (patch)
treebc13adbba137d122d9a2c2fb2fafcbb08ac10e25 /quantum/quantum.h
parent61af76a10d00aba185b8338604171de490a13e3b (diff)
downloadqmk_firmware-b624f32f944acdc59dcb130674c09090c5c404cb.tar.gz
qmk_firmware-b624f32f944acdc59dcb130674c09090c5c404cb.zip
clang-format changes
Diffstat (limited to 'quantum/quantum.h')
-rw-r--r--quantum/quantum.h153
1 files changed, 76 insertions, 77 deletions
diff --git a/quantum/quantum.h b/quantum/quantum.h
index 2cb26d4f4..066113590 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -16,12 +16,12 @@
16#pragma once 16#pragma once
17 17
18#if defined(__AVR__) 18#if defined(__AVR__)
19 #include <avr/pgmspace.h> 19# include <avr/pgmspace.h>
20 #include <avr/io.h> 20# include <avr/io.h>
21 #include <avr/interrupt.h> 21# include <avr/interrupt.h>
22#endif 22#endif
23#if defined(PROTOCOL_CHIBIOS) 23#if defined(PROTOCOL_CHIBIOS)
24 #include "hal.h" 24# include "hal.h"
25#endif 25#endif
26 26
27#include "wait.h" 27#include "wait.h"
@@ -29,23 +29,23 @@
29#include "keymap.h" 29#include "keymap.h"
30 30
31#ifdef BACKLIGHT_ENABLE 31#ifdef BACKLIGHT_ENABLE
32 #ifdef LED_MATRIX_ENABLE 32# ifdef LED_MATRIX_ENABLE
33 #include "ledmatrix.h" 33# include "ledmatrix.h"
34 #else 34# else
35 #include "backlight.h" 35# include "backlight.h"
36 #endif 36# endif
37#endif 37#endif
38 38
39#if defined(RGBLIGHT_ENABLE) 39#if defined(RGBLIGHT_ENABLE)
40 #include "rgblight.h" 40# include "rgblight.h"
41#elif defined(RGB_MATRIX_ENABLE) 41#elif defined(RGB_MATRIX_ENABLE)
42 // Dummy define RGBLIGHT_MODE_xxxx 42// Dummy define RGBLIGHT_MODE_xxxx
43 #define RGBLIGHT_H_DUMMY_DEFINE 43# define RGBLIGHT_H_DUMMY_DEFINE
44 #include "rgblight.h" 44# include "rgblight.h"
45#endif 45#endif
46 46
47#ifdef RGB_MATRIX_ENABLE 47#ifdef RGB_MATRIX_ENABLE
48 #include "rgb_matrix.h" 48# include "rgb_matrix.h"
49#endif 49#endif
50 50
51#include "action_layer.h" 51#include "action_layer.h"
@@ -64,120 +64,119 @@
64extern layer_state_t default_layer_state; 64extern layer_state_t default_layer_state;
65 65
66#ifndef NO_ACTION_LAYER 66#ifndef NO_ACTION_LAYER
67 extern layer_state_t layer_state; 67extern layer_state_t layer_state;
68#endif 68#endif
69 69
70#if defined(MIDI_ENABLE) && defined(MIDI_ADVANCED) 70#if defined(MIDI_ENABLE) && defined(MIDI_ADVANCED)
71 #include "process_midi.h" 71# include "process_midi.h"
72#endif 72#endif
73 73
74#ifdef AUDIO_ENABLE 74#ifdef AUDIO_ENABLE
75 #include "audio.h" 75# include "audio.h"
76 #include "process_audio.h" 76# include "process_audio.h"
77 #ifdef AUDIO_CLICKY 77# ifdef AUDIO_CLICKY
78 #include "process_clicky.h" 78# include "process_clicky.h"
79 #endif 79# endif
80#endif 80#endif
81 81
82#ifdef STENO_ENABLE 82#ifdef STENO_ENABLE
83 #include "process_steno.h" 83# include "process_steno.h"
84#endif 84#endif
85 85
86#if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC)) 86#if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
87 #include "process_music.h" 87# include "process_music.h"
88#endif 88#endif
89 89
90#ifdef LEADER_ENABLE 90#ifdef LEADER_ENABLE
91 #include "process_leader.h" 91# include "process_leader.h"
92#endif 92#endif
93 93
94#ifdef UNICODE_ENABLE 94#ifdef UNICODE_ENABLE
95 #include "process_unicode.h" 95# include "process_unicode.h"
96#endif 96#endif
97 97
98#ifdef UCIS_ENABLE 98#ifdef UCIS_ENABLE
99 #include "process_ucis.h" 99# include "process_ucis.h"
100#endif 100#endif
101 101
102#ifdef UNICODEMAP_ENABLE 102#ifdef UNICODEMAP_ENABLE
103 #include "process_unicodemap.h" 103# include "process_unicodemap.h"
104#endif 104#endif
105 105
106#ifdef TAP_DANCE_ENABLE 106#ifdef TAP_DANCE_ENABLE
107 #include "process_tap_dance.h" 107# include "process_tap_dance.h"
108#endif 108#endif
109 109
110#ifdef PRINTING_ENABLE 110#ifdef PRINTING_ENABLE
111 #include "process_printer.h" 111# include "process_printer.h"
112#endif 112#endif
113 113
114#ifdef AUTO_SHIFT_ENABLE 114#ifdef AUTO_SHIFT_ENABLE
115 #include "process_auto_shift.h" 115# include "process_auto_shift.h"
116#endif 116#endif
117 117
118#ifdef COMBO_ENABLE 118#ifdef COMBO_ENABLE
119 #include "process_combo.h" 119# include "process_combo.h"
120#endif 120#endif
121 121
122#ifdef KEY_LOCK_ENABLE 122#ifdef KEY_LOCK_ENABLE
123 #include "process_key_lock.h" 123# include "process_key_lock.h"
124#endif 124#endif
125 125
126#ifdef TERMINAL_ENABLE 126#ifdef TERMINAL_ENABLE
127 #include "process_terminal.h" 127# include "process_terminal.h"
128#else 128#else
129 #include "process_terminal_nop.h" 129# include "process_terminal_nop.h"
130#endif 130#endif
131 131
132#ifdef SPACE_CADET_ENABLE 132#ifdef SPACE_CADET_ENABLE
133 #include "process_space_cadet.h" 133# include "process_space_cadet.h"
134#endif 134#endif
135 135
136#ifdef HD44780_ENABLE 136#ifdef HD44780_ENABLE
137 #include "hd44780.h" 137# include "hd44780.h"
138#endif 138#endif
139 139
140#ifdef HAPTIC_ENABLE 140#ifdef HAPTIC_ENABLE
141 #include "haptic.h" 141# include "haptic.h"
142#endif 142#endif
143 143
144#ifdef OLED_DRIVER_ENABLE 144#ifdef OLED_DRIVER_ENABLE
145 #include "oled_driver.h" 145# include "oled_driver.h"
146#endif 146#endif
147 147
148// Function substitutions to ease GPIO manipulation 148// Function substitutions to ease GPIO manipulation
149#if defined(__AVR__) 149#if defined(__AVR__)
150 typedef uint8_t pin_t; 150typedef uint8_t pin_t;
151 151
152 #define setPinInput(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin) & 0xF)) 152# define setPinInput(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF))
153 #define setPinInputHigh(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin) & 0xF), \ 153# define setPinInputHigh(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF), PORTx_ADDRESS(pin) |= _BV((pin)&0xF))
154 PORTx_ADDRESS(pin) |= _BV((pin) & 0xF)) 154# define setPinInputLow(pin) _Static_assert(0, "AVR processors cannot implement an input as pull low")
155 #define setPinInputLow(pin) _Static_assert(0, "AVR processors cannot implement an input as pull low") 155# define setPinOutput(pin) (DDRx_ADDRESS(pin) |= _BV((pin)&0xF))
156 #define setPinOutput(pin) (DDRx_ADDRESS(pin) |= _BV((pin) & 0xF))
157 156
158 #define writePinHigh(pin) (PORTx_ADDRESS(pin) |= _BV((pin) & 0xF)) 157# define writePinHigh(pin) (PORTx_ADDRESS(pin) |= _BV((pin)&0xF))
159 #define writePinLow(pin) (PORTx_ADDRESS(pin) &= ~_BV((pin) & 0xF)) 158# define writePinLow(pin) (PORTx_ADDRESS(pin) &= ~_BV((pin)&0xF))
160 #define writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin)) 159# define writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin))
161 160
162 #define readPin(pin) ((bool)(PINx_ADDRESS(pin) & _BV((pin) & 0xF))) 161# define readPin(pin) ((bool)(PINx_ADDRESS(pin) & _BV((pin)&0xF)))
163#elif defined(PROTOCOL_CHIBIOS) 162#elif defined(PROTOCOL_CHIBIOS)
164 typedef ioline_t pin_t; 163typedef ioline_t pin_t;
165 164
166 #define setPinInput(pin) palSetLineMode(pin, PAL_MODE_INPUT) 165# define setPinInput(pin) palSetLineMode(pin, PAL_MODE_INPUT)
167 #define setPinInputHigh(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLUP) 166# define setPinInputHigh(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLUP)
168 #define setPinInputLow(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLDOWN) 167# define setPinInputLow(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLDOWN)
169 #define setPinOutput(pin) palSetLineMode(pin, PAL_MODE_OUTPUT_PUSHPULL) 168# define setPinOutput(pin) palSetLineMode(pin, PAL_MODE_OUTPUT_PUSHPULL)
170 169
171 #define writePinHigh(pin) palSetLine(pin) 170# define writePinHigh(pin) palSetLine(pin)
172 #define writePinLow(pin) palClearLine(pin) 171# define writePinLow(pin) palClearLine(pin)
173 #define writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin)) 172# define writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin))
174 173
175 #define readPin(pin) palReadLine(pin) 174# define readPin(pin) palReadLine(pin)
176#endif 175#endif
177 176
178// Send string macros 177// Send string macros
179#define STRINGIZE(z) #z 178#define STRINGIZE(z) #z
180#define ADD_SLASH_X(y) STRINGIZE(\x ## y) 179#define ADD_SLASH_X(y) STRINGIZE(\x##y)
181#define SYMBOL_STR(x) ADD_SLASH_X(x) 180#define SYMBOL_STR(x) ADD_SLASH_X(x)
182 181
183#define SS_TAP_CODE 1 182#define SS_TAP_CODE 1
@@ -200,8 +199,8 @@ extern layer_state_t default_layer_state;
200 199
201#define SEND_STRING(string) send_string_P(PSTR(string)) 200#define SEND_STRING(string) send_string_P(PSTR(string))
202 201
203extern const bool ascii_to_shift_lut[128]; 202extern const bool ascii_to_shift_lut[128];
204extern const bool ascii_to_altgr_lut[128]; 203extern const bool ascii_to_altgr_lut[128];
205extern const uint8_t ascii_to_keycode_lut[128]; 204extern const uint8_t ascii_to_keycode_lut[128];
206 205
207void send_string(const char *str); 206void send_string(const char *str);
@@ -211,31 +210,31 @@ void send_string_with_delay_P(const char *str, uint8_t interval);
211void send_char(char ascii_code); 210void send_char(char ascii_code);
212 211
213// For tri-layer 212// For tri-layer
214void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3); 213void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3);
215layer_state_t update_tri_layer_state(layer_state_t state, uint8_t layer1, uint8_t layer2, uint8_t layer3); 214layer_state_t update_tri_layer_state(layer_state_t state, uint8_t layer1, uint8_t layer2, uint8_t layer3);
216 215
217void set_single_persistent_default_layer(uint8_t default_layer); 216void set_single_persistent_default_layer(uint8_t default_layer);
218 217
219void tap_random_base64(void); 218void tap_random_base64(void);
220 219
221#define IS_LAYER_ON(layer) (layer_state & (1UL << (layer))) 220#define IS_LAYER_ON(layer) (layer_state & (1UL << (layer)))
222#define IS_LAYER_OFF(layer) (~layer_state & (1UL << (layer))) 221#define IS_LAYER_OFF(layer) (~layer_state & (1UL << (layer)))
223 222
224void matrix_init_kb(void); 223void matrix_init_kb(void);
225void matrix_scan_kb(void); 224void matrix_scan_kb(void);
226void matrix_init_user(void); 225void matrix_init_user(void);
227void matrix_scan_user(void); 226void matrix_scan_user(void);
228uint16_t get_record_keycode(keyrecord_t *record); 227uint16_t get_record_keycode(keyrecord_t *record);
229uint16_t get_event_keycode(keyevent_t event); 228uint16_t get_event_keycode(keyevent_t event);
230bool process_action_kb(keyrecord_t *record); 229bool process_action_kb(keyrecord_t *record);
231bool process_record_kb(uint16_t keycode, keyrecord_t *record); 230bool process_record_kb(uint16_t keycode, keyrecord_t *record);
232bool process_record_user(uint16_t keycode, keyrecord_t *record); 231bool process_record_user(uint16_t keycode, keyrecord_t *record);
233 232
234#ifndef BOOTMAGIC_LITE_COLUMN 233#ifndef BOOTMAGIC_LITE_COLUMN
235 #define BOOTMAGIC_LITE_COLUMN 0 234# define BOOTMAGIC_LITE_COLUMN 0
236#endif 235#endif
237#ifndef BOOTMAGIC_LITE_ROW 236#ifndef BOOTMAGIC_LITE_ROW
238 #define BOOTMAGIC_LITE_ROW 0 237# define BOOTMAGIC_LITE_ROW 0
239#endif 238#endif
240 239
241void bootmagic_lite(void); 240void bootmagic_lite(void);
@@ -256,7 +255,7 @@ void backlight_task_internal(void);
256void backlight_on(uint8_t backlight_pin); 255void backlight_on(uint8_t backlight_pin);
257void backlight_off(uint8_t backlight_pin); 256void backlight_off(uint8_t backlight_pin);
258 257
259 #ifdef BACKLIGHT_BREATHING 258# ifdef BACKLIGHT_BREATHING
260void breathing_task(void); 259void breathing_task(void);
261void breathing_enable(void); 260void breathing_enable(void);
262void breathing_pulse(void); 261void breathing_pulse(void);
@@ -270,13 +269,13 @@ void breathing_period_default(void);
270void breathing_period_set(uint8_t value); 269void breathing_period_set(uint8_t value);
271void breathing_period_inc(void); 270void breathing_period_inc(void);
272void breathing_period_dec(void); 271void breathing_period_dec(void);
273 #endif 272# endif
274#endif 273#endif
275 274
276void send_dword(uint32_t number); 275void send_dword(uint32_t number);
277void send_word(uint16_t number); 276void send_word(uint16_t number);
278void send_byte(uint8_t number); 277void send_byte(uint8_t number);
279void send_nibble(uint8_t number); 278void send_nibble(uint8_t number);
280uint16_t hex_to_keycode(uint8_t hex); 279uint16_t hex_to_keycode(uint8_t hex);
281 280
282void led_set_user(uint8_t usb_led); 281void led_set_user(uint8_t usb_led);