summaryrefslogtreecommitdiffstats
path: root/quantum/process_keycode
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2022-02-12 10:29:31 -0800
committerGitHub <noreply@github.com>2022-02-12 18:29:31 +0000
commit63646e8906e062d1c1de3925cba70c4e3426a855 (patch)
tree4e91648b77b838e1125cf86331d7e84bde6d07a9 /quantum/process_keycode
parentafcdd7079c774dec2aa4b7f2d08adf8b7310919b (diff)
Format code according to conventions (#16322)
Diffstat (limited to 'quantum/process_keycode')
-rw-r--r--quantum/process_keycode/process_audio.c12
-rw-r--r--quantum/process_keycode/process_auto_shift.c36
-rw-r--r--quantum/process_keycode/process_clicky.c32
-rw-r--r--quantum/process_keycode/process_combo.c40
-rw-r--r--quantum/process_keycode/process_dynamic_macro.c16
-rw-r--r--quantum/process_keycode/process_joystick.c4
-rw-r--r--quantum/process_keycode/process_key_override.c24
-rw-r--r--quantum/process_keycode/process_leader.c4
-rw-r--r--quantum/process_keycode/process_magic.c8
-rw-r--r--quantum/process_keycode/process_midi.c26
-rw-r--r--quantum/process_keycode/process_midi.h4
-rw-r--r--quantum/process_keycode/process_music.c26
-rw-r--r--quantum/process_keycode/process_music.h8
-rw-r--r--quantum/process_keycode/process_printer.c7
-rw-r--r--quantum/process_keycode/process_printer_bb.c23
-rw-r--r--quantum/process_keycode/process_steno.c24
-rw-r--r--quantum/process_keycode/process_tap_dance.c4
-rw-r--r--quantum/process_keycode/process_terminal.c34
-rw-r--r--quantum/process_keycode/process_ucis.c2
-rw-r--r--quantum/process_keycode/process_unicode_common.c24
-rw-r--r--quantum/process_keycode/process_unicode_common.h12
21 files changed, 239 insertions, 131 deletions
diff --git a/quantum/process_keycode/process_audio.c b/quantum/process_keycode/process_audio.c
index 23664721e8..e7fe453308 100644
--- a/quantum/process_keycode/process_audio.c
+++ b/quantum/process_keycode/process_audio.c
@@ -50,11 +50,17 @@ bool process_audio(uint16_t keycode, keyrecord_t *record) {
return true;
}
-void process_audio_noteon(uint8_t note) { play_note(compute_freq_for_midi_note(note), 0xF); }
+void process_audio_noteon(uint8_t note) {
+ play_note(compute_freq_for_midi_note(note), 0xF);
+}
-void process_audio_noteoff(uint8_t note) { stop_note(compute_freq_for_midi_note(note)); }
+void process_audio_noteoff(uint8_t note) {
+ stop_note(compute_freq_for_midi_note(note));
+}
-void process_audio_all_notes_off(void) { stop_all_notes(); }
+void process_audio_all_notes_off(void) {
+ stop_all_notes();
+}
__attribute__((weak)) void audio_on_user() {}
__attribute__((weak)) void audio_off_user() {}
diff --git a/quantum/process_keycode/process_auto_shift.c b/quantum/process_keycode/process_auto_shift.c
index bbc6367ff1..2150edd7b2 100644
--- a/quantum/process_keycode/process_auto_shift.c
+++ b/quantum/process_keycode/process_auto_shift.c
@@ -62,7 +62,9 @@ static struct {
// clang-format on
/** \brief Called on physical press, returns whether key should be added to Auto Shift */
-__attribute__((weak)) bool get_custom_auto_shifted_key(uint16_t keycode, keyrecord_t *record) { return false; }
+__attribute__((weak)) bool get_custom_auto_shifted_key(uint16_t keycode, keyrecord_t *record) {
+ return false;
+}
/** \brief Called on physical press, returns whether is Auto Shift key */
__attribute__((weak)) bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *record) {
@@ -82,8 +84,12 @@ __attribute__((weak)) bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *r
}
/** \brief Called to check whether defines should apply if PER_KEY is set for it */
-__attribute__((weak)) bool get_auto_shift_repeat(uint16_t keycode, keyrecord_t *record) { return true; }
-__attribute__((weak)) bool get_auto_shift_no_auto_repeat(uint16_t keycode, keyrecord_t *record) { return true; }
+__attribute__((weak)) bool get_auto_shift_repeat(uint16_t keycode, keyrecord_t *record) {
+ return true;
+}
+__attribute__((weak)) bool get_auto_shift_no_auto_repeat(uint16_t keycode, keyrecord_t *record) {
+ return true;
+}
/** \brief Called when an Auto Shift key needs to be pressed */
__attribute__((weak)) void autoshift_press_user(uint16_t keycode, bool shifted, keyrecord_t *record) {
@@ -94,7 +100,9 @@ __attribute__((weak)) void autoshift_press_user(uint16_t keycode, bool shifted,
}
/** \brief Called when an Auto Shift key needs to be released */
-__attribute__((weak)) void autoshift_release_user(uint16_t keycode, bool shifted, keyrecord_t *record) { unregister_code16((IS_RETRO(keycode)) ? keycode & 0xFF : keycode); }
+__attribute__((weak)) void autoshift_release_user(uint16_t keycode, bool shifted, keyrecord_t *record) {
+ unregister_code16((IS_RETRO(keycode)) ? keycode & 0xFF : keycode);
+}
/** \brief Sets the shift state to use when keyrepeating, required by custom shifts */
void set_autoshift_shift_state(uint16_t keycode, bool shifted) {
@@ -311,7 +319,9 @@ void autoshift_toggle(void) {
autoshift_flush_shift();
}
-void autoshift_enable(void) { autoshift_flags.enabled = true; }
+void autoshift_enable(void) {
+ autoshift_flags.enabled = true;
+}
void autoshift_disable(void) {
autoshift_flags.enabled = false;
@@ -328,12 +338,20 @@ void autoshift_timer_report(void) {
}
# endif
-bool get_autoshift_state(void) { return autoshift_flags.enabled; }
+bool get_autoshift_state(void) {
+ return autoshift_flags.enabled;
+}
-uint16_t get_generic_autoshift_timeout() { return autoshift_timeout; }
-__attribute__((weak)) uint16_t get_autoshift_timeout(uint16_t keycode, keyrecord_t *record) { return autoshift_timeout; }
+uint16_t get_generic_autoshift_timeout() {
+ return autoshift_timeout;
+}
+__attribute__((weak)) uint16_t get_autoshift_timeout(uint16_t keycode, keyrecord_t *record) {
+ return autoshift_timeout;
+}
-void set_autoshift_timeout(uint16_t timeout) { autoshift_timeout = timeout; }
+void set_autoshift_timeout(uint16_t timeout) {
+ autoshift_timeout = timeout;
+}
bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
// Note that record->event.time isn't reliable, see:
diff --git a/quantum/process_keycode/process_clicky.c b/quantum/process_keycode/process_clicky.c
index 6ab382d4aa..9795734984 100644
--- a/quantum/process_keycode/process_clicky.c
+++ b/quantum/process_keycode/process_clicky.c
@@ -5,40 +5,40 @@
# ifndef AUDIO_CLICKY_DELAY_DURATION
# define AUDIO_CLICKY_DELAY_DURATION 1
-# endif // !AUDIO_CLICKY_DELAY_DURATION
+# endif // !AUDIO_CLICKY_DELAY_DURATION
# ifndef AUDIO_CLICKY_FREQ_DEFAULT
# define AUDIO_CLICKY_FREQ_DEFAULT 440.0f
-# endif // !AUDIO_CLICKY_FREQ_DEFAULT
+# endif // !AUDIO_CLICKY_FREQ_DEFAULT
# ifndef AUDIO_CLICKY_FREQ_MIN
# define AUDIO_CLICKY_FREQ_MIN 65.0f
-# endif // !AUDIO_CLICKY_FREQ_MIN
+# endif // !AUDIO_CLICKY_FREQ_MIN
# ifndef AUDIO_CLICKY_FREQ_MAX
# define AUDIO_CLICKY_FREQ_MAX 1500.0f
-# endif // !AUDIO_CLICKY_FREQ_MAX
+# endif // !AUDIO_CLICKY_FREQ_MAX
# ifndef AUDIO_CLICKY_FREQ_FACTOR
# define AUDIO_CLICKY_FREQ_FACTOR 1.18921f
-# endif // !AUDIO_CLICKY_FREQ_FACTOR
+# endif // !AUDIO_CLICKY_FREQ_FACTOR
# ifndef AUDIO_CLICKY_FREQ_RANDOMNESS
# define AUDIO_CLICKY_FREQ_RANDOMNESS 0.05f
-# endif // !AUDIO_CLICKY_FREQ_RANDOMNESS
+# endif // !AUDIO_CLICKY_FREQ_RANDOMNESS
float clicky_freq = AUDIO_CLICKY_FREQ_DEFAULT;
float clicky_rand = AUDIO_CLICKY_FREQ_RANDOMNESS;
// the first "note" is an intentional delay; the 2nd and 3rd notes are the "clicky"
-float clicky_song[][2] = {{AUDIO_CLICKY_FREQ_MIN, AUDIO_CLICKY_DELAY_DURATION}, {AUDIO_CLICKY_FREQ_DEFAULT, 3}, {AUDIO_CLICKY_FREQ_DEFAULT, 1}}; // 3 and 1 --> durations
+float clicky_song[][2] = {{AUDIO_CLICKY_FREQ_MIN, AUDIO_CLICKY_DELAY_DURATION}, {AUDIO_CLICKY_FREQ_DEFAULT, 3}, {AUDIO_CLICKY_FREQ_DEFAULT, 1}}; // 3 and 1 --> durations
extern audio_config_t audio_config;
# ifndef NO_MUSIC_MODE
extern bool music_activated;
extern bool midi_activated;
-# endif // !NO_MUSIC_MODE
+# endif // !NO_MUSIC_MODE
void clicky_play(void) {
# ifndef NO_MUSIC_MODE
if (music_activated || midi_activated || !audio_config.enable) return;
-# endif // !NO_MUSIC_MODE
+# endif // !NO_MUSIC_MODE
clicky_song[1][0] = 2.0f * clicky_freq * (1.0f + clicky_rand * (((float)rand()) / ((float)(RAND_MAX))));
clicky_song[2][0] = clicky_freq * (1.0f + clicky_rand * (((float)rand()) / ((float)(RAND_MAX))));
PLAY_SONG(clicky_song);
@@ -58,7 +58,9 @@ void clicky_freq_down(void) {
}
}
-void clicky_freq_reset(void) { clicky_freq = AUDIO_CLICKY_FREQ_DEFAULT; }
+void clicky_freq_reset(void) {
+ clicky_freq = AUDIO_CLICKY_FREQ_DEFAULT;
+}
void clicky_toggle(void) {
audio_config.clicky_enable ^= 1;
@@ -75,7 +77,9 @@ void clicky_off(void) {
eeconfig_update_audio(audio_config.raw);
}
-bool is_clicky_on(void) { return (audio_config.clicky_enable != 0); }
+bool is_clicky_on(void) {
+ return (audio_config.clicky_enable != 0);
+}
bool process_clicky(uint16_t keycode, keyrecord_t *record) {
if (keycode == CLICKY_TOGGLE && record->event.pressed) {
@@ -101,8 +105,8 @@ bool process_clicky(uint16_t keycode, keyrecord_t *record) {
}
if (audio_config.enable && audio_config.clicky_enable) {
- if (record->event.pressed) { // Leave this separate so it's easier to add upstroke sound
- if (keycode != AU_OFF && keycode != AU_TOG) { // DO NOT PLAY if audio will be disabled, and causes issuse on ARM
+ if (record->event.pressed) { // Leave this separate so it's easier to add upstroke sound
+ if (keycode != AU_OFF && keycode != AU_TOG) { // DO NOT PLAY if audio will be disabled, and causes issuse on ARM
clicky_play();
}
}
@@ -110,4 +114,4 @@ bool process_clicky(uint16_t keycode, keyrecord_t *record) {
return true;
}
-#endif // AUDIO_CLICKY
+#endif // AUDIO_CLICKY
diff --git a/quantum/process_keycode/process_combo.c b/quantum/process_keycode/process_combo.c
index 21fd737ab7..efaf8fe0e9 100644
--- a/quantum/process_keycode/process_combo.c
+++ b/quantum/process_keycode/process_combo.c
@@ -30,33 +30,45 @@ extern uint16_t COMBO_LEN;
__attribute__((weak)) void process_combo_event(uint16_t combo_index, bool pressed) {}
#ifdef COMBO_MUST_HOLD_PER_COMBO
-__attribute__((weak)) bool get_combo_must_hold(uint16_t index, combo_t *combo) { return false; }
+__attribute__((weak)) bool get_combo_must_hold(uint16_t index, combo_t *combo) {
+ return false;
+}
#endif
#ifdef COMBO_MUST_TAP_PER_COMBO
-__attribute__((weak)) bool get_combo_must_tap(uint16_t index, combo_t *combo) { return false; }
+__attribute__((weak)) bool get_combo_must_tap(uint16_t index, combo_t *combo) {
+ return false;
+}
#endif
#ifdef COMBO_TERM_PER_COMBO
-__attribute__((weak)) uint16_t get_combo_term(uint16_t index, combo_t *combo) { return COMBO_TERM; }
+__attribute__((weak)) uint16_t get_combo_term(uint16_t index, combo_t *combo) {
+ return COMBO_TERM;
+}
#endif
#ifdef COMBO_MUST_PRESS_IN_ORDER_PER_COMBO
-__attribute__((weak)) bool get_combo_must_press_in_order(uint16_t combo_index, combo_t *combo) { return true; }
+__attribute__((weak)) bool get_combo_must_press_in_order(uint16_t combo_index, combo_t *combo) {
+ return true;
+}
#endif
#ifdef COMBO_PROCESS_KEY_RELEASE
-__attribute__((weak)) bool process_combo_key_release(uint16_t combo_index, combo_t *combo, uint8_t key_index, uint16_t keycode) { return false; }
+__attribute__((weak)) bool process_combo_key_release(uint16_t combo_index, combo_t *combo, uint8_t key_index, uint16_t keycode) {
+ return false;
+}
#endif
#ifdef COMBO_SHOULD_TRIGGER
-__attribute__((weak)) bool combo_should_trigger(uint16_t combo_index, combo_t *combo, uint16_t keycode, keyrecord_t *record) { return true; }
+__attribute__((weak)) bool combo_should_trigger(uint16_t combo_index, combo_t *combo, uint16_t keycode, keyrecord_t *record) {
+ return true;
+}
#endif
#ifndef COMBO_NO_TIMER
static uint16_t timer = 0;
#endif
-static bool b_combo_enable = true; // defaults to enabled
+static bool b_combo_enable = true; // defaults to enabled
static uint16_t longest_term = 0;
typedef struct {
@@ -462,7 +474,7 @@ static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *
// get possible longer waiting time for tap-/hold-only combos.
longest_term = _get_wait_time(combo_index, combo);
}
- } // if timer elapsed end
+ } // if timer elapsed end
}
} else {
// chord releases
@@ -477,7 +489,7 @@ static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *
else if (get_combo_must_tap(combo_index, combo)) {
// immediately apply tap-only combo
apply_combo(combo_index, combo);
- apply_combos(); // also apply other prepared combos and dump key buffer
+ apply_combos(); // also apply other prepared combos and dump key buffer
# ifdef COMBO_PROCESS_KEY_RELEASE
if (process_combo_key_release(combo_index, combo, key_index, keycode)) {
release_combo(combo_index, combo);
@@ -559,7 +571,7 @@ bool process_combo(uint16_t keycode, keyrecord_t *record) {
key_buffer[key_buffer_size++] = (queued_record_t){
.record = *record,
.keycode = keycode,
- .combo_index = -1, // this will be set when applying combos
+ .combo_index = -1, // this will be set when applying combos
};
}
} else {
@@ -598,7 +610,9 @@ void combo_task(void) {
#endif
}
-void combo_enable(void) { b_combo_enable = true; }
+void combo_enable(void) {
+ b_combo_enable = true;
+}
void combo_disable(void) {
#ifndef COMBO_NO_TIMER
@@ -618,4 +632,6 @@ void combo_toggle(void) {
}
}
-bool is_combo_enabled(void) { return b_combo_enable; }
+bool is_combo_enabled(void) {
+ return b_combo_enable;
+}
diff --git a/quantum/process_keycode/process_dynamic_macro.c b/quantum/process_keycode/process_dynamic_macro.c
index 0feb634014..a1ada2d5a2 100644
--- a/quantum/process_keycode/process_dynamic_macro.c
+++ b/quantum/process_keycode/process_dynamic_macro.c
@@ -29,13 +29,21 @@ void dynamic_macro_led_blink(void) {
/* User hooks for Dynamic Macros */
-__attribute__((weak)) void dynamic_macro_record_start_user(void) { dynamic_macro_led_blink(); }
+__attribute__((weak)) void dynamic_macro_record_start_user(void) {
+ dynamic_macro_led_blink();
+}
-__attribute__((weak)) void dynamic_macro_play_user(int8_t direction) { dynamic_macro_led_blink(); }
+__attribute__((weak)) void dynamic_macro_play_user(int8_t direction) {
+ dynamic_macro_led_blink();
+}
-__attribute__((weak)) void dynamic_macro_record_key_user(int8_t direction, keyrecord_t *record) { dynamic_macro_led_blink(); }
+__attribute__((weak)) void dynamic_macro_record_key_user(int8_t direction, keyrecord_t *record) {
+ dynamic_macro_led_blink();
+}
-__attribute__((weak)) void dynamic_macro_record_end_user(int8_t direction) { dynamic_macro_led_blink(); }
+__attribute__((weak)) void dynamic_macro_record_end_user(int8_t direction) {
+ dynamic_macro_led_blink();
+}
/* Convenience macros used for retrieving the debug info. All of them
* need a `direction` variable accessible at the call site.
diff --git a/quantum/process_keycode/process_joystick.c b/quantum/process_keycode/process_joystick.c
index fa9c2c1dbc..2fb092c573 100644
--- a/quantum/process_keycode/process_joystick.c
+++ b/quantum/process_keycode/process_joystick.c
@@ -74,7 +74,9 @@ void restorePinState(pin_t pin, uint16_t restoreState) {
#endif
}
-__attribute__((weak)) bool process_joystick_analogread() { return process_joystick_analogread_quantum(); }
+__attribute__((weak)) bool process_joystick_analogread() {
+ return process_joystick_analogread_quantum();
+}
bool process_joystick_analogread_quantum() {
#if JOYSTICK_AXES_COUNT > 0
diff --git a/quantum/process_keycode/process_key_override.c b/quantum/process_keycode/process_key_override.c
index 09b2725079..ad9683d106 100644
--- a/quantum/process_keycode/process_key_override.c
+++ b/quantum/process_keycode/process_key_override.c
@@ -106,7 +106,9 @@ void key_override_toggle(void) {
}
}
-bool key_override_is_enabled(void) { return enabled; }
+bool key_override_is_enabled(void) {
+ return enabled;
+}
// Returns whether the modifiers that are pressed are such that the override should activate
static bool key_override_matches_active_modifiers(const key_override_t *override, const uint8_t mods) {
@@ -150,7 +152,7 @@ static void schedule_deferred_register(const uint16_t keycode) {
} else {
// Wait a very short time when a modifier event triggers the override to avoid false activations when e.g. a modifier is pressed just before a key is released (with the intention of pairing the modifier with a different key), or a modifier is lifted shortly before the trigger key is lifted. Operating systems by default reject modifier-events that happen very close to a non-modifier event.
defer_reference_time = timer_read32();
- defer_delay = 50; // 50ms
+ defer_delay = 50; // 50ms
}
deferred_register = keycode;
}
@@ -174,8 +176,8 @@ const key_override_t *clear_active_override(const bool allow_reregister) {
const uint8_t mod_free_replacement = clear_mods_from(active_override->replacement);
- bool unregister_replacement = mod_free_replacement != KC_NO && // KC_NO is never registered
- mod_free_replacement < SAFE_RANGE; // Custom keycodes are never registered
+ bool unregister_replacement = mod_free_replacement != KC_NO && // KC_NO is never registered
+ mod_free_replacement < SAFE_RANGE; // Custom keycodes are never registered
// Try firing the custom handler
if (active_override->custom_action != NULL) {
@@ -195,11 +197,11 @@ const key_override_t *clear_active_override(const bool allow_reregister) {
const uint16_t trigger = active_override->trigger;
- const bool reregister_trigger = allow_reregister && // Check if allowed from caller
- (active_override->options & ko_option_no_reregister_trigger) == 0 && // Check if override allows
- active_override_trigger_is_down && // Check if trigger is even down
- trigger != KC_NO && // KC_NO is never registered
- trigger < SAFE_RANGE; // A custom keycode should not be registered
+ const bool reregister_trigger = allow_reregister && // Check if allowed from caller
+ (active_override->options & ko_option_no_reregister_trigger) == 0 && // Check if override allows
+ active_override_trigger_is_down && // Check if trigger is even down
+ trigger != KC_NO && // KC_NO is never registered
+ trigger < SAFE_RANGE; // A custom keycode should not be registered
// Optionally re-register the trigger if it is still down
if (reregister_trigger) {
@@ -336,8 +338,8 @@ static bool try_activating_override(const uint16_t keycode, const uint8_t layer,
const uint16_t mod_free_replacement = clear_mods_from(override->replacement);
- bool register_replacement = mod_free_replacement != KC_NO && // KC_NO is never registered
- mod_free_replacement < SAFE_RANGE; // Custom keycodes are never registered
+ bool register_replacement = mod_free_replacement != KC_NO && // KC_NO is never registered
+ mod_free_replacement < SAFE_RANGE; // Custom keycodes are never registered
// Try firing the custom handler
if (override->custom_action != NULL) {
diff --git a/quantum/process_keycode/process_leader.c b/quantum/process_keycode/process_leader.c
index cf63f25141..c2fd02e5c7 100644
--- a/quantum/process_keycode/process_leader.c
+++ b/quantum/process_keycode/process_leader.c
@@ -51,13 +51,13 @@ bool process_leader(uint16_t keycode, keyrecord_t *record) {
if (leading) {
# ifndef LEADER_NO_TIMEOUT
if (timer_elapsed(leader_time) < LEADER_TIMEOUT)
-# endif // LEADER_NO_TIMEOUT
+# endif // LEADER_NO_TIMEOUT
{
# ifndef LEADER_KEY_STRICT_KEY_PROCESSING
if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) {
keycode = keycode & 0xFF;
}
-# endif // LEADER_KEY_STRICT_KEY_PROCESSING
+# endif // LEADER_KEY_STRICT_KEY_PROCESSING
if (leader_sequence_size < (sizeof(leader_sequence) / sizeof(leader_sequence[0]))) {
leader_sequence[leader_sequence_size] = keycode;
leader_sequence_size++;
diff --git a/quantum/process_keycode/process_magic.c b/quantum/process_keycode/process_magic.c
index 6332be647c..10161adda3 100644
--- a/quantum/process_keycode/process_magic.c
+++ b/quantum/process_keycode/process_magic.c
@@ -76,7 +76,7 @@ bool process_magic(uint16_t keycode, keyrecord_t *record) {
keymap_config.swap_backslash_backspace = true;
break;
case MAGIC_HOST_NKRO:
- clear_keyboard(); // clear first buffer to prevent stuck keys
+ clear_keyboard(); // clear first buffer to prevent stuck keys
keymap_config.nkro = true;
break;
case MAGIC_SWAP_ALT_GUI:
@@ -119,7 +119,7 @@ bool process_magic(uint16_t keycode, keyrecord_t *record) {
keymap_config.swap_backslash_backspace = false;
break;
case MAGIC_UNHOST_NKRO:
- clear_keyboard(); // clear first buffer to prevent stuck keys
+ clear_keyboard(); // clear first buffer to prevent stuck keys
keymap_config.nkro = false;
break;
case MAGIC_UNSWAP_ALT_GUI:
@@ -157,7 +157,7 @@ bool process_magic(uint16_t keycode, keyrecord_t *record) {
#endif
break;
case MAGIC_TOGGLE_NKRO:
- clear_keyboard(); // clear first buffer to prevent stuck keys
+ clear_keyboard(); // clear first buffer to prevent stuck keys
keymap_config.nkro = !keymap_config.nkro;
break;
case MAGIC_EE_HANDS_LEFT:
@@ -175,7 +175,7 @@ bool process_magic(uint16_t keycode, keyrecord_t *record) {
}
eeconfig_update_keymap(keymap_config.raw);
- clear_keyboard(); // clear to prevent stuck keys
+ clear_keyboard(); // clear to prevent stuck keys
return false;
}
diff --git a/quantum/process_keycode/process_midi.c b/quantum/process_keycode/process_midi.c
index 9632d2b757..c49c31a525 100644
--- a/quantum/process_keycode/process_midi.c
+++ b/quantum/process_keycode/process_midi.c
@@ -22,13 +22,19 @@
# ifdef MIDI_BASIC
-void process_midi_basic_noteon(uint8_t note) { midi_send_noteon(&midi_device, 0, note, 127); }
+void process_midi_basic_noteon(uint8_t note) {
+ midi_send_noteon(&midi_device, 0, note, 127);
+}
-void process_midi_basic_noteoff(uint8_t note) { midi_send_noteoff(&midi_device, 0, note, 0); }
+void process_midi_basic_noteoff(uint8_t note) {
+ midi_send_noteoff(&midi_device, 0, note, 0);
+}
-void process_midi_all_notes_off(void) { midi_send_cc(&midi_device, 0, 0x7B, 0); }
+void process_midi_all_notes_off(void) {
+ midi_send_cc(&midi_device, 0, 0x7B, 0);
+}
-# endif // MIDI_BASIC
+# endif // MIDI_BASIC
# ifdef MIDI_ADVANCED
@@ -41,7 +47,9 @@ static int8_t midi_modulation_step;
static uint16_t midi_modulation_timer;
midi_config_t midi_config;
-inline uint8_t compute_velocity(uint8_t setting) { return setting * (128 / (MIDI_VELOCITY_MAX - MIDI_VELOCITY_MIN)); }
+inline uint8_t compute_velocity(uint8_t setting) {
+ return setting * (128 / (MIDI_VELOCITY_MAX - MIDI_VELOCITY_MIN));
+}
void midi_init(void) {
midi_config.octave = MI_OCT_2 - MIDI_OCTAVE_MIN;
@@ -60,7 +68,9 @@ void midi_init(void) {
midi_modulation_timer = 0;
}
-uint8_t midi_compute_note(uint16_t keycode) { return 12 * midi_config.octave + (keycode - MIDI_TONE_MIN) + midi_config.transpose; }
+uint8_t midi_compute_note(uint16_t keycode) {
+ return 12 * midi_config.octave + (keycode - MIDI_TONE_MIN) + midi_config.transpose;
+}
bool process_midi(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
@@ -238,7 +248,7 @@ bool process_midi(uint16_t keycode, keyrecord_t *record) {
return true;
}
-# endif // MIDI_ADVANCED
+# endif // MIDI_ADVANCED
void midi_task(void) {
midi_device_process(&midi_device);
@@ -263,4 +273,4 @@ void midi_task(void) {
# endif
}
-#endif // MIDI_ENABLE
+#endif // MIDI_ENABLE
diff --git a/quantum/process_keycode/process_midi.h b/quantum/process_keycode/process_midi.h
index 68c6eda666..e528c6ec0c 100644
--- a/quantum/process_keycode/process_midi.h
+++ b/quantum/process_keycode/process_midi.h
@@ -49,6 +49,6 @@ bool process_midi(uint16_t keycode, keyrecord_t *record);
# define MIDI_TONE_COUNT (MIDI_TONE_MAX - MIDI_TONE_MIN + 1)
uint8_t midi_compute_note(uint16_t keycode);
-# endif // MIDI_ADVANCED
+# endif // MIDI_ADVANCED
-#endif // MIDI_ENABLE
+#endif // MIDI_ENABLE
diff --git a/quantum/process_keycode/process_music.c b/quantum/process_keycode/process_music.c
index 6822c5e289..eeec0c28a4 100644
--- a/quantum/process_keycode/process_music.c
+++ b/quantum/process_keycode/process_music.c
@@ -146,7 +146,7 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
if (music_activated || midi_activated) {
if (record->event.pressed) {
- if (keycode == KC_LEFT_CTRL) { // Start recording
+ if (keycode == KC_LEFT_CTRL) { // Start recording
music_all_notes_off();
music_sequence_recording = true;
music_sequence_recorded = false;
@@ -155,9 +155,9 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
return false;
}
- if (keycode == KC_LEFT_ALT) { // Stop recording/playing
+ if (keycode == KC_LEFT_ALT) { // Stop recording/playing
music_all_notes_off();
- if (music_sequence_recording) { // was recording
+ if (music_sequence_recording) { // was recording
music_sequence_recorded = true;
}
music_sequence_recording = false;
@@ -165,7 +165,7 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
return false;
}
- if (keycode == KC_LEFT_GUI && music_sequence_recorded) { // Start playing
+ if (keycode == KC_LEFT_GUI && music_sequence_recorded) { // Start playing
music_all_notes_off();
music_sequence_recording = false;
music_sequence_playing = true;
@@ -230,11 +230,17 @@ bool music_mask(uint16_t keycode) {
# endif
}
-__attribute__((weak)) bool music_mask_kb(uint16_t keycode) { return music_mask_user(keycode); }
+__attribute__((weak)) bool music_mask_kb(uint16_t keycode) {
+ return music_mask_user(keycode);
+}
-__attribute__((weak)) bool music_mask_user(uint16_t keycode) { return keycode < 0xFF; }
+__attribute__((weak)) bool music_mask_user(uint16_t keycode) {
+ return keycode < 0xFF;
+}
-bool is_music_on(void) { return (music_activated != 0); }
+bool is_music_on(void) {
+ return (music_activated != 0);
+}
void music_toggle(void) {
if (!music_activated) {
@@ -260,7 +266,9 @@ void music_off(void) {
# endif
}
-bool is_midi_on(void) { return (midi_activated != 0); }
+bool is_midi_on(void) {
+ return (midi_activated != 0);
+}
void midi_toggle(void) {
if (!midi_activated) {
@@ -315,4 +323,4 @@ __attribute__((weak)) void midi_on_user() {}
__attribute__((weak)) void music_scale_user() {}
-#endif // defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
+#endif // defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
diff --git a/quantum/process_keycode/process_music.h b/quantum/process_keycode/process_music.h
index e275cd9d26..83726a05ba 100644
--- a/quantum/process_keycode/process_music.h
+++ b/quantum/process_keycode/process_music.h
@@ -51,8 +51,10 @@ bool music_mask_kb(uint16_t keycode);
bool music_mask_user(uint16_t keycode);
# ifndef SCALE
-# define SCALE \
- (int8_t[]) { 0 + (12 * 0), 2 + (12 * 0), 4 + (12 * 0), 5 + (12 * 0), 7 + (12 * 0), 9 + (12 * 0), 11 + (12 * 0), 0 + (12 * 1), 2 + (12 * 1), 4 + (12 * 1), 5 + (12 * 1), 7 + (12 * 1), 9 + (12 * 1), 11 + (12 * 1), 0 + (12 * 2), 2 + (12 * 2), 4 + (12 * 2), 5 + (12 * 2), 7 + (12 * 2), 9 + (12 * 2), 11 + (12 * 2), 0 + (12 * 3), 2 + (12 * 3), 4 + (12 * 3), 5 + (12 * 3), 7 + (12 * 3), 9 + (12 * 3), 11 + (12 * 3), 0 + (12 * 4), 2 + (12 * 4), 4 + (12 * 4), 5 + (12 * 4), 7 + (12 * 4), 9 + (12 * 4), 11 + (12 * 4), }
+# define SCALE \
+ (int8_t[]) { \
+ 0 + (12 * 0), 2 + (12 * 0), 4 + (12 * 0), 5 + (12 * 0), 7 + (12 * 0), 9 + (12 * 0), 11 + (12 * 0), 0 + (12 * 1), 2 + (12 * 1), 4 + (12 * 1), 5 + (12 * 1), 7 + (12 * 1), 9 + (12 * 1), 11 + (12 * 1), 0 + (12 * 2), 2 + (12 * 2), 4 + (12 * 2), 5 + (12 * 2), 7 + (12 * 2), 9 + (12 * 2), 11 + (12 * 2), 0 + (12 * 3), 2 + (12 * 3), 4 + (12 * 3), 5 + (12 * 3), 7 + (12 * 3), 9 + (12 * 3), 11 + (12 * 3), 0 + (12 * 4), 2 + (12 * 4), 4 + (12 * 4), 5 + (12 * 4), 7 + (12 * 4), 9 + (12 * 4), 11 + (12 * 4), \
+ }
# endif
-#endif // defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
+#endif // defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
diff --git a/quantum/process_keycode/process_printer.c b/quantum/process_keycode/process_printer.c
index 0801f078ef..6dd1f28c9b 100644
--- a/quantum/process_keycode/process_printer.c
+++ b/quantum/process_keycode/process_printer.c
@@ -26,7 +26,9 @@ void enable_printing(void) {
uart_init(19200);
}
-void disable_printing(void) { printing_enabled = false; }
+void disable_printing(void) {
+ printing_enabled = false;
+}
uint8_t shifted_numbers[10] = {0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, 0x26, 0x2A, 0x28, 0x29};
@@ -41,7 +43,8 @@ void print_char(char c) {
}
void print_string(char c[]) {
- for (uint8_t i = 0; i < strlen(c); i++) print_char(c[i]);
+ for (uint8_t i = 0; i < strlen(c); i++)
+ print_char(c[i]);
}
void print_box_string(const char text[]) {
diff --git a/quantum/process_keycode/process_printer_bb.c b/quantum/process_keycode/process_printer_bb.c
index 6c91bd27ef..88a9f33994 100644
--- a/quantum/process_keycode/process_printer_bb.c
+++ b/quantum/process_keycode/process_printer_bb.c
@@ -25,13 +25,21 @@ uint8_t character_shift = 0;
#define SERIAL_PIN_MASK _BV(PD3)
#define SERIAL_DELAY 52
-inline static void serial_delay(void) { _delay_us(SERIAL_DELAY); }
+inline static void serial_delay(void) {
+ _delay_us(SERIAL_DELAY);
+}
-inline static void serial_high(void) { SERIAL_PIN_PORT |= SERIAL_PIN_MASK; }
+inline static void serial_high(void) {
+ SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
+}
-inline static void serial_low(void) { SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK; }
+inline static void serial_low(void) {
+ SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK;
+}
-inline static void serial_output(void) { SERIAL_PIN_DDR |= SERIAL_PIN_MASK; }
+inline static void serial_output(void) {
+ SERIAL_PIN_DDR |= SERIAL_PIN_MASK;
+}