summaryrefslogtreecommitdiff
path: root/quantum/process_keycode
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2023-07-11 17:07:24 +1000
committerGitHub <noreply@github.com>2023-07-11 17:07:24 +1000
commiteee0384167b965c60120e1222bc24c0b40cadac4 (patch)
tree9ff4859ab0727091177d7d6a99c54cca9d6b93f0 /quantum/process_keycode
parent39a97d2ee43d00e87a9f94971093863a864cbffd (diff)
process_keycode: remove direct `quantum.h` includes (#21486)
Diffstat (limited to 'quantum/process_keycode')
-rw-r--r--quantum/process_keycode/process_audio.h4
-rw-r--r--quantum/process_keycode/process_auto_shift.c169
-rw-r--r--quantum/process_keycode/process_auto_shift.h6
-rw-r--r--quantum/process_keycode/process_autocorrect.c4
-rw-r--r--quantum/process_keycode/process_autocorrect.h4
-rw-r--r--quantum/process_keycode/process_backlight.h4
-rw-r--r--quantum/process_keycode/process_caps_word.c8
-rw-r--r--quantum/process_keycode/process_caps_word.h5
-rw-r--r--quantum/process_keycode/process_clicky.h4
-rw-r--r--quantum/process_keycode/process_combo.c11
-rw-r--r--quantum/process_keycode/process_combo.h6
-rw-r--r--quantum/process_keycode/process_dynamic_macro.c9
-rw-r--r--quantum/process_keycode/process_dynamic_macro.h4
-rw-r--r--quantum/process_keycode/process_dynamic_tapping_term.c4
-rw-r--r--quantum/process_keycode/process_dynamic_tapping_term.h1
-rw-r--r--quantum/process_keycode/process_grave_esc.c3
-rw-r--r--quantum/process_keycode/process_grave_esc.h4
-rw-r--r--quantum/process_keycode/process_haptic.h1
-rw-r--r--quantum/process_keycode/process_joystick.h3
-rw-r--r--quantum/process_keycode/process_key_lock.h4
-rw-r--r--quantum/process_keycode/process_key_override.c6
-rw-r--r--quantum/process_keycode/process_key_override.h3
-rw-r--r--quantum/process_keycode/process_leader.c1
-rw-r--r--quantum/process_keycode/process_leader.h4
-rw-r--r--quantum/process_keycode/process_magic.c5
-rw-r--r--quantum/process_keycode/process_magic.h4
-rw-r--r--quantum/process_keycode/process_midi.c26
-rw-r--r--quantum/process_keycode/process_midi.h5
-rw-r--r--quantum/process_keycode/process_music.c2
-rw-r--r--quantum/process_keycode/process_music.h4
-rw-r--r--quantum/process_keycode/process_programmable_button.h3
-rw-r--r--quantum/process_keycode/process_repeat_key.c4
-rw-r--r--quantum/process_keycode/process_repeat_key.h4
-rw-r--r--quantum/process_keycode/process_rgb.c8
-rw-r--r--quantum/process_keycode/process_rgb.h4
-rw-r--r--quantum/process_keycode/process_secure.h1
-rw-r--r--quantum/process_keycode/process_sequencer.h4
-rw-r--r--quantum/process_keycode/process_space_cadet.c2
-rw-r--r--quantum/process_keycode/process_space_cadet.h4
-rw-r--r--quantum/process_keycode/process_steno.c1
-rw-r--r--quantum/process_keycode/process_steno.h4
-rw-r--r--quantum/process_keycode/process_tap_dance.c7
-rw-r--r--quantum/process_keycode/process_tap_dance.h43
-rw-r--r--quantum/process_keycode/process_tri_layer.h2
44 files changed, 253 insertions, 156 deletions
diff --git a/quantum/process_keycode/process_audio.h b/quantum/process_keycode/process_audio.h
index 42cfab4af2..c80136f2c2 100644
--- a/quantum/process_keycode/process_audio.h
+++ b/quantum/process_keycode/process_audio.h
@@ -1,5 +1,9 @@
1#pragma once 1#pragma once
2 2
3#include <stdint.h>
4#include <stdbool.h>
5#include "action.h"
6
3float compute_freq_for_midi_note(uint8_t note); 7float compute_freq_for_midi_note(uint8_t note);
4 8
5bool process_audio(uint16_t keycode, keyrecord_t *record); 9bool process_audio(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/process_keycode/process_auto_shift.c b/quantum/process_keycode/process_auto_shift.c
index 63e893fc18..9b78214e43 100644
--- a/quantum/process_keycode/process_auto_shift.c
+++ b/quantum/process_keycode/process_auto_shift.c
@@ -14,27 +14,28 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16 16
17#ifdef AUTO_SHIFT_ENABLE 17#include "process_auto_shift.h"
18 18#include "quantum.h"
19# include <stdbool.h> 19#include "action_util.h"
20# include "process_auto_shift.h" 20#include "timer.h"
21 21#include "keycodes.h"
22# ifndef AUTO_SHIFT_DISABLED_AT_STARTUP 22
23# define AUTO_SHIFT_STARTUP_STATE true /* enabled */ 23#ifndef AUTO_SHIFT_DISABLED_AT_STARTUP
24# else 24# define AUTO_SHIFT_STARTUP_STATE true /* enabled */
25# define AUTO_SHIFT_STARTUP_STATE false /* disabled */ 25#else
26# endif 26# define AUTO_SHIFT_STARTUP_STATE false /* disabled */
27#endif
27 28
28// Stores the last Auto Shift key's up or down time, for evaluation or keyrepeat. 29// Stores the last Auto Shift key's up or down time, for evaluation or keyrepeat.
29static uint16_t autoshift_time = 0; 30static uint16_t autoshift_time = 0;
30# if defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING) 31#if defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING)
31// Stores the last key's up or down time, to replace autoshift_time so that Tap Hold times are accurate. 32// Stores the last key's up or down time, to replace autoshift_time so that Tap Hold times are accurate.
32static uint16_t retroshift_time = 0; 33static uint16_t retroshift_time = 0;
33// Stores a possibly Retro Shift key's up or down time, as retroshift_time needs 34// Stores a possibly Retro Shift key's up or down time, as retroshift_time needs
34// to be set before the Retro Shift key is evaluated if it is interrupted by an 35// to be set before the Retro Shift key is evaluated if it is interrupted by an
35// Auto Shifted key. 36// Auto Shifted key.
36static uint16_t last_retroshift_time; 37static uint16_t last_retroshift_time;
37# endif 38#endif
38static uint16_t autoshift_timeout = AUTO_SHIFT_TIMEOUT; 39static uint16_t autoshift_timeout = AUTO_SHIFT_TIMEOUT;
39static uint16_t autoshift_lastkey = KC_NO; 40static uint16_t autoshift_lastkey = KC_NO;
40static keyrecord_t autoshift_lastrecord; 41static keyrecord_t autoshift_lastrecord;
@@ -68,23 +69,23 @@ __attribute__((weak)) bool get_custom_auto_shifted_key(uint16_t keycode, keyreco
68/** \brief Called on physical press, returns whether is Auto Shift key */ 69/** \brief Called on physical press, returns whether is Auto Shift key */
69__attribute__((weak)) bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *record) { 70__attribute__((weak)) bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *record) {
70 switch (keycode) { 71 switch (keycode) {
71# ifndef NO_AUTO_SHIFT_ALPHA 72#ifndef NO_AUTO_SHIFT_ALPHA
72 case AUTO_SHIFT_ALPHA: 73 case AUTO_SHIFT_ALPHA:
73# endif 74#endif
74# ifndef NO_AUTO_SHIFT_NUMERIC 75#ifndef NO_AUTO_SHIFT_NUMERIC
75 case AUTO_SHIFT_NUMERIC: 76 case AUTO_SHIFT_NUMERIC:
76# endif 77#endif
77# ifndef NO_AUTO_SHIFT_SPECIAL 78#ifndef NO_AUTO_SHIFT_SPECIAL
78# ifndef NO_AUTO_SHIFT_TAB 79# ifndef NO_AUTO_SHIFT_TAB
79 case KC_TAB: 80 case KC_TAB:
80# endif 81# endif
81# ifndef NO_AUTO_SHIFT_SYMBOLS 82# ifndef NO_AUTO_SHIFT_SYMBOLS
82 case AUTO_SHIFT_SYMBOLS: 83 case AUTO_SHIFT_SYMBOLS:
83# endif
84# endif 84# endif
85# ifdef AUTO_SHIFT_ENTER 85#endif
86#ifdef AUTO_SHIFT_ENTER
86 case KC_ENT: 87 case KC_ENT:
87# endif 88#endif
88 return true; 89 return true;
89 } 90 }
90 return get_custom_auto_shifted_key(keycode, record); 91 return get_custom_auto_shifted_key(keycode, record);
@@ -130,9 +131,9 @@ bool get_autoshift_shift_state(uint16_t keycode) {
130/** \brief Restores the shift key if it was cancelled by Auto Shift */ 131/** \brief Restores the shift key if it was cancelled by Auto Shift */
131static void autoshift_flush_shift(void) { 132static void autoshift_flush_shift(void) {
132 autoshift_flags.holding_shift = false; 133 autoshift_flags.holding_shift = false;
133# ifdef CAPS_WORD_ENABLE 134#ifdef CAPS_WORD_ENABLE
134 if (!is_caps_word_on()) 135 if (!is_caps_word_on())
135# endif // CAPS_WORD_ENABLE 136#endif // CAPS_WORD_ENABLE
136 { 137 {
137 del_weak_mods(MOD_BIT(KC_LSFT)); 138 del_weak_mods(MOD_BIT(KC_LSFT));
138 } 139 }
@@ -154,26 +155,26 @@ static void autoshift_flush_shift(void) {
154static bool autoshift_press(uint16_t keycode, uint16_t now, keyrecord_t *record) { 155static bool autoshift_press(uint16_t keycode, uint16_t now, keyrecord_t *record) {
155 // clang-format off 156 // clang-format off
156 if ((get_mods() 157 if ((get_mods()
157# if !defined(NO_ACTION_ONESHOT) && !defined(NO_ACTION_TAPPING) 158#if !defined(NO_ACTION_ONESHOT) && !defined(NO_ACTION_TAPPING)
158 | get_oneshot_mods() 159 | get_oneshot_mods()
159# endif 160#endif
160 ) & (~MOD_BIT(KC_LSFT)) 161 ) & (~MOD_BIT(KC_LSFT))
161 ) { 162 ) {
162 // clang-format on 163 // clang-format on
163 // Prevents keyrepeating unshifted value of key after using it in a key combo. 164 // Prevents keyrepeating unshifted value of key after using it in a key combo.
164 autoshift_lastkey = KC_NO; 165 autoshift_lastkey = KC_NO;
165# ifndef AUTO_SHIFT_MODIFIERS 166#ifndef AUTO_SHIFT_MODIFIERS
166 // We can't return true here anymore because custom unshifted values are 167 // We can't return true here anymore because custom unshifted values are
167 // possible and there's no good way to tell whether the press returned 168 // possible and there's no good way to tell whether the press returned
168 // true upon release. 169 // true upon release.
169 set_autoshift_shift_state(keycode, false); 170 set_autoshift_shift_state(keycode, false);
170 autoshift_press_user(keycode, false, record); 171 autoshift_press_user(keycode, false, record);
171# if !defined(NO_ACTION_ONESHOT) && !defined(NO_ACTION_TAPPING) 172# if !defined(NO_ACTION_ONESHOT) && !defined(NO_ACTION_TAPPING)
172 set_oneshot_mods(get_oneshot_mods() & (~MOD_BIT(KC_LSFT))); 173 set_oneshot_mods(get_oneshot_mods() & (~MOD_BIT(KC_LSFT)));
173 clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); 174 clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
174# endif
175 return false;
176# endif 175# endif
176 return false;
177#endif
177 } 178 }
178 179
179 // Store record to be sent to user functions if there's no release record then. 180 // Store record to be sent to user functions if there's no release record then.
@@ -181,19 +182,19 @@ static bool autoshift_press(uint16_t keycode, uint16_t now, keyrecord_t *record)
181 autoshift_lastrecord.event.pressed = false; 182 autoshift_lastrecord.event.pressed = false;
182 autoshift_lastrecord.event.time = 0; 183 autoshift_lastrecord.event.time = 0;
183 // clang-format off 184 // clang-format off
184# if defined(AUTO_SHIFT_REPEAT) || defined(AUTO_SHIFT_REPEAT_PER_KEY) 185#if defined(AUTO_SHIFT_REPEAT) || defined(AUTO_SHIFT_REPEAT_PER_KEY)
185 if (keycode == autoshift_lastkey && 186 if (keycode == autoshift_lastkey &&
186# ifdef AUTO_SHIFT_REPEAT_PER_KEY 187# ifdef AUTO_SHIFT_REPEAT_PER_KEY
187 get_auto_shift_repeat(autoshift_lastkey, record) && 188 get_auto_shift_repeat(autoshift_lastkey, record) &&
188# endif 189# endif
189# if !defined(AUTO_SHIFT_NO_AUTO_REPEAT) || defined(AUTO_SHIFT_NO_AUTO_REPEAT_PER_KEY) 190# if !defined(AUTO_SHIFT_NO_AUTO_REPEAT) || defined(AUTO_SHIFT_NO_AUTO_REPEAT_PER_KEY)
190 ( 191 (
191 !autoshift_flags.lastshifted 192 !autoshift_flags.lastshifted
192# ifdef AUTO_SHIFT_NO_AUTO_REPEAT_PER_KEY 193# ifdef AUTO_SHIFT_NO_AUTO_REPEAT_PER_KEY
193 || get_auto_shift_no_auto_repeat(autoshift_lastkey, record) 194 || get_auto_shift_no_auto_repeat(autoshift_lastkey, record)
194# endif
195 ) &&
196# endif 195# endif
196 ) &&
197# endif
197 TIMER_DIFF_16(now, autoshift_time) < GET_TAPPING_TERM(autoshift_lastkey, record) 198 TIMER_DIFF_16(now, autoshift_time) < GET_TAPPING_TERM(autoshift_lastkey, record)
198 ) { 199 ) {
199 // clang-format on 200 // clang-format on
@@ -210,23 +211,23 @@ static bool autoshift_press(uint16_t keycode, uint16_t now, keyrecord_t *record)
210 autoshift_press_user(autoshift_lastkey, autoshift_flags.lastshifted, record); 211 autoshift_press_user(autoshift_lastkey, autoshift_flags.lastshifted, record);
211 return false; 212 return false;
212 } 213 }
213# endif 214#endif
214 215
215 // Use physical shift state of press event to be more like normal typing. 216 // Use physical shift state of press event to be more like normal typing.
216# if !defined(NO_ACTION_ONESHOT) && !defined(NO_ACTION_TAPPING) 217#if !defined(NO_ACTION_ONESHOT) && !defined(NO_ACTION_TAPPING)
217 autoshift_flags.lastshifted = (get_mods() | get_oneshot_mods()) & MOD_BIT(KC_LSFT); 218 autoshift_flags.lastshifted = (get_mods() | get_oneshot_mods()) & MOD_BIT(KC_LSFT);
218 set_oneshot_mods(get_oneshot_mods() & (~MOD_BIT(KC_LSFT))); 219 set_oneshot_mods(get_oneshot_mods() & (~MOD_BIT(KC_LSFT)));
219# else 220#else
220 autoshift_flags.lastshifted = get_mods() & MOD_BIT(KC_LSFT); 221 autoshift_flags.lastshifted = get_mods() & MOD_BIT(KC_LSFT);
221# endif 222#endif
222 // Record the keycode so we can simulate it later. 223 // Record the keycode so we can simulate it later.
223 autoshift_lastkey = keycode; 224 autoshift_lastkey = keycode;
224 autoshift_time = now; 225 autoshift_time = now;
225 autoshift_flags.in_progress = true; 226 autoshift_flags.in_progress = true;
226 227
227# if !defined(NO_ACTION_ONESHOT) && !defined(NO_ACTION_TAPPING) 228#if !defined(NO_ACTION_ONESHOT) && !defined(NO_ACTION_TAPPING)
228 clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); 229 clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
229# endif 230#endif
230 return false; 231 return false;
231} 232}
232 233
@@ -247,11 +248,11 @@ static void autoshift_end(uint16_t keycode, uint16_t now, bool matrix_trigger, k
247 autoshift_flags.lastshifted = 248 autoshift_flags.lastshifted =
248 autoshift_flags.lastshifted 249 autoshift_flags.lastshifted
249 || TIMER_DIFF_16(now, autoshift_time) >= 250 || TIMER_DIFF_16(now, autoshift_time) >=
250# ifdef AUTO_SHIFT_TIMEOUT_PER_KEY 251#ifdef AUTO_SHIFT_TIMEOUT_PER_KEY
251 get_autoshift_timeout(autoshift_lastkey, record) 252 get_autoshift_timeout(autoshift_lastkey, record)
252# else 253#else
253 autoshift_timeout 254 autoshift_timeout
254# endif 255#endif
255 ; 256 ;
256 // clang-format on 257 // clang-format on
257 set_autoshift_shift_state(autoshift_lastkey, autoshift_flags.lastshifted); 258 set_autoshift_shift_state(autoshift_lastkey, autoshift_flags.lastshifted);
@@ -266,23 +267,23 @@ static void autoshift_end(uint16_t keycode, uint16_t now, bool matrix_trigger, k
266 autoshift_press_user(autoshift_lastkey, autoshift_flags.lastshifted, record); 267 autoshift_press_user(autoshift_lastkey, autoshift_flags.lastshifted, record);
267 268
268 // clang-format off 269 // clang-format off
269# if (defined(AUTO_SHIFT_REPEAT) || defined(AUTO_SHIFT_REPEAT_PER_KEY)) && (!defined(AUTO_SHIFT_NO_AUTO_REPEAT) || defined(AUTO_SHIFT_NO_AUTO_REPEAT_PER_KEY)) 270#if (defined(AUTO_SHIFT_REPEAT) || defined(AUTO_SHIFT_REPEAT_PER_KEY)) && (!defined(AUTO_SHIFT_NO_AUTO_REPEAT) || defined(AUTO_SHIFT_NO_AUTO_REPEAT_PER_KEY))
270 if (matrix_trigger 271 if (matrix_trigger
271# ifdef AUTO_SHIFT_REPEAT_PER_KEY 272# ifdef AUTO_SHIFT_REPEAT_PER_KEY
272 && get_auto_shift_repeat(autoshift_lastkey, record) 273 && get_auto_shift_repeat(autoshift_lastkey, record)
273# endif 274# endif
274# ifdef AUTO_SHIFT_NO_AUTO_REPEAT_PER_KEY 275# ifdef AUTO_SHIFT_NO_AUTO_REPEAT_PER_KEY
275 && !get_auto_shift_no_auto_repeat(autoshift_lastkey, record) 276 && !get_auto_shift_no_auto_repeat(autoshift_lastkey, record)
276# endif 277# endif
277 ) { 278 ) {
278 // Prevents release. 279 // Prevents release.
279 return; 280 return;
280 } 281 }
281# endif 282#endif
282 // clang-format on 283 // clang-format on
283# if TAP_CODE_DELAY > 0 284#if TAP_CODE_DELAY > 0
284 wait_ms(TAP_CODE_DELAY); 285 wait_ms(TAP_CODE_DELAY);
285# endif 286#endif
286 287
287 autoshift_release_user(autoshift_lastkey, autoshift_flags.lastshifted, record); 288 autoshift_release_user(autoshift_lastkey, autoshift_flags.lastshifted, record);
288 autoshift_flush_shift(); 289 autoshift_flush_shift();
@@ -310,11 +311,11 @@ void autoshift_matrix_scan(void) {
310 if (autoshift_flags.in_progress) { 311 if (autoshift_flags.in_progress) {
311 const uint16_t now = timer_read(); 312 const uint16_t now = timer_read();
312 if (TIMER_DIFF_16(now, autoshift_time) >= 313 if (TIMER_DIFF_16(now, autoshift_time) >=
313# ifdef AUTO_SHIFT_TIMEOUT_PER_KEY 314#ifdef AUTO_SHIFT_TIMEOUT_PER_KEY
314 get_autoshift_timeout(autoshift_lastkey, &autoshift_lastrecord) 315 get_autoshift_timeout(autoshift_lastkey, &autoshift_lastrecord)
315# else 316#else
316 autoshift_timeout 317 autoshift_timeout
317# endif 318#endif
318 ) { 319 ) {
319 autoshift_end(autoshift_lastkey, now, true, &autoshift_lastrecord); 320 autoshift_end(autoshift_lastkey, now, true, &autoshift_lastrecord);
320 } 321 }
@@ -335,18 +336,18 @@ void autoshift_disable(void) {
335 autoshift_flush_shift(); 336 autoshift_flush_shift();
336} 337}
337 338
338# ifndef AUTO_SHIFT_NO_SETUP 339#ifndef AUTO_SHIFT_NO_SETUP
339void autoshift_timer_report(void) { 340void autoshift_timer_report(void) {
340# ifdef SEND_STRING_ENABLE 341# ifdef SEND_STRING_ENABLE
341 const char *autoshift_timeout_str = get_u16_str(autoshift_timeout, ' '); 342 const char *autoshift_timeout_str = get_u16_str(autoshift_timeout, ' ');
342 // Skip padding spaces 343 // Skip padding spaces
343 while (*autoshift_timeout_str == ' ') { 344 while (*autoshift_timeout_str == ' ') {
344 autoshift_timeout_str++; 345 autoshift_timeout_str++;
345 } 346 }
346 send_string(autoshift_timeout_str); 347 send_string(autoshift_timeout_str);
347# endif
348}
349# endif 348# endif
349}
350#endif
350 351
351bool get_autoshift_state(void) { 352bool get_autoshift_state(void) {
352 return autoshift_flags.enabled; 353 return autoshift_flags.enabled;
@@ -368,11 +369,11 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
368 // https://github.com/qmk/qmk_firmware/pull/9826#issuecomment-733559550 369 // https://github.com/qmk/qmk_firmware/pull/9826#issuecomment-733559550
369 // clang-format off 370 // clang-format off
370 const uint16_t now = 371 const uint16_t now =
371# if !defined(RETRO_SHIFT) || defined(NO_ACTION_TAPPING) 372#if !defined(RETRO_SHIFT) || defined(NO_ACTION_TAPPING)
372 timer_read() 373 timer_read()
373# else 374#else
374 (record->event.pressed) ? retroshift_time : timer_read() 375 (record->event.pressed) ? retroshift_time : timer_read()
375# endif 376#endif
376 ; 377 ;
377 // clang-format on 378 // clang-format on
378 379
@@ -393,7 +394,7 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
393 autoshift_disable(); 394 autoshift_disable();
394 break; 395 break;
395 396
396# ifndef AUTO_SHIFT_NO_SETUP 397#ifndef AUTO_SHIFT_NO_SETUP
397 case AS_UP: 398 case AS_UP:
398 autoshift_timeout += 5; 399 autoshift_timeout += 5;
399 break; 400 break;
@@ -403,27 +404,27 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
403 case AS_RPT: 404 case AS_RPT:
404 autoshift_timer_report(); 405 autoshift_timer_report();
405 break; 406 break;
406# endif 407#endif
407 } 408 }
408 // If Retro Shift is disabled, possible custom actions shouldn't happen. 409 // If Retro Shift is disabled, possible custom actions shouldn't happen.
409 // clang-format off 410 // clang-format off
410# if defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING) 411#if defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING)
411# ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY 412# ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY
412 const bool is_hold_on_interrupt = get_hold_on_other_key_press(keycode, record); 413 const bool is_hold_on_interrupt = get_hold_on_other_key_press(keycode, record);
413# else 414# else
414 const bool is_hold_on_interrupt = false; 415 const bool is_hold_on_interrupt = false;
415# endif 416# endif
416# endif 417#endif
417 if (IS_RETRO(keycode) 418 if (IS_RETRO(keycode)
418# if defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING) 419#if defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING)
419 // Not tapped or #defines mean that rolls should use hold action. 420 // Not tapped or #defines mean that rolls should use hold action.
420 && ( 421 && (
421 record->tap.count == 0 422 record->tap.count == 0
422# ifdef RETRO_TAPPING_PER_KEY 423# ifdef RETRO_TAPPING_PER_KEY
423 || !get_retro_tapping(keycode, record) 424 || !get_retro_tapping(keycode, record)
424# endif
425 || (record->tap.interrupted && is_hold_on_interrupt))
426# endif 425# endif
426 || (record->tap.interrupted && is_hold_on_interrupt))
427#endif
427 ) { 428 ) {
428 // clang-format on 429 // clang-format on
429 autoshift_lastkey = KC_NO; 430 autoshift_lastkey = KC_NO;
@@ -439,21 +440,21 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
439 // tap.count gets set to 0 in process_action 440 // tap.count gets set to 0 in process_action
440 // clang-format off 441 // clang-format off
441 else if (IS_RETRO(keycode) 442 else if (IS_RETRO(keycode)
442# if defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING) 443#if defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING)
443 && ( 444 && (
444 record->tap.count == 0 445 record->tap.count == 0
445# ifdef RETRO_TAPPING_PER_KEY 446# ifdef RETRO_TAPPING_PER_KEY
446 || !get_retro_tapping(keycode, record) 447 || !get_retro_tapping(keycode, record)
447# endif
448 )
449# endif 448# endif
449 )
450#endif
450 ) { 451 ) {
451 // Fixes modifiers not being applied to rolls with AUTO_SHIFT_MODIFIERS set. 452 // Fixes modifiers not being applied to rolls with AUTO_SHIFT_MODIFIERS set.
452# ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY 453#ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY
453 if (autoshift_flags.in_progress && get_hold_on_other_key_press(keycode, record)) { 454 if (autoshift_flags.in_progress && get_hold_on_other_key_press(keycode, record)) {
454 autoshift_end(KC_NO, now, false, &autoshift_lastrecord); 455 autoshift_end(KC_NO, now, false, &autoshift_lastrecord);
455 } 456 }
456# endif 457#endif
457 // clang-format on 458 // clang-format on
458 return true; 459 return true;
459 } 460 }
@@ -479,7 +480,7 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
479 return true; 480 return true;
480} 481}
481 482
482# if defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING) 483#if defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING)
483// Called to record time before possible delays by action_tapping_process. 484// Called to record time before possible delays by action_tapping_process.
484void retroshift_poll_time(keyevent_t *event) { 485void retroshift_poll_time(keyevent_t *event) {
485 last_retroshift_time = retroshift_time; 486 last_retroshift_time = retroshift_time;
@@ -493,6 +494,4 @@ void retroshift_swap_times(void) {
493 last_retroshift_time = temp; 494 last_retroshift_time = temp;
494 } 495 }
495} 496}
496# endif
497
498#endif 497#endif
diff --git a/quantum/process_keycode/process_auto_shift.h b/quantum/process_keycode/process_auto_shift.h
index 780177d2ff..885a47b533 100644
--- a/quantum/process_keycode/process_auto_shift.h
+++ b/quantum/process_keycode/process_auto_shift.h
@@ -16,7 +16,11 @@
16 16
17#pragma once 17#pragma once
18 18
19#include "quantum.h" 19#include <stdint.h>
20#include <stdbool.h>
21#include "action.h"
22#include "keyboard.h"
23#include "keycodes.h"
20 24
21#ifndef AUTO_SHIFT_TIMEOUT 25#ifndef AUTO_SHIFT_TIMEOUT
22# define AUTO_SHIFT_TIMEOUT 175 26# define AUTO_SHIFT_TIMEOUT 175
diff --git a/quantum/process_keycode/process_autocorrect.c b/quantum/process_keycode/process_autocorrect.c
index cc1f19e4f9..edc47718f3 100644
--- a/quantum/process_keycode/process_autocorrect.c
+++ b/quantum/process_keycode/process_autocorrect.c
@@ -6,7 +6,11 @@
6 6
7#include "process_autocorrect.h" 7#include "process_autocorrect.h"
8#include <string.h> 8#include <string.h>
9#include "keycodes.h"
10#include "quantum_keycodes.h"
9#include "keycode_config.h" 11#include "keycode_config.h"
12#include "send_string.h"
13#include "action_util.h"
10 14
11#if __has_include("autocorrect_data.h") 15#if __has_include("autocorrect_data.h")
12# include "autocorrect_data.h" 16# include "autocorrect_data.h"
diff --git a/quantum/process_keycode/process_autocorrect.h b/quantum/process_keycode/process_autocorrect.h
index 9cc7d46a8b..ea77d6f56f 100644
--- a/quantum/process_keycode/process_autocorrect.h
+++ b/quantum/process_keycode/process_autocorrect.h
@@ -6,7 +6,9 @@
6 6
7#pragma once 7#pragma once
8 8
9#include "quantum.h" 9#include <stdint.h>
10#include <stdbool.h>
11#include "action.h"
10 12
11bool process_autocorrect(uint16_t keycode, keyrecord_t *record); 13bool process_autocorrect(uint16_t keycode, keyrecord_t *record);
12bool process_autocorrect_user(uint16_t *keycode, keyrecord_t *record, uint8_t *typo_buffer_size, uint8_t *mods); 14bool process_autocorrect_user(uint16_t *keycode, keyrecord_t *record, uint8_t *typo_buffer_size, uint8_t *mods);
diff --git a/quantum/process_keycode/process_backlight.h b/quantum/process_keycode/process_backlight.h
index 7fe887ae67..e926833e79 100644
--- a/quantum/process_keycode/process_backlight.h
+++ b/quantum/process_keycode/process_backlight.h
@@ -16,6 +16,8 @@
16 16
17#pragma once 17#pragma once
18 18
19#include "quantum.h" 19#include <stdint.h>
20#include <stdbool.h>
21#include "action.h"
20 22
21bool process_backlight(uint16_t keycode, keyrecord_t *record); 23bool process_backlight(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/process_keycode/process_caps_word.c b/quantum/process_keycode/process_caps_word.c
index d4382680bf..1088c8f76c 100644
--- a/quantum/process_keycode/process_caps_word.c
+++ b/quantum/process_keycode/process_caps_word.c
@@ -13,6 +13,14 @@
13// limitations under the License. 13// limitations under the License.
14 14
15#include "process_caps_word.h" 15#include "process_caps_word.h"
16#include "process_auto_shift.h"
17#include "caps_word.h"
18#include "keycodes.h"
19#include "quantum_keycodes.h"
20#include "modifiers.h"
21#include "timer.h"
22#include "action_tapping.h"
23#include "action_util.h"
16 24
17#ifdef CAPS_WORD_INVERT_ON_SHIFT 25#ifdef CAPS_WORD_INVERT_ON_SHIFT
18static uint8_t held_mods = 0; 26static uint8_t held_mods = 0;
diff --git a/quantum/process_keycode/process_caps_word.h b/quantum/process_keycode/process_caps_word.h
index f215bbc3a3..f5eb140d32 100644
--- a/quantum/process_keycode/process_caps_word.h
+++ b/quantum/process_keycode/process_caps_word.h
@@ -14,8 +14,9 @@
14 14
15#pragma once 15#pragma once
16 16
17#include "quantum.h" 17#include <stdint.h>
18#include "caps_word.h" 18#include <stdbool.h>
19#include "action.h"
19 20
20/** 21/**
21 * @brief Process handler for Caps Word feature. 22 * @brief Process handler for Caps Word feature.
diff --git a/quantum/process_keycode/process_clicky.h b/quantum/process_keycode/process_clicky.h
index 67b6463c5d..dfdba14131 100644
--- a/quantum/process_keycode/process_clicky.h
+++ b/quantum/process_keycode/process_clicky.h
@@ -1,5 +1,9 @@
1#pragma once 1#pragma once
2 2
3#include <stdint.h>
4#include <stdbool.h>
5#include "action.h"
6
3void clicky_play(void); 7void clicky_play(void);
4bool process_clicky(uint16_t keycode, keyrecord_t *record); 8bool process_clicky(uint16_t keycode, keyrecord_t *record);
5 9
diff --git a/quantum/process_keycode/process_combo.c b/quantum/process_keycode/process_combo.c
index bbee560be9..0d4f4f3dba 100644
--- a/quantum/process_keycode/process_combo.c
+++ b/quantum/process_keycode/process_combo.c
@@ -14,11 +14,16 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16 16
17#include "keymap_common.h"
18#include "print.h"
19#include "process_combo.h" 17#include "process_combo.h"
18#include <stddef.h>
19#include "process_auto_shift.h"
20#include "caps_word.h"
21#include "timer.h"
22#include "keyboard.h"
23#include "keymap_common.h"
24#include "action_layer.h"
20#include "action_tapping.h" 25#include "action_tapping.h"
21#include "action.h" 26#include "action_util.h"
22#include "keymap_introspection.h" 27#include "keymap_introspection.h"
23 28
24__attribute__((weak)) void process_combo_event(uint16_t combo_index, bool pressed) {} 29__attribute__((weak)) void process_combo_event(uint16_t combo_index, bool pressed) {}
diff --git a/quantum/process_keycode/process_combo.h b/quantum/process_keycode/process_combo.h
index bba5d5ee63..f1d534236e 100644
--- a/quantum/process_keycode/process_combo.h
+++ b/quantum/process_keycode/process_combo.h
@@ -16,9 +16,11 @@
16 16
17#pragma once 17#pragma once
18 18
19#include "progmem.h"
20#include "quantum.h"
21#include <stdint.h> 19#include <stdint.h>
20#include <stdbool.h>
21#include "action.h"
22#include "keycodes.h"
23#include "quantum_keycodes.h"
22 24
23#ifdef EXTRA_SHORT_COMBOS 25#ifdef EXTRA_SHORT_COMBOS
24# define MAX_COMBO_LENGTH 6 26# define MAX_COMBO_LENGTH 6
diff --git a/quantum/process_keycode/process_dynamic_macro.c b/quantum/process_keycode/process_dynamic_macro.c
index a022949d3d..5e4a6fa308 100644
--- a/quantum/process_keycode/process_dynamic_macro.c
+++ b/quantum/process_keycode/process_dynamic_macro.c
@@ -17,6 +17,15 @@
17 17
18/* Author: Wojciech Siewierski < wojciech dot siewierski at onet dot pl > */ 18/* Author: Wojciech Siewierski < wojciech dot siewierski at onet dot pl > */
19#include "process_dynamic_macro.h" 19#include "process_dynamic_macro.h"
20#include <stddef.h>
21#include "action_layer.h"
22#include "keycodes.h"
23#include "debug.h"
24#include "wait.h"
25
26#ifdef BACKLIGHT_ENABLE
27# include "backlight.h"
28#endif
20 29
21// default feedback method 30// default feedback method
22void dynamic_macro_led_blink(void) { 31void dynamic_macro_led_blink(void) {
diff --git a/quantum/process_keycode/process_dynamic_macro.h b/quantum/process_keycode/process_dynamic_macro.h
index 9841254af4..2f10733cae 100644
--- a/quantum/process_keycode/process_dynamic_macro.h
+++ b/quantum/process_keycode/process_dynamic_macro.h
@@ -18,7 +18,9 @@
18/* Author: Wojciech Siewierski < wojciech dot siewierski at onet dot pl > */ 18/* Author: Wojciech Siewierski < wojciech dot siewierski at onet dot pl > */
19#pragma once 19#pragma once
20 20
21#include "quantum.h" 21#include <stdint.h>
22#include <stdbool.h>
23#include "action.h"
22 24
23/* May be overridden with a custom value. Be aware that the effective 25/* May be overridden with a custom value. Be aware that the effective
24 * macro length is half of this value: each keypress is recorded twice 26 * macro length is half of this value: each keypress is recorded twice
diff --git a/quantum/process_keycode/process_dynamic_tapping_term.c b/quantum/process_keycode/process_dynamic_tapping_term.c
index 146b9fccd7..cf52626e42 100644
--- a/quantum/process_keycode/process_dynamic_tapping_term.c
+++ b/quantum/process_keycode/process_dynamic_tapping_term.c
@@ -14,8 +14,10 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16 16
17#include "quantum.h"
18#include "process_dynamic_tapping_term.h" 17#include "process_dynamic_tapping_term.h"
18#include "quantum.h"
19#include "keycodes.h"
20#include "send_string.h"
19 21
20#ifndef DYNAMIC_TAPPING_TERM_INCREMENT 22#ifndef DYNAMIC_TAPPING_TERM_INCREMENT
21# define DYNAMIC_TAPPING_TERM_INCREMENT 5 23# define DYNAMIC_TAPPING_TERM_INCREMENT 5
diff --git a/quantum/process_keycode/process_dynamic_tapping_term.h b/quantum/process_keycode/process_dynamic_tapping_term.h
index 85e83ee73b..fee29e18df 100644
--- a/quantum/process_keycode/process_dynamic_tapping_term.h
+++ b/quantum/process_keycode/process_dynamic_tapping_term.h
@@ -16,6 +16,7 @@
16 16
17#pragma once 17#pragma once
18 18
19#include <stdint.h>
19#include <stdbool.h> 20#include <stdbool.h>
20#include "action.h" 21#include "action.h"
21 22
diff --git a/quantum/process_keycode/process_grave_esc.c b/quantum/process_keycode/process_grave_esc.c
index ddf027391d..d786f57a80 100644
--- a/quantum/process_keycode/process_grave_esc.c
+++ b/quantum/process_keycode/process_grave_esc.c
@@ -14,6 +14,9 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include "process_grave_esc.h" 16#include "process_grave_esc.h"
17#include "keycodes.h"
18#include "modifiers.h"
19#include "action_util.h"
17 20
18/* true if the last press of QK_GRAVE_ESCAPE was shifted (i.e. GUI or SHIFT were pressed), false otherwise. 21/* true if the last press of QK_GRAVE_ESCAPE was shifted (i.e. GUI or SHIFT were pressed), false otherwise.
19 * Used to ensure that the correct keycode is released if the key is released. 22 * Used to ensure that the correct keycode is released if the key is released.
diff --git a/quantum/process_keycode/process_grave_esc.h b/quantum/process_keycode/process_grave_esc.h
index bbf4483763..358ff3c4e7 100644
--- a/quantum/process_keycode/process_grave_esc.h
+++ b/quantum/process_keycode/process_grave_esc.h
@@ -15,6 +15,8 @@
15 */ 15 */
16#pragma once 16#pragma once
17 17
18#include "quantum.h" 18#include <stdint.h>
19#include <stdbool.h>
20#include "action.h"
19 21
20bool process_grave_esc(uint16_t keycode, keyrecord_t *record); 22bool process_grave_esc(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/process_keycode/process_haptic.h b/quantum/process_keycode/process_haptic.h
index 6dbb0f014d..7e61f6c0d6 100644
--- a/quantum/process_keycode/process_haptic.h
+++ b/quantum/process_keycode/process_haptic.h
@@ -15,6 +15,7 @@
15 */ 15 */
16#pragma once 16#pragma once
17 17
18#include <stdint.h>
18#include <stdbool.h> 19#include <stdbool.h>
19#include "action.h" 20#include "action.h"
20 21
diff --git a/quantum/process_keycode/process_joystick.h b/quantum/process_keycode/process_joystick.h
index 1fb8757708..aa1a443271 100644
--- a/quantum/process_keycode/process_joystick.h
+++ b/quantum/process_keycode/process_joystick.h
@@ -17,6 +17,7 @@
17#pragma once 17#pragma once
18 18
19#include <stdint.h> 19#include <stdint.h>
20#include "quantum.h" 20#include <stdbool.h>
21#include "action.h"
21 22
22bool process_joystick(uint16_t keycode, keyrecord_t *record); 23bool process_joystick(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/process_keycode/process_key_lock.h b/quantum/process_keycode/process_key_lock.h
index 5159b0ba02..858945a8e4 100644
--- a/quantum/process_keycode/process_key_lock.h
+++ b/quantum/process_keycode/process_key_lock.h
@@ -16,7 +16,9 @@
16 16
17#pragma once 17#pragma once
18 18
19#include "quantum.h" 19#include <stdint.h>
20#include <stdbool.h>
21#include "action.h"
20 22
21void cancel_key_lock(void); 23void cancel_key_lock(void);
22bool process_key_lock(uint16_t *keycode, keyrecord_t *record); 24bool process_key_lock(uint16_t *keycode, keyrecord_t *record);
diff --git a/quantum/process_keycode/process_key_override.c b/quantum/process_keycode/process_key_override.c
index de628d3fec..6ce1e4d925 100644
--- a/quantum/process_keycode/process_key_override.c
+++ b/quantum/process_keycode/process_key_override.c
@@ -15,12 +15,10 @@
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18#include "quantum.h" 18#include "process_key_override.h"
19#include "report.h" 19#include "report.h"
20#include "timer.h" 20#include "timer.h"
21#include "process_key_override.h" 21#include "debug.h"
22
23#include <debug.h>
24 22
25#ifndef KEY_OVERRIDE_REPEAT_DELAY 23#ifndef KEY_OVERRIDE_REPEAT_DELAY
26# define KEY_OVERRIDE_REPEAT_DELAY 500 24# define KEY_OVERRIDE_REPEAT_DELAY 500
diff --git a/quantum/process_keycode/process_key_override.h b/quantum/process_keycode/process_key_override.h
index fd76f297a8..3e37c7e63a 100644
--- a/quantum/process_keycode/process_key_override.h
+++ b/quantum/process_keycode/process_key_override.h
@@ -18,9 +18,8 @@
18#pragma once 18#pragma once
19 19
20#include <stdbool.h> 20#include <stdbool.h>
21#include <stddef.h>
22#include <stdint.h> 21#include <stdint.h>
23 22#include "action.h"
24#include "action_layer.h" 23#include "action_layer.h"
25 24
26/** 25/**
diff --git a/quantum/process_keycode/process_leader.c b/quantum/process_keycode/process_leader.c
index a9823b6285..ca017a577d 100644
--- a/quantum/process_keycode/process_leader.c
+++ b/quantum/process_keycode/process_leader.c
@@ -16,6 +16,7 @@
16 16
17#include "process_leader.h" 17#include "process_leader.h"
18#include "leader.h" 18#include "leader.h"
19#include "quantum_keycodes.h"
19 20
20bool process_leader(uint16_t keycode, keyrecord_t *record) { 21bool process_leader(uint16_t keycode, keyrecord_t *record) {
21 if (record->event.pressed) { 22 if (record->event.pressed) {
diff --git a/quantum/process_keycode/process_leader.h b/quantum/process_keycode/process_leader.h
index eb0f721f60..b78fbb94df 100644
--- a/quantum/process_keycode/process_leader.h
+++ b/quantum/process_keycode/process_leader.h
@@ -16,6 +16,8 @@
16 16
17#pragma once 17#pragma once
18 18
19#include "quantum.h" 19#include <stdint.h>
20#include <stdbool.h>
21#include "action.h"
20 22
21bool process_leader(uint16_t keycode, keyrecord_t *record); 23bool process_leader(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/process_keycode/process_magic.c b/quantum/process_keycode/process_magic.c
index 5fafe8550f..3b35884d68 100644
--- a/quantum/process_keycode/process_magic.c
+++ b/quantum/process_keycode/process_magic.c
@@ -14,8 +14,13 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include "process_magic.h" 16#include "process_magic.h"
17#include "keycode_config.h"
18#include "keycodes.h"
19#include "eeconfig.h"
17 20
18#ifdef AUDIO_ENABLE 21#ifdef AUDIO_ENABLE
22# include "audio.h"
23
19# ifndef AG_NORM_SONG 24# ifndef AG_NORM_SONG
20# define AG_NORM_SONG SONG(AG_NORM_SOUND) 25# define AG_NORM_SONG SONG(AG_NORM_SOUND)
21# endif 26# endif
diff --git a/quantum/process_keycode/process_magic.h b/quantum/process_keycode/process_magic.h
index 1eb39f1455..aa65a43bae 100644
--- a/quantum/process_keycode/process_magic.h
+++ b/quantum/process_keycode/process_magic.h
@@ -15,6 +15,8 @@
15 */ 15 */
16#pragma once 16#pragma once
17 17
18#include "quantum.h" 18#include <stdint.h>
19#include <stdbool.h>
20#include "action.h"
19 21
20bool process_magic(uint16_t keycode, keyrecord_t *record); 22bool process_magic(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/process_keycode/process_midi.c b/quantum/process_keycode/process_midi.c
index ce62559849..377fcb69e2 100644
--- a/quantum/process_keycode/process_midi.c
+++ b/quantum/process_keycode/process_midi.c
@@ -15,12 +15,13 @@
15 */ 15 */
16#include "process_midi.h" 16#include "process_midi.h"
17 17
18#ifdef MIDI_ENABLE 18#include <LUFA/Drivers/USB/USB.h>
19# include <LUFA/Drivers/USB/USB.h> 19#include "midi.h"
20# include "midi.h" 20#include "qmk_midi.h"
21# include "qmk_midi.h" 21#include "timer.h"
22#include "debug.h"
22 23
23# ifdef MIDI_BASIC 24#ifdef MIDI_BASIC
24 25
25void process_midi_basic_noteon(uint8_t note) { 26void process_midi_basic_noteon(uint8_t note) {
26 midi_send_noteon(&midi_device, 0, note, 127); 27 midi_send_noteon(&midi_device, 0, note, 127);
@@ -34,12 +35,9 @@ void process_midi_all_notes_off(void) {
34 midi_send_cc(&midi_device, 0, 0x7B, 0); 35 midi_send_cc(&midi_device, 0, 0x7B, 0);
35} 36}
36 37
37# endif // MIDI_BASIC 38#endif // MIDI_BASIC
38
39# ifdef MIDI_ADVANCED
40
41# include "timer.h"
42 39
40#ifdef MIDI_ADVANCED
43static uint8_t tone_status[2][MIDI_TONE_COUNT]; 41static uint8_t tone_status[2][MIDI_TONE_COUNT];
44 42
45static uint8_t midi_modulation; 43static uint8_t midi_modulation;
@@ -248,11 +246,11 @@ bool process_midi(uint16_t keycode, keyrecord_t *record) {
248 return true; 246 return true;
249} 247}
250 248
251# endif // MIDI_ADVANCED 249#endif // MIDI_ADVANCED
252 250
253void midi_task(void) { 251void midi_task(void) {
254 midi_device_process(&midi_device); 252 midi_device_process(&midi_device);
255# ifdef MIDI_ADVANCED 253#ifdef MIDI_ADVANCED
256 if (timer_elapsed(midi_modulation_timer) < midi_config.modulation_interval) return; 254 if (timer_elapsed(midi_modulation_timer) < midi_config.modulation_interval) return;
257 midi_modulation_timer = timer_read(); 255 midi_modulation_timer = timer_read();
258 256
@@ -270,7 +268,5 @@ void midi_task(void) {
270 268
271 if (midi_modulation > 127) midi_modulation = 127; 269 if (midi_modulation > 127) midi_modulation = 127;
272 } 270 }
273# endif 271#endif
274} 272}
275
276#endif // MIDI_ENABLE
diff --git a/quantum/process_keycode/process_midi.h b/quantum/process_keycode/process_midi.h
index e528c6ec0c..64ccc610f9 100644
--- a/quantum/process_keycode/process_midi.h
+++ b/quantum/process_keycode/process_midi.h
@@ -16,7 +16,10 @@
16 16
17#pragma once 17#pragma once
18 18
19#include "quantum.h" 19#include <stdint.h>
20#include <stdbool.h>
21#include "action.h"
22#include "quantum_keycodes.h"
20 23
21#ifdef MIDI_ENABLE 24#ifdef MIDI_ENABLE
22 25
diff --git a/quantum/process_keycode/process_music.c b/quantum/process_keycode/process_music.c
index 7c572079a7..f047668504 100644
--- a/quantum/process_keycode/process_music.c
+++ b/quantum/process_keycode/process_music.c
@@ -14,8 +14,10 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include "process_music.h" 16#include "process_music.h"
17#include "timer.h"
17 18
18#ifdef AUDIO_ENABLE 19#ifdef AUDIO_ENABLE
20# include "audio.h"
19# include "process_audio.h" 21# include "process_audio.h"
20#endif 22#endif
21#if defined(MIDI_ENABLE) && defined(MIDI_BASIC) 23#if defined(MIDI_ENABLE) && defined(MIDI_BASIC)
diff --git a/quantum/process_keycode/process_music.h b/quantum/process_keycode/process_music.h
index 83726a05ba..ed39d3cda5 100644
--- a/quantum/process_keycode/process_music.h
+++ b/quantum/process_keycode/process_music.h
@@ -16,7 +16,9 @@
16 16
17#pragma once 17#pragma once
18 18
19#include "quantum.h" 19#include <stdint.h>
20#include <stdbool.h>
21#include "action.h"
20 22
21#if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC)) 23#if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
22 24
diff --git a/quantum/process_keycode/process_programmable_button.h b/quantum/process_keycode/process_programmable_button.h
index 47c6ce5614..ef818af4ca 100644
--- a/quantum/process_keycode/process_programmable_button.h
+++ b/quantum/process_keycode/process_programmable_button.h
@@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
18#pragma once 18#pragma once
19 19
20#include <stdint.h> 20#include <stdint.h>
21#include "quantum.h" 21#include <stdbool.h>
22#include "action.h"
22 23
23bool process_programmable_button(uint16_t keycode, keyrecord_t *record); 24bool process_programmable_button(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/process_keycode/process_repeat_key.c b/quantum/process_keycode/process_repeat_key.c
index f819aa226e..73f4ddedcf 100644
--- a/quantum/process_keycode/process_repeat_key.c
+++ b/quantum/process_keycode/process_repeat_key.c
@@ -13,6 +13,10 @@
13// limitations under the License. 13// limitations under the License.
14 14
15#include "process_repeat_key.h" 15#include "process_repeat_key.h"
16#include "repeat_key.h"
17#include "keycodes.h"
18#include "quantum_keycodes.h"
19#include "action_util.h"
16 20
17// Default implementation of remember_last_key_user(). 21// Default implementation of remember_last_key_user().
18__attribute__((weak)) bool remember_last_key_user(uint16_t keycode, keyrecord_t* record, uint8_t* remembered_mods) { 22__attribute__((weak)) bool remember_last_key_user(uint16_t keycode, keyrecord_t* record, uint8_t* remembered_mods) {
diff --git a/quantum/process_keycode/process_repeat_key.h b/quantum/process_keycode/process_repeat_key.h
index eddc50f254..c3b200c632 100644
--- a/quantum/process_keycode/process_repeat_key.h
+++ b/quantum/process_keycode/process_repeat_key.h
@@ -14,7 +14,9 @@
14 14
15#pragma once 15#pragma once
16 16
17#include "quantum.h" 17#include <stdint.h>
18#include <stdbool.h>
19#include "action.h"
18 20
19/** 21/**
20 * @brief Process handler for remembering the last key. 22 * @brief Process handler for remembering the last key.
diff --git a/quantum/process_keycode/process_rgb.c b/quantum/process_keycode/process_rgb.c
index dae129786e..4e63bf3ca8 100644
--- a/quantum/process_keycode/process_rgb.c
+++ b/quantum/process_keycode/process_rgb.c
@@ -14,6 +14,14 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include "process_rgb.h" 16#include "process_rgb.h"
17#include "action_util.h"
18
19#ifdef RGB_MATRIX_ENABLE
20# include "rgb_matrix.h"
21#endif
22#ifdef RGBLIGHT_ENABLE
23# include "rgblight.h"
24#endif
17 25
18typedef void (*rgb_func_pointer)(void); 26typedef void (*rgb_func_pointer)(void);
19 27
diff --git a/quantum/process_keycode/process_rgb.h b/quantum/process_keycode/process_rgb.h
index 26aca46896..b1069d4bb6 100644
--- a/quantum/process_keycode/process_rgb.h
+++ b/quantum/process_keycode/process_rgb.h
@@ -15,6 +15,8 @@
15 */ 15 */
16#pragma once 16#pragma once
17 17
18#include "quantum.h" 18#include <stdint.h>
19#include <stdbool.h>
20#include "action.h"
19 21
20bool process_rgb(const uint16_t keycode, const keyrecord_t *record); 22bool process_rgb(const uint16_t keycode, const keyrecord_t *record);
diff --git a/quantum/process_keycode/process_secure.h b/quantum/process_keycode/process_secure.h
index 2814264b92..78d793f0f6 100644
--- a/quantum/process_keycode/process_secure.h
+++ b/quantum/process_keycode/process_secure.h
@@ -3,6 +3,7 @@
3 3
4#pragma once 4#pragma once
5 5
6#include <stdint.h>
6#include <stdbool.h> 7#include <stdbool.h>
7#include "action.h" 8#include "action.h"
8 9
diff --git a/quantum/process_keycode/process_sequencer.h b/quantum/process_keycode/process_sequencer.h
index 2b85f24299..3a9bdc2b24 100644
--- a/quantum/process_keycode/process_sequencer.h
+++ b/quantum/process_keycode/process_sequencer.h
@@ -16,6 +16,8 @@
16 16
17#pragma once 17#pragma once
18 18
19#include "quantum.h" 19#include <stdint.h>
20#include <stdbool.h>
21#include "action.h"
20 22
21bool process_sequencer(uint16_t keycode, keyrecord_t *record); 23bool process_sequencer(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/process_keycode/process_space_cadet.c b/quantum/process_keycode/process_space_cadet.c
index 3109ea1711..4d9f01077e 100644
--- a/quantum/process_keycode/process_space_cadet.c
+++ b/quantum/process_keycode/process_space_cadet.c
@@ -14,6 +14,8 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include "process_space_cadet.h" 16#include "process_space_cadet.h"
17#include "keycodes.h"
18#include "timer.h"
17#include "action_tapping.h" 19#include "action_tapping.h"
18 20
19// ********** OBSOLETE DEFINES, STOP USING! (pls?) ********** 21// ********** OBSOLETE DEFINES, STOP USING! (pls?) **********
diff --git a/quantum/process_keycode/process_space_cadet.h b/quantum/process_keycode/process_space_cadet.h
index fcb70f3b43..6d10051532 100644
--- a/quantum/process_keycode/process_space_cadet.h
+++ b/quantum/process_keycode/process_space_cadet.h
@@ -15,7 +15,9 @@
15 */ 15 */
16#pragma once 16#pragma once
17 17
18#include "quantum.h" 18#include <stdint.h>
19#include <stdbool.h>
20#include "action.h"
19 21
20void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdMod, uint8_t tapMod, uint8_t keycode); 22void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdMod, uint8_t tapMod, uint8_t keycode);
21bool process_space_cadet(uint16_t keycode, keyrecord_t *record); 23bool process_space_cadet(uint16_t keycode, keyrecord_t *record);
diff --git a/quantum/process_keycode/process_steno.c b/quantum/process_keycode/process_steno.c
index d5ad61ba85..af26d4ca86 100644
--- a/quantum/process_keycode/process_steno.c
+++ b/quantum/process_keycode/process_steno.c
@@ -15,6 +15,7 @@
15 */ 15 */
16#include "process_steno.h" 16#include "process_steno.h"
17#include "quantum_keycodes.h" 17#include "quantum_keycodes.h"
18#include "eeconfig.h"
18#include "keymap_steno.h" 19#include "keymap_steno.h"
19#include <string.h> 20#include <string.h>
20#ifdef VIRTSER_ENABLE 21#ifdef VIRTSER_ENABLE
diff --git a/quantum/process_keycode/process_steno.h b/quantum/process_keycode/process_steno.h
index 68d6097b9b..0dd2103218 100644
--- a/quantum/process_keycode/process_steno.h
+++ b/quantum/process_keycode/process_steno.h
@@ -16,7 +16,9 @@
16 16
17#pragma once 17#pragma once
18 18
19#include "quantum.h" 19#include <stdint.h>
20#include <stdbool.h>
21#include "action.h"
20 22
21#define BOLT_STROKE_SIZE 4 23#define BOLT_STROKE_SIZE 4
22#define GEMINI_STROKE_SIZE 6 24#define GEMINI_STROKE_SIZE 6
diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c
index 706f5cddbb..1b2c6c8a44 100644
--- a/quantum/process_keycode/process_tap_dance.c
+++ b/quantum/process_keycode/process_tap_dance.c
@@ -13,7 +13,14 @@
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16
17#include "process_tap_dance.h"
16#include "quantum.h" 18#include "quantum.h"
19#include "action_layer.h"
20#include "action_tapping.h"
21#include "action_util.h"
22#include "timer.h"
23#include "wait.h"
17 24
18static uint16_t active_td; 25static uint16_t active_td;
19static uint16_t last_tap_time; 26static uint16_t last_tap_time;
diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h
index 5cb6d9202c..386f504619 100644
--- a/quantum/process_keycode/process_tap_dance.h
+++ b/quantum/process_keycode/process_tap_dance.h
@@ -16,18 +16,17 @@
16 16
17#pragma once 17#pragma once
18 18
19#ifdef TAP_DANCE_ENABLE 19#include <stdint.h>
20 20#include <stdbool.h>
21# include <stdbool.h> 21#include "action.h"
22# include <inttypes.h>
23 22
24typedef struct { 23typedef struct {
25 uint16_t interrupting_keycode; 24 uint16_t interrupting_keycode;
26 uint8_t count; 25 uint8_t count;
27 uint8_t weak_mods; 26 uint8_t weak_mods;
28# ifndef NO_ACTION_ONESHOT 27#ifndef NO_ACTION_ONESHOT
29 uint8_t oneshot_mods; 28 uint8_t oneshot_mods;
30# endif 29#endif
31 bool pressed : 1; 30 bool pressed : 1;
32 bool finished : 1; 31 bool finished : 1;
33 bool interrupted : 1; 32 bool interrupted : 1;
@@ -56,24 +55,24 @@ typedef struct {
56 void (*layer_function)(uint8_t); 55 void (*layer_function)(uint8_t);
57} tap_dance_dual_role_t; 56} tap_dance_dual_role_t;
58 57
59# define ACTION_TAP_DANCE_DOUBLE(kc1, kc2) \ 58#define ACTION_TAP_DANCE_DOUBLE(kc1, kc2) \
60 { .fn = {tap_dance_pair_on_each_tap, tap_dance_pair_finished, tap_dance_pair_reset}, .user_data = (void *)&((tap_dance_pair_t){kc1, kc2}), } 59 { .fn = {tap_dance_pair_on_each_tap, tap_dance_pair_finished, tap_dance_pair_reset}, .user_data = (void *)&((tap_dance_pair_t){kc1, kc2}), }
61 60
62# define ACTION_TAP_DANCE_LAYER_MOVE(kc, layer) \ 61#define ACTION_TAP_DANCE_LAYER_MOVE(kc, layer) \
63 { .fn = {tap_dance_dual_role_on_each_tap, tap_dance_dual_role_finished, tap_dance_dual_role_reset}, .user_data = (void *)&((tap_dance_dual_role_t){kc, layer, layer_move}), } 62 { .fn = {tap_dance_dual_role_on_each_tap, tap_dance_dual_role_finished, tap_dance_dual_role_reset}, .user_data = (void *)&((tap_dance_dual_role_t){kc, layer, layer_move}), }
64 63
65# define ACTION_TAP_DANCE_LAYER_TOGGLE(kc, layer) \ 64#define ACTION_TAP_DANCE_LAYER_TOGGLE(kc, layer) \
66 { .fn = {NULL, tap_dance_dual_role_finished, tap_dance_dual_role_reset}, .user_data = (void *)&((tap_dance_dual_role_t){kc, layer, layer_invert}), } 65 { .fn = {NULL, tap_dance_dual_role_finished, tap_dance_dual_role_reset}, .user_data = (void *)&((tap_dance_dual_role_t){kc, layer, layer_invert}), }
67 66
68# define ACTION_TAP_DANCE_FN(user_fn) \ 67#define ACTION_TAP_DANCE_FN(user_fn) \
69 { .fn = {NULL, user_fn, NULL}, .user_data = NULL, } 68 { .fn = {NULL, user_fn, NULL}, .user_data = NULL, }
70 69
71# define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset) \ 70#define ACTION_TAP_DANCE_FN_ADVANCED(user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset) \
72 { .fn = {user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset}, .user_data = NULL, } 71 { .fn = {user_fn_on_each_tap, user_fn_on_dance_finished, user_fn_on_dance_reset}, .user_data = NULL, }
73 72
74# define TD(n) (QK_TAP_DANCE | TD_INDEX(n)) 73#define TD(n) (QK_TAP_DANCE | TD_INDEX(n))
75# define TD_INDEX(code) ((code)&0xFF) 74#define TD_INDEX(code) ((code)&0xFF)
76# define TAP_DANCE_KEYCODE(state) TD(((tap_dance_action_t *)state) - tap_dance_actions) 75#define TAP_DANCE_KEYCODE(state) TD(((tap_dance_action_t *)state) - tap_dance_actions)
77 76
78extern tap_dance_action_t tap_dance_actions[]; 77extern tap_dance_action_t tap_dance_actions[];
79 78
@@ -92,9 +91,3 @@ void tap_dance_pair_reset(tap_dance_state_t *state, void *user_data);
92void tap_dance_dual_role_on_each_tap(tap_dance_state_t *state, void *user_data); 91void tap_dance_dual_role_on_each_tap(tap_dance_state_t *state, void *user_data);
93void tap_dance_dual_role_finished(tap_dance_state_t *state, void *user_data); 92void tap_dance_dual_role_finished(tap_dance_state_t *state, void *user_data);
94void tap_dance_dual_role_reset(tap_dance_state_t *state, void *user_data); 93void tap_dance_dual_role_reset(tap_dance_state_t *state, void *user_data);
95
96#else
97
98# define TD(n) KC_NO
99
100#endif
diff --git a/quantum/process_keycode/process_tri_layer.h b/quantum/process_keycode/process_tri_layer.h
index 9c4e3df1c2..5e6e4ff94d 100644
--- a/quantum/process_keycode/process_tri_layer.h
+++ b/quantum/process_keycode/process_tri_layer.h
@@ -3,6 +3,8 @@
3 3
4#pragma once 4#pragma once
5 5
6#include <stdint.h>
7#include <stdbool.h>
6#include "action.h" 8#include "action.h"
7 9
8/** 10/**