diff options
Diffstat (limited to 'quantum')
160 files changed, 2471 insertions, 1437 deletions
diff --git a/quantum/action.c b/quantum/action.c index d932c01688..2bb1c34985 100644 --- a/quantum/action.c +++ b/quantum/action.c @@ -53,14 +53,20 @@ int retro_tapping_counter = 0; #endif #ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY -__attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) { return false; } +__attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) { + return false; +} #endif #ifdef RETRO_TAPPING_PER_KEY -__attribute__((weak)) bool get_retro_tapping(uint16_t keycode, keyrecord_t *record) { return false; } +__attribute__((weak)) bool get_retro_tapping(uint16_t keycode, keyrecord_t *record) { + return false; +} #endif -__attribute__((weak)) bool pre_process_record_quantum(keyrecord_t *record) { return true; } +__attribute__((weak)) bool pre_process_record_quantum(keyrecord_t *record) { + return true; +} /** \brief Called to execute an action. * @@ -163,10 +169,14 @@ void process_record_nocache(keyrecord_t *record) { disable_action_cache = false; } #else -void process_record_nocache(keyrecord_t *record) { process_record(record); } +void process_record_nocache(keyrecord_t *record) { + process_record(record); +} #endif -__attribute__((weak)) bool process_record_quantum(keyrecord_t *record) { return true; } +__attribute__((weak)) bool process_record_quantum(keyrecord_t *record) { + return true; +} __attribute__((weak)) void post_process_record_quantum(keyrecord_t *record) {} @@ -688,7 +698,7 @@ void process_action(keyrecord_t *record, action_t action) { /* tap key */ if (tap_count > 0) { if (swap_held) { - swap_hands = !swap_hands; // undo hold set up in _tap_hint + swap_hands = !swap_hands; // undo hold set up in _tap_hint swap_held = false; } if (event.pressed) { @@ -696,11 +706,11 @@ void process_action(keyrecord_t *record, action_t action) { } else { wait_ms(TAP_CODE_DELAY); unregister_code(action.swap.code); - *record = (keyrecord_t){}; // hack: reset tap mode + *record = (keyrecord_t){}; // hack: reset tap mode } } else { if (swap_held && !event.pressed) { - swap_hands = !swap_hands; // undo hold set up in _tap_hint + swap_hands = !swap_hands; // undo hold set up in _tap_hint swap_held = false; } } @@ -862,9 +872,13 @@ __attribute__((weak)) void register_code(uint8_t code) { } #ifdef EXTRAKEY_ENABLE else if - IS_SYSTEM(code) { host_system_send(KEYCODE2SYSTEM(code)); } + IS_SYSTEM(code) { + host_system_send(KEYCODE2SYSTEM(code)); + } else if - IS_CONSUMER(code) { host_consumer_send(KEYCODE2CONSUMER(code)); } + IS_CONSUMER(code) { + host_consumer_send(KEYCODE2CONSUMER(code)); + } #endif #ifdef MOUSEKEY_ENABLE else if @@ -927,9 +941,13 @@ __attribute__((weak)) void unregister_code(uint8_t code) { send_keyboard_report(); } else if - IS_SYSTEM(code) { host_system_send(0); } + IS_SYSTEM(code) { + host_system_send(0); + } else if - IS_CONSUMER(code) { host_consumer_send(0); } + IS_CONSUMER(code) { + host_consumer_send(0); + } #ifdef MOUSEKEY_ENABLE else if IS_MOUSEKEY(code) { @@ -956,7 +974,9 @@ __attribute__((weak)) void tap_code_delay(uint8_t code, uint16_t delay) { * * \param code The basic keycode to tap. If `code` is `KC_CAPS_LOCK`, the delay will be `TAP_HOLD_CAPS_DELAY`, otherwise `TAP_CODE_DELAY`, if defined. */ -__attribute__((weak)) void tap_code(uint8_t code) { tap_code_delay(code, code == KC_CAPS_LOCK ? TAP_HOLD_CAPS_DELAY : TAP_CODE_DELAY); } +__attribute__((weak)) void tap_code(uint8_t code) { + tap_code_delay(code, code == KC_CAPS_LOCK ? TAP_HOLD_CAPS_DELAY : TAP_CODE_DELAY); +} /** \brief Adds the given physically pressed modifiers and sends a keyboard report immediately. * @@ -1100,7 +1120,9 @@ bool is_tap_action(action_t action) { * * FIXME: Needs documentation. */ -void debug_event(keyevent_t event) { dprintf("%04X%c(%u)", (event.key.row << 8 | event.key.col), (event.pressed ? 'd' : 'u'), event.time); } +void debug_event(keyevent_t event) { + dprintf("%04X%c(%u)", (event.key.row << 8 | event.key.col), (event.pressed ? 'd' : 'u'), event.time); +} /** \brief Debug print (FIXME: Needs better description) * * FIXME: Needs documentation. diff --git a/quantum/action_layer.c b/quantum/action_layer.c index ed1a4bd20d..e20eedee40 100644 --- a/quantum/action_layer.c +++ b/quantum/action_layer.c @@ -18,13 +18,17 @@ layer_state_t default_layer_state = 0; * * Run user code on default layer state change */ -__attribute__((weak)) layer_state_t default_layer_state_set_user(layer_state_t state) { return state; } +__attribute__((weak)) layer_state_t default_layer_state_set_user(layer_state_t state) { + return state; +} /** \brief Default Layer State Set At Keyboard Level * * Run keyboard code on default layer state change */ -__attribute__((weak)) layer_state_t default_layer_state_set_kb(layer_state_t state) { return default_layer_state_set_user(state); } +__attribute__((weak)) layer_state_t default_layer_state_set_kb(layer_state_t state) { + return default_layer_state_set_user(state); +} /** \brief Default Layer State Set * @@ -39,9 +43,9 @@ static void default_layer_state_set(layer_state_t state) { default_layer_debug(); debug("\n"); #ifdef STRICT_LAYER_RELEASE - clear_keyboard_but_mods(); // To avoid stuck keys + clear_keyboard_but_mods(); // To avoid stuck keys #else - clear_keyboard_but_mods_and_keys(); // Don't reset held keys + clear_keyboard_but_mods_and_keys(); // Don't reset held keys #endif } @@ -49,30 +53,40 @@ static void default_layer_state_set(layer_state_t state) { * * Print out the hex value of the 32-bit default layer state, as well as the value of the highest bit. */ -void default_layer_debug(void) { dprintf("%08lX(%u)", default_layer_state, get_highest_layer(default_layer_state)); } +void default_layer_debug(void) { + dprintf("%08lX(%u)", default_layer_state, get_highest_layer(default_layer_state)); +} /** \brief Default Layer Set * * Sets the default layer state. */ -void default_layer_set(layer_state_t state) { default_layer_state_set(state); } +void default_layer_set(layer_state_t state) { + default_layer_state_set(state); +} #ifndef NO_ACTION_LAYER /** \brief Default Layer Or * * Turns on the default layer based on matching bits between specifed layer and existing layer state */ -void default_layer_or(layer_state_t state) { default_layer_state_set(default_layer_state | state); } +void default_layer_or(layer_state_t state) { + default_layer_state_set(default_layer_state | state); +} /** \brief Default Layer And * * Turns on default layer based on matching enabled bits between specifed layer and existing layer state */ -void default_layer_and(layer_state_t state) { default_layer_state_set(default_layer_state & state); } +void default_layer_and(layer_state_t state) { + default_layer_state_set(default_layer_state & state); +} /** \brief Default Layer Xor * * Turns on default layer based on non-matching bits between specifed layer and existing layer state */ -void default_layer_xor(layer_state_t state) { default_layer_state_set(default_layer_state ^ state); } +void default_layer_xor(layer_state_t state) { + default_layer_state_set(default_layer_state ^ state); +} #endif #ifndef NO_ACTION_LAYER @@ -84,13 +98,17 @@ layer_state_t layer_state = 0; * * Runs user code on layer state change */ -__attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) { return state; } +__attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) { + return state; +} /** \brief Layer state set keyboard * * Runs keyboard code on layer state change */ -__attribute__((weak)) layer_state_t layer_state_set_kb(layer_state_t state) { return layer_state_set_user(state); } +__attribute__((weak)) layer_state_t layer_state_set_kb(layer_state_t state) { + return layer_state_set_user(state); +} /** \brief Layer state set * @@ -105,9 +123,9 @@ void layer_state_set(layer_state_t state) { layer_debug(); dprintln(); # ifdef STRICT_LAYER_RELEASE - clear_keyboard_but_mods(); // To avoid stuck keys + clear_keyboard_but_mods(); // To avoid stuck keys # else - clear_keyboard_but_mods_and_keys(); // Don't reset held keys + clear_keyboard_but_mods_and_keys(); // Don't reset held keys # endif } @@ -115,13 +133,17 @@ void layer_state_set(layer_state_t state) { * * Turn off all layers */ -void layer_clear(void) { layer_state_set(0); } +void layer_clear(void) { + layer_state_set(0); +} /** \brief Layer state is * * Return whether the given state is on (it might still be shadowed by a higher state, though) */ -bool layer_state_is(uint8_t layer) { return layer_state_cmp(layer_state, layer); } +bool layer_state_is(uint8_t layer) { + return layer_state_cmp(layer_state, layer); +} /** \brief Layer state compare * @@ -138,47 +160,63 @@ bool layer_state_cmp(layer_state_t cmp_layer_state, uint8_t layer) { * * Turns on the given layer and turn off all other layers */ -void layer_move(uint8_t layer) { layer_state_set((layer_state_t)1 << layer); } +void layer_move(uint8_t layer) { + layer_state_set((layer_state_t)1 << layer); +} /** \brief Layer on * * Turns on given layer */ -void layer_on(uint8_t layer) { layer_state_set(layer_state | ((layer_state_t)1 << layer)); } +void layer_on(uint8_t layer) { + layer_state_set(layer_state | ((layer_state_t)1 << layer)); +} /** \brief Layer off * * Turns off given layer */ -void layer_off(uint8_t layer) { layer_state_set(layer_state & ~((layer_state_t)1 << layer)); } +void layer_off(uint8_t layer) { + layer_state_set(layer_state & ~((layer_state_t)1 << layer)); +} /** \brief Layer invert * * Toggle the given layer (set it if it's unset, or unset it if it's set) */ -void layer_invert(uint8_t layer) { layer_state_set(layer_state ^ ((layer_state_t)1 << layer)); } +void layer_invert(uint8_t layer) { + layer_state_set(layer_state ^ ((layer_state_t)1 << layer)); +} /** \brief Layer or * * Turns on layers based on matching bits between specifed layer and existing layer state */ -void layer_or(layer_state_t state) { layer_state_set(layer_state | state); } +void layer_or(layer_state_t state) { + layer_state_set(layer_state | state); +} /** \brief Layer and * * Turns on layers based on matching enabled bits between specifed layer and existing layer state */ -void layer_and(layer_state_t state) { layer_state_set(layer_state & state); } +void layer_and(layer_state_t state) { + layer_state_set(layer_state & state); +} /** \brief Layer xor * * Turns on layers based on non-matching bits between specifed layer and existing layer state */ -void layer_xor(layer_state_t state) { layer_state_set(layer_state ^ state); } +void layer_xor(layer_state_t state) { + layer_state_set(layer_state ^ state); +} /** \brief Layer debug printing * * Print out the hex value of the 32-bit layer state, as well as the value of the highest bit. */ -void layer_debug(void) { dprintf("%08lX(%u)", layer_state, get_highest_layer(layer_state)); } +void layer_debug(void) { + dprintf("%08lX(%u)", layer_state, get_highest_layer(layer_state)); +} #endif #if !defined(NO_ACTION_LAYER) && !defined(STRICT_LAYER_RELEASE) @@ -276,4 +314,6 @@ uint8_t layer_switch_get_layer(keypos_t key) { * * Gets action code based on key position */ -action_t layer_switch_get_action(keypos_t key) { return action_for_key(layer_switch_get_layer(key), key); } +action_t layer_switch_get_action(keypos_t key) { + return action_for_key(layer_switch_get_layer(key), key); +} diff --git a/quantum/action_tapping.c b/quantum/action_tapping.c index 4ba38bee8d..6f8b4f8c56 100644 --- a/quantum/action_tapping.c +++ b/quantum/action_tapping.c @@ -26,7 +26,9 @@ uint16_t g_tapping_term = TAPPING_TERM; -__attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { return g_tapping_term; } +__attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + return g_tapping_term; +} # ifdef TAPPING_TERM_PER_KEY # define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < get_tapping_term(get_record_keycode(&tapping_key, false), &tapping_key)) @@ -35,15 +37,21 @@ __attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *r # endif # ifdef TAPPING_FORCE_HOLD_PER_KEY -__attribute__((weak)) bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { return false; } +__attribute__((weak)) bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { + return false; +} # endif # ifdef PERMISSIVE_HOLD_PER_KEY -__attribute__((weak)) bool get_permissive_hold(uint16_t keycode, keyrecord_t *record) { return false; } +__attribute__((weak)) bool get_permissive_hold(uint16_t keycode, keyrecord_t *record) { + return false; +} # endif # ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY -__attribute__((weak)) bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) { return false; } +__attribute__((weak)) bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) { + return false; +} # endif # if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT) diff --git a/quantum/action_util.c b/quantum/action_util.c index 9eb2a6d30d..64a1b6b30d 100644 --- a/quantum/action_util.c +++ b/quantum/action_util.c @@ -43,8 +43,10 @@ extern inline void clear_keys(void); #ifndef NO_ACTION_ONESHOT static uint8_t oneshot_mods = 0; static uint8_t oneshot_locked_mods = 0; -uint8_t get_oneshot_locked_mods(void) { return oneshot_locked_mods; } -void set_oneshot_locked_mods(uint8_t mods) { +uint8_t get_oneshot_locked_mods(void) { + return oneshot_locked_mods; +} +void set_oneshot_locked_mods(uint8_t mods) { if (mods != oneshot_locked_mods) { oneshot_locked_mods = mods; oneshot_locked_mods_changed_kb(oneshot_locked_mods); @@ -58,9 +60,13 @@ void clear_oneshot_locked_mods(void) { } # if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) static uint16_t oneshot_time = 0; -bool has_oneshot_mods_timed_out(void) { return TIMER_DIFF_16(timer_read(), oneshot_time) >= ONESHOT_TIMEOUT; } +bool has_oneshot_mods_timed_out(void) { + return TIMER_DIFF_16(timer_read(), oneshot_time) >= ONESHOT_TIMEOUT; +} # else -bool has_oneshot_mods_timed_out(void) { return false; } +bool has_oneshot_mods_timed_out(void) { + return false; +} # endif #endif @@ -74,24 +80,32 @@ bool has_oneshot_mods_timed_out(void) { return false; } */ static int8_t oneshot_layer_data = 0; -inline uint8_t get_oneshot_layer(void) { return oneshot_layer_data >> 3; } -inline uint8_t get_oneshot_layer_state(void) { return oneshot_layer_data & 0b111; } +inline uint8_t get_oneshot_layer(void) { + return oneshot_layer_data >> 3; +} +inline uint8_t get_oneshot_layer_state(void) { + return oneshot_layer_data & 0b111; +} # ifdef SWAP_HANDS_ENABLE enum { SHO_OFF, - SHO_ACTIVE, // Swap hands button was pressed, and we didn't send any swapped keys yet - SHO_PRESSED, // Swap hands button is currently pressed - SHO_USED, // Swap hands button is still pressed, and we already sent swapped keys + SHO_ACTIVE, // Swap hands button was pressed, and we didn't send any swapped keys yet + SHO_PRESSED, // Swap hands button is currently pressed + SHO_USED, // Swap hands button is still pressed, and we already sent swapped keys } swap_hands_oneshot = SHO_OFF; # endif # if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) static uint16_t oneshot_layer_time = 0; -inline bool has_oneshot_layer_timed_out() { return TIMER_DIFF_16(timer_read(), oneshot_layer_time) >= ONESHOT_TIMEOUT && !(get_oneshot_layer_state() & ONESHOT_TOGGLED); } +inline bool has_oneshot_layer_timed_out() { + return TIMER_DIFF_16(timer_read(), oneshot_layer_time) >= ONESHOT_TIMEOUT && !(get_oneshot_layer_state() & ONESHOT_TOGGLED); +} # ifdef SWAP_HANDS_ENABLE static uint16_t oneshot_swaphands_time = 0; -inline bool has_oneshot_swaphands_timed_out() { return TIMER_DIFF_16(timer_read(), oneshot_swaphands_time) >= ONESHOT_TIMEOUT && (swap_hands_oneshot == SHO_ACTIVE); } +inline bool has_oneshot_swaphands_timed_out() { + return TIMER_DIFF_16(timer_read(), oneshot_swaphands_time) >= ONESHOT_TIMEOUT && (swap_hands_oneshot == SHO_ACTIVE); +} # endif # endif @@ -179,7 +193,9 @@ void clear_oneshot_layer_state(oneshot_fullfillment_t state) { * * FIXME: needs doc */ -bool is_oneshot_layer_active(void) { return get_oneshot_layer_state(); } +bool is_oneshot_layer_active(void) { + return get_oneshot_layer_state(); +} /** \brief set oneshot * @@ -198,21 +214,29 @@ void oneshot_set(bool active) { * * FIXME: needs doc */ -void oneshot_toggle(void) { oneshot_set(!keymap_config.oneshot_disable); } +void oneshot_toggle(void) { + oneshot_set(!keymap_config.oneshot_disable); +} /** \brief enable oneshot * * FIXME: needs doc */ -void oneshot_enable(void) { oneshot_set(true); } +void oneshot_enable(void) { + oneshot_set(true); +} /** \brief disable oneshot * * FIXME: needs doc */ -void oneshot_disable(void) { oneshot_set(false); } +void oneshot_disable(void) { + oneshot_set(false); +} -bool is_oneshot_enabled(void) { return keymap_config.oneshot_disable; } +bool is_oneshot_enabled(void) { + return keymap_config.oneshot_disable; +} #endif @@ -259,68 +283,96 @@ void send_keyboard_report(void) { * * FIXME: needs doc */ -uint8_t get_mods(void) { return real_mods; } +uint8_t get_mods(void) { + return real_mods; +} /** \brief add mods * * FIXME: needs doc */ -void add_mods(uint8_t mods) { real_mods |= mods; } +void add_mods(uint8_t mods) { + real_mods |= mods; +} /** \brief del mods * * FIXME: needs doc */ -void del_mods(uint8_t mods) { real_mods &= ~mods; } +void del_mods(uint8_t mods) { + real_mods &= ~mods; +} /** \brief set mods * * FIXME: needs doc */ -void set_mods(uint8_t mods) { real_mods = mods; } +void set_mods(uint8_t mods) { + real_mods = mods; +} /** \brief clear mods * * FIXME: needs doc */ -void clear_mods(void) { real_mods = 0; } +void clear_mods(void) { + real_mods = 0; +} /** \brief get weak mods * * FIXME: needs doc */ -uint8_t get_weak_mods(void) { return weak_mods; } +uint8_t get_weak_mods(void) { + return weak_mods; +} /** \brief add weak mods * * FIXME: needs doc */ -void add_weak_mods(uint8_t mods) { weak_mods |= mods; } +void add_weak_mods(uint8_t mods) { + weak_mods |= mods; +} /** \brief del weak mods * * FIXME: needs doc */ -void del_weak_mods(uint8_t mods) { weak_mods &= ~mods; } +void del_weak_mods(uint8_t mods) { + weak_mods &= ~mods; +} /** \brief set weak mods * * FIXME: needs doc */ -void set_weak_mods(uint8_t mods) { weak_mods = mods; } +void set_weak_mods(uint8_t mods) { + weak_mods = mods; +} /** \brief clear weak mods * * FIXME: needs doc */ -void clear_weak_mods(void) { weak_mods = 0; } +void clear_weak_mods(void) { + weak_mods = 0; +} #ifdef KEY_OVERRIDE_ENABLE /** \brief set weak mods used by key overrides. DO not call this manually */ -void set_weak_override_mods(uint8_t mods) { weak_override_mods = mods; } +void set_weak_override_mods(uint8_t mods) { + weak_override_mods = mods; +} /** \brief clear weak mods used by key overrides. DO not call this manually */ -void clear_weak_override_mods(void) { weak_override_mods = 0; } +void clear_weak_override_mods(void) { + weak_override_mods = 0; +} /** \brief set suppressed mods used by key overrides. DO not call this manually */ -void set_suppressed_override_mods(uint8_t mods) { suppressed_mods = mods; } +void set_suppressed_override_mods(uint8_t mods) { + suppressed_mods = mods; +} /** \brief clear suppressed mods used by key overrides. DO not call this manually */ -void clear_suppressed_override_mods(void) { suppressed_mods = 0; } +void clear_suppressed_override_mods(void) { + suppressed_mods = 0; +} #endif #ifndef NO_ACTION_ONESHOT @@ -328,7 +380,9 @@ void clear_suppressed_override_mods(void) { suppressed_mods = 0; } * * FIXME: needs doc */ -uint8_t get_oneshot_mods(void) { return oneshot_mods; } +uint8_t get_oneshot_mods(void) { + return oneshot_mods; +} void add_oneshot_mods(uint8_t mods) { if ((oneshot_mods & mods) != mods) { @@ -391,7 +445,9 @@ __attribute__((weak)) void oneshot_locked_mods_changed_user(uint8_t mods) {} * * \param mods Contains the active modifiers active after the change. */ -__attribute__((weak)) void oneshot_locked_mods_changed_kb(uint8_t mods) { oneshot_locked_mods_changed_user(mods); } +__attribute__((weak)) void oneshot_locked_mods_changed_kb(uint8_t mods) { + oneshot_locked_mods_changed_user(mods); +} /** \brief Called when the one shot modifiers have been changed. * @@ -403,7 +459,9 @@ __attribute__((weak)) void oneshot_mods_changed_user(uint8_t mods) {} * * \param mods Contains the active modifiers active after the change. */ -__attribute__((weak)) void oneshot_mods_changed_kb(uint8_t mods) { oneshot_mods_changed_user(mods); } +__attribute__((weak)) void oneshot_mods_changed_kb(uint8_t mods) { + oneshot_mods_changed_user(mods); +} /** \brief Called when the one shot layers have been changed. * @@ -415,10 +473,14 @@ __attribute__((weak)) void oneshot_layer_changed_user(uint8_t layer) {} * * \param layer Contains the layer that is toggled on, or zero when toggled off. */ -__attribute__((weak)) void oneshot_layer_changed_kb(uint8_t layer) { oneshot_layer_changed_user(layer); } +__attribute__((weak)) void oneshot_layer_changed_kb(uint8_t layer) { + oneshot_layer_changed_user(layer); +} /** \brief inspect keyboard state * * FIXME: needs doc */ -uint8_t has_anymod(void) { return bitpop(real_mods); } +uint8_t has_anymod(void) { + return bitpop(real_mods); +} diff --git a/quantum/action_util.h b/quantum/action_util.h index bfd0a6cf95..6f1f09c4bd 100644 --- a/quantum/action_util.h +++ b/quantum/action_util.h @@ -29,11 +29,17 @@ extern report_keyboard_t *keyboard_report; void send_keyboard_report(void); /* key */ -inline void add_key(uint8_t key) { add_key_to_report(keyboard_report, key); } +inline void add_key(uint8_t key) { + add_key_to_report(keyboard_report, key); +} -inline void del_key(uint8_t key) { del_key_from_report(keyboard_report, key); } +inline void del_key(uint8_t key) { + del_key_from_report(keyboard_report, key); +} -inline void clear_keys(void) { clear_keys_from_report(keyboard_report); } +inline void clear_keys(void) { + clear_keys_from_report(keyboard_report); +} /* modifier */ uint8_t get_mods(void); diff --git a/quantum/audio/audio.c b/quantum/audio/audio.c index b3d6389dd5..c6523b908c 100644 --- a/quantum/audio/audio.c +++ b/quantum/audio/audio.c @@ -64,21 +64,21 @@ #ifndef AUDIO_TONE_STACKSIZE # define AUDIO_TONE_STACKSIZE 8 #endif -uint8_t active_tones = 0; // number of tones pushed onto the stack by audio_play_tone - might be more than the hardware is able to reproduce at any single time -musical_tone_t tones[AUDIO_TONE_STACKSIZE]; // stack of currently active tones +uint8_t active_tones = 0; // number of tones pushed onto the stack by audio_play_tone - might be more than the hardware is able to reproduce at any single time +musical_tone_t tones[AUDIO_TONE_STACKSIZE]; // stack of currently active tones -bool playing_melody = false; // playing a SONG? -bool playing_note = false; // or (possibly multiple simultaneous) tones -bool state_changed = false; // global flag, which is set if anything changes with the active_tones +bool playing_melody = false; // playing a SONG? +bool playing_note = false; // or (possibly multiple simultaneous) tones +bool state_changed = false; // global flag, which is set if anything changes with the active_tones // melody/SONG related state variables -float (*notes_pointer)[][2]; // SONG, an array of MUSICAL_NOTEs -uint16_t notes_count; // length of the notes_pointer array -bool notes_repeat; // PLAY_SONG or PLAY_LOOP? -uint16_t melody_current_note_duration = 0; // duration of the currently playing note from the active melody, in ms -uint8_t note_tempo = TEMPO_DEFAULT; // beats-per-minute -uint16_t current_note = 0; // index into the array at notes_pointer -bool note_resting = false; // if a short pause was introduced between two notes with the same frequency while playing a melody +float (*notes_pointer)[][2]; // SONG, an array of MUSICAL_NOTEs +uint16_t notes_count; // length of the notes_pointer array +bool notes_repeat; // PLAY_SONG or PLAY_LOOP? +uint16_t melody_current_note_duration = 0; // duration of the currently playing note from the active melody, in ms +uint8_t note_tempo = TEMPO_DEFAULT; // beats-per-minute +uint16_t current_note = 0; // index into the array at notes_pointer +bool note_resting = false; // if a short pause was introduced between two notes with the same frequency while playing a melody uint16_t last_timestamp = 0; #ifdef AUDIO_ENABLE_TONE_MULTIPLEXING @@ -86,7 +86,7 @@ uint16_t last_timestamp = 0; # define AUDIO_MAX_SIMULTANEOUS_TONES 3 # endif uint16_t tone_multiplexing_rate = AUDIO_TONE_MULTIPLEXING_RATE_DEFAULT; -uint8_t tone_multiplexing_index_shift = 0; // offset used on active-tone array access +uint8_t tone_multiplexing_index_shift = 0; // offset used on active-tone array access #endif // provided and used by voices.c @@ -123,12 +123,12 @@ void audio_init() { eeconfig_init(); } audio_config.raw = eeconfig_read_audio(); -#else // EEPROM settings +#else // EEPROM settings audio_config.enable = true; # ifdef AUDIO_CLICKY_ON audio_config.clicky_enable = true; # endif -#endif // EEPROM settings +#endif // EEPROM settings for (uint8_t i = 0; i < AUDIO_TONE_STACKSIZE; i++) { tones[i] = (musical_tone_t){.time_started = 0, .pitch = -1.0f, .duration = 0}; @@ -181,7 +181,9 @@ void audio_off(void) { eeconfig_update_audio(audio_config.raw); } -bool audio_is_on(void) { return (audio_config.enable != 0); } +bool audio_is_on(void) { + return (audio_config.enable != 0); +} void audio_stop_all() { if (audio_driver_stopped) { @@ -268,7 +270,7 @@ void audio_play_note(float pitch, uint16_t duration) { tones[j] = tones[j + 1]; tones[j + 1] = (musical_tone_t){.time_started = timer_read(), .pitch = pitch, .duration = duration}; } - return; // since this frequency played already, the hardware was already started + return; // since this frequency played already, the hardware was already started } } @@ -286,7 +288,7 @@ void audio_play_note(float pitch, uint16_t duration) { tones[active_tones - 1] = (musical_tone_t){.time_started = timer_read(), .pitch = pitch, .duration = duration}; // TODO: needs to be handled per note/tone -> use its timestamp instead? - voices_timer = timer_read(); // reset to zero, for the effects added by voices.c + voices_timer = timer_read(); // reset to zero, for the effects added by voices.c if (audio_driver_stopped) { audio_driver_start(); @@ -294,7 +296,9 @@ void audio_play_note(float pitch, uint16_t duration) { } } -void audio_play_tone(float pitch) { audio_play_note(pitch, 0xffff); } +void audio_play_tone(float pitch) { + audio_play_note(pitch, 0xffff); +} void audio_play_melody(float (*np)[][2], uint16_t n_count, bool n_repeat) { if (!audio_config.enable) { @@ -316,7 +320,7 @@ void audio_play_melody(float (*np)[][2], uint16_t n_count, bool n_repeat) { notes_count = n_count; notes_repeat = n_repeat; - current_note = 0; // note in the melody-array/list at note_pointer + current_note = 0; // note in the melody-array/list at note_pointer // start first note manually, which also starts the audio_driver // all following/remaining notes are played by 'audio_update_state' @@ -347,11 +351,17 @@ void audio_play_click(uint16_t delay, float pitch, uint16_t duration) { } } -bool audio_is_playing_note(void) { return playing_note; } +bool audio_is_playing_note(void) { + return playing_note; +} -bool audio_is_playing_melody(void) { return playing_melody; } +bool audio_is_playing_melody(void) { + return playing_melody; +} -uint8_t audio_get_number_of_active_tones(void) { return active_tones; } +uint8_t audio_get_number_of_active_tones(void) { + return active_tones; +} float audio_get_frequency(uint8_t tone_index) { if (tone_index >= active_tones) { @@ -370,7 +380,7 @@ float audio_get_processed_frequency(uint8_t tone_index) { #ifdef AUDIO_ENABLE_TONE_MULTIPLEXING index = index - tone_multiplexing_index_shift; - if (index < 0) // wrap around + if (index < 0) // wrap around index += active_tones; #endif @@ -396,7 +406,7 @@ bool audio_update_state(void) { last_timestamp = current_time; uint16_t previous_note = current_note; current_note++; - voices_timer = timer_read(); // reset to zero, for the effects added by voices.c + voices_timer = timer_read(); // reset to zero, for the effects added by voices.c if (current_note >= notes_count) { if (notes_repeat) { @@ -466,11 +476,11 @@ bool audio_update_state(void) { // housekeeping: stop notes that have no playtime left for (int i = 0; i < active_tones; i++) { - if ((tones[i].duration != 0xffff) // indefinitely playing notes, started by 'audio_play_tone' - && (tones[i].duration != 0) // 'uninitialized' + if ((tones[i].duration != 0xffff) // indefinitely playing notes, started by 'audio_play_tone' + && (tones[i].duration != 0) // 'uninitialized' ) { if (timer_elapsed(tones[i].time_started) >= tones[i].duration) { - audio_stop_tone(tones[i].pitch); // also sets 'state_changed=true' + audio_stop_tone(tones[i].pitch); // also sets 'state_changed=true' } } } @@ -487,9 +497,15 @@ bool audio_update_state(void) { // Tone-multiplexing functions #ifdef AUDIO_ENABLE_TONE_MULTIPLEXING -void audio_set_tone_multiplexing_rate(uint16_t rate) { tone_multiplexing_rate = rate; } -void audio_enable_tone_multiplexing(void) { tone_multiplexing_rate = AUDIO_TONE_MULTIPLEXING_RATE_DEFAULT; } -void audio_disable_tone_multiplexing(void) { tone_multiplexing_rate = 0; } +void audio_set_tone_multiplexing_rate(uint16_t rate) { + tone_multiplexing_rate = rate; +} +void audio_enable_tone_multiplexing(void) { + tone_multiplexing_rate = AUDIO_TONE_MULTIPLEXING_RATE_DEFAULT; +} +void audio_disable_tone_multiplexing(void) { + tone_multiplexing_rate = 0; +} void audio_increase_tone_multiplexing_rate(uint16_t change) { if ((0xffff - change) > tone_multiplexing_rate) { tone_multiplexing_rate += change; diff --git a/quantum/audio/audio.h b/quantum/audio/audio.h index 290d461f5a..fe23cf3ed1 100644 --- a/quantum/audio/audio.h +++ b/quantum/audio/audio.h @@ -54,9 +54,9 @@ typedef union { * "A musical tone is characterized by its duration, pitch, intensity (or loudness), and timbre (or quality)" */ typedef struct { - uint16_t time_started; // timestamp the tone/note was started, system time runs with 1ms resolution -> 16bit timer overflows every ~64 seconds, long enough under normal circumstances; but might be too soon for long-duration notes when the note_tempo is set to a very low value - float pitch; // aka frequency, in Hz - uint16_t duration; // in ms, converted from the musical_notes.h unit which has 64parts to a beat, factoring in the current tempo in beats-per-minute + uint16_t time_started; // timestamp the tone/note was started, system time runs with 1ms resolution -> 16bit timer overflows every ~64 seconds, long enough under normal circumstances; but might be too soon for long-duration notes when the note_tempo is set to a very low value + float pitch; // aka frequency, in Hz + uint16_t duration; // in ms, converted from the musical_notes.h unit which has 64parts to a beat, factoring in the current tempo in beats-per-minute // float intensity; // aka volume [0,1] TODO: not used at the moment; pwm drivers can't handle it // uint8_t timbre; // range: [0,100] TODO: this currently kept track of globally, should we do this per tone instead? } musical_tone_t; diff --git a/quantum/audio/song_list.h b/quantum/audio/song_list.h index 8e80a016aa..3e425abb47 100644 --- a/quantum/audio/song_list.h +++ b/quantum/audio/song_list.h @@ -22,7 +22,7 @@ #if __has_include("user_song_list.h") # include "user_song_list.h" -#endif // if file exists +#endif // if file exists #define NO_SOUND diff --git a/quantum/audio/voices.c b/quantum/audio/voices.c index 8988d827e9..1c08a3af36 100644 --- a/quantum/audio/voices.c +++ b/quantum/audio/voices.c @@ -32,11 +32,17 @@ voice_type voice = AUDIO_VOICE_DEFAULT; voice_type voice = default_voice; #endif -void set_voice(voice_type v) { voice = v; } +void set_voice(voice_type v) { + voice = v; +} -void voice_iterate() { voice = (voice + 1) % number_of_voices; } +void voice_iterate() { + voice = (voice + 1) % number_of_voices; +} -void voice_deiterate() { voice = (voice - 1 + number_of_voices) % number_of_voices; } +void voice_deiterate() { + voice = (voice - 1 + number_of_voices) % number_of_voices; +} #ifdef AUDIO_VOICES float mod(float a, int b) { @@ -67,8 +73,8 @@ float voice_envelope(float frequency) { // envelope_index ranges from 0 to 0xFFFF, which is preserved at 880.0 Hz // __attribute__((unused)) uint16_t compensated_index = (uint16_t)((float)envelope_index * (880.0 / frequency)); #ifdef AUDIO_VOICES - uint16_t envelope_index = timer_elapsed(voices_timer); // TODO: multiply in some factor? - uint16_t compensated_index = envelope_index / 100; // TODO: correct factor would be? + uint16_t envelope_index = timer_elapsed(voices_timer); // TODO: multiply in some factor? + uint16_t compensated_index = envelope_index / 100; // TODO: correct factor would be? #endif switch (voice) { @@ -303,7 +309,7 @@ float voice_envelope(float frequency) { // note_timbre = TIMBRE_25; // break; -#endif // AUDIO_VOICES +#endif // AUDIO_VOICES default: break; @@ -318,19 +324,31 @@ float voice_envelope(float frequency) { // TODO: where to keep track of the start-frequency? // frequency = voice_add_glissando(??, frequency); } -#endif // AUDIO_VOICES +#endif // AUDIO_VOICES return frequency; } // Vibrato functions -void voice_set_vibrato_rate(float rate) { vibrato_rate = rate; } -void voice_increase_vibrato_rate(float change) { vibrato_rate *= change; } -void voice_decrease_vibrato_rate(float change) { vibrato_rate /= change; } -void voice_set_vibrato_strength(float strength) { vibrato_strength = strength; } -void voice_increase_vibrato_strength(float change) { vibrato_strength *= change; } -void voice_decrease_vibrato_strength(float change) { vibrato_strength /= change; } +void voice_set_vibrato_rate(float rate) { + vibrato_rate = rate; +} +void voice_increase_vibrato_rate(float change) { + vibrato_rate *= change; +} +void voice_decrease_vibrato_rate(float change) { + vibrato_rate /= change; +} +void voice_set_vibrato_strength(float strength) { + vibrato_strength = strength; +} +void voice_increase_vibrato_strength(float change) { + vibrato_strength *= change; +} +void voice_decrease_vibrato_strength(float change) { + vibrato_strength /= change; +} // Timbre functions @@ -339,4 +357,6 @@ void voice_set_timbre(uint8_t timbre) { note_timbre = timbre; } } -uint8_t voice_get_timbre(void) { return note_timbre; } +uint8_t voice_get_timbre(void) { + return note_timbre; +} diff --git a/quantum/audio/voices.h b/quantum/audio/voices.h index 1f402e7e12..fcab9db556 100644 --- a/quantum/audio/voices.h +++ b/quantum/audio/voices.h @@ -40,7 +40,7 @@ typedef enum { // duty_third_down, // duty_fifth_third_down, #endif - number_of_voices // important that this is last + number_of_voices // important that this is last } voice_type; void set_voice(voice_type v); diff --git a/quantum/backlight/backlight.c b/quantum/backlight/backlight.c index dfb98419e6..52ec086bb0 100644 --- a/quantum/backlight/backlight.c +++ b/quantum/backlight/backlight.c @@ -95,10 +95,10 @@ void backlight_toggle(void) { * FIXME: needs doc */ void backlight_enable(void) { - if (backlight_config.enable) return; // do nothing if backlight is already on + if (backlight_config.enable) return; // do nothing if backlight is already on backlight_config.enable = true; - if (backlight_config.raw == 1) // enabled but level == 0 + if (backlight_config.raw == 1) // enabled but level == 0 backlight_config.level = 1; eeconfig_update_backlight(backlight_config.raw); dprintf("backlight enable\n"); @@ -110,7 +110,7 @@ void backlight_enable(void) { * FIXME: needs doc */ void backlight_disable(void) { - if (!backlight_config.enable) return; // do nothing if backlight is already off + if (!backlight_config.enable) return; // do nothing if backlight is already off backlight_config.enable = false; eeconfig_update_backlight(backlight_config.raw); @@ -122,7 +122,9 @@ void backlight_disable(void) { * * FIXME: needs doc */ -bool is_backlight_enabled(void) { return backlight_config.enable; } +bool is_backlight_enabled(void) { + return backlight_config.enable; +} /** \brief Backlight step through levels * @@ -158,11 +160,17 @@ void backlight_level(uint8_t level) { eeconfig_update_backlight(backlight_config.raw); } -uint8_t eeconfig_read_backlight(void) { return eeprom_read_byte(EECONFIG_BACKLIGHT); } +uint8_t eeconfig_read_backlight(void) { + return eeprom_read_byte(EECONFIG_BACKLIGHT); +} -void eeconfig_update_backlight(uint8_t val) { eeprom_update_byte(EECONFIG_BACKLIGHT, val); } +void eeconfig_update_backlight(uint8_t val) { + eeprom_update_byte(EECONFIG_BACKLIGHT, val); +} -void eeconfig_update_backlight_current(void) { eeconfig_update_backlight(backlight_config.raw); } +void eeconfig_update_backlight_current(void) { + eeconfig_update_backlight(backlight_config.raw); +} void eeconfig_update_backlight_default(void) { backlight_config.enable = 1; @@ -179,7 +187,9 @@ void eeconfig_update_backlight_default(void) { * * FIXME: needs doc */ -uint8_t get_backlight_level(void) { return backlight_config.level; } +uint8_t get_backlight_level(void) { + return backlight_config.level; +} #ifdef BACKLIGHT_BREATHING /** \brief Backlight breathing toggle @@ -200,7 +210,7 @@ void backlight_toggle_breathing(void) { * FIXME: needs doc */ void backlight_enable_breathing(void) { - if (backlight_config.breathing) return; // do nothing if breathing is already on + if (backlight_config.breathing) return; // do nothing if breathing is already on backlight_config.breathing = true; eeconfig_update_backlight(backlight_config.raw); @@ -213,7 +223,7 @@ void backlight_enable_breathing(void) { * FIXME: needs doc */ void backlight_disable_breathing(void) { - if (!backlight_config.breathing) return; // do nothing if breathing is already off + if (!backlight_config.breathing) return; // do nothing if breathing is already off backlight_config.breathing = false; eeconfig_update_backlight(backlight_config.raw); @@ -225,18 +235,30 @@ void backlight_disable_breathing(void) { * * FIXME: needs doc */ -bool is_backlight_breathing(void) { return backlight_config.breathing; } +bool is_backlight_breathing(void) { + return backlight_config.breathing; +} // following are marked as weak purely for backwards compatibility -__attribute__((weak)) void breathing_period_set(uint8_t value) { breathing_period = value ? value : 1; } +__attribute__((weak)) void breathing_period_set(uint8_t value) { + breathing_period = value ? value : 1; +} -__attribute__((weak)) uint8_t get_breathing_period(void) { return breathing_period; } +__attribute__((weak)) uint8_t get_breathing_period(void) { + return breathing_period; +} -__attribute__((weak)) void breathing_period_default(void) { breathing_period_set(BREATHING_PERIOD); } +__attribute__((weak)) void breathing_period_default(void) { + breathing_period_set(BREATHING_PERIOD); +} -__attribute__((weak)) void breathing_period_inc(void) { breathing_period_set(breathing_period + 1); } +__attribute__((weak)) void breathing_period_inc(void) { + breathing_period_set(breathing_period + 1); +} -__attribute__((weak)) void breathing_period_dec(void) { breathing_period_set(breathing_period - 1); } +__attribute__((weak)) void breathing_period_dec(void) { + breathing_period_set(breathing_period - 1); +} __attribute__((weak)) void breathing_toggle(void) { if (is_breathing()) diff --git a/quantum/backlight/backlight.h b/quantum/backlight/backlight.h index c30c70fd62..ff9c8de420 100644 --- a/quantum/backlight/backlight.h +++ b/quantum/backlight/backlight.h @@ -39,7 +39,7 @@ typedef union { struct { bool enable : 1; bool breathing : 1; - uint8_t reserved : 1; // Reserved for possible future backlight modes + uint8_t reserved : 1; // Reserved for possible future backlight modes uint8_t level : 5; }; } backlight_config_t; diff --git a/quantum/backlight/backlight_avr.c b/quantum/backlight/backlight_avr.c index 9c972ae02e..f3a0252270 100644 --- a/quantum/backlight/backlight_avr.c +++ b/quantum/backlight/backlight_avr.c @@ -136,7 +136,7 @@ # define TCCRxB TCCR1B # define TIMERx_COMPA_vect TIMER1_COMPA_vect # define TIMERx_OVF_vect TIMER1_OVF_vect -# if defined(__AVR_ATmega32A__) // This MCU has only one TIMSK register +# if defined(__AVR_ATmega32A__) // This MCU has only one TIMSK register # define TIMSKx TIMSK # else # define TIMSKx TIMSK1 @@ -166,7 +166,7 @@ error("Please set 'BACKLIGHT_DRIVER = custom' within rules.mk") error("Please set 'BACKLIGHT_DRIVER = software' within rules.mk") #endif -#ifndef BACKLIGHT_PWM_TIMER // pwm through software +#ifndef BACKLIGHT_PWM_TIMER // pwm through software static inline void enable_pwm(void) { # if BACKLIGHT_ON_STATE == 1 @@ -203,7 +203,9 @@ static inline void disable_pwm(void) { // or F_CPU/BACKLIGHT_CUSTOM_RESOLUTION if used. // Triggered when the counter reaches the OCRx value -ISR(TIMERx_COMPA_vect) { backlight_pins_off(); } +ISR(TIMERx_COMPA_vect) { + backlight_pins_off(); +} // Triggered when the counter reaches the TOP value // this one triggers at F_CPU/ICRx = 16MHz/65536 =~ 244 Hz @@ -232,15 +234,15 @@ ISR(TIMERx_OVF_vect) { // See http://jared.geek.nz/2013/feb/linear-led-pwm static uint16_t cie_lightness(uint16_t v) { - if (v <= (uint32_t)ICRx / 12) // If the value is less than or equal to ~8% of max + if (v <= (uint32_t)ICRx / 12) // If the value is less than or equal to ~8% of max { - return v / 9; // Same as dividing by 900% + return v / 9; // Same as dividing by 900% } else { // In the next two lines values are bit-shifted. This is to avoid loosing decimals in integer math. - uint32_t y = (((uint32_t)v + (uint32_t)ICRx / 6) << 5) / ((uint32_t)ICRx / 6 + ICRx); // If above 8%, add ~16% of max, and normalize with (max + ~16% max) - uint32_t out = (y * y * y * ICRx) >> 15; // Cube it and undo the bit-shifting. (which is now three times as much due to the cubing) + uint32_t y = (((uint32_t)v + (uint32_t)ICRx / 6) << 5) / ((uint32_t)ICRx / 6 + ICRx); // If above 8%, add ~16% of max, and normalize with (max + ~16% max) + uint32_t out = (y * y * y * ICRx) >> 15; // Cube it and undo the bit-shifting. (which is now three times as much due to the cubing) - if (out > ICRx) // Avoid overflows + if (out > ICRx) // Avoid overflows { out = ICRx; } @@ -249,10 +251,14 @@ static uint16_t cie_lightness(uint16_t v) { } // rescale the supplied backlight value to be in terms of the value limit // range for val is [0..ICRx]. PWM pin is high while the timer count is below val. -static uint32_t rescale_limit_val(uint32_t val) { return (val * (BACKLIGHT_LIMIT_VAL + 1)) / 256; } +static uint32_t rescale_limit_val(uint32_t val) { + return (val * (BACKLIGHT_LIMIT_VAL + 1)) / 256; +} // range for val is [0..ICRx]. PWM pin is high while the timer count is below val. -static inline void set_pwm(uint16_t val) { OCRxx = val; } +static inline void set_pwm(uint16_t val) { + OCRxx = val; +} void backlight_set(uint8_t level) { if (level > BACKLIGHT_LEVELS) level = BACKLIGHT_LEVELS; @@ -303,7 +309,9 @@ static uint16_t breathing_freq_scale_factor = 2; # ifdef BACKLIGHT_PWM_TIMER static bool breathing = false; -bool is_breathing(void) { return breathing; } +bool is_breathing(void) { + return breathing; +} # define breathing_interrupt_enable() \ do { \ @@ -315,7 +323,9 @@ bool is_breathing(void) { return breathing; } } while (0) # else -bool is_breathing(void) { return !!(TIMSKx & _BV(TOIEx)); } +bool is_breathing(void) { + return !!(TIMSKx & _BV(TOIEx)); +} # define breathing_interrupt_enable() \ do { \ @@ -370,7 +380,9 @@ void breathing_self_disable(void) { static const uint8_t breathing_table[BREATHING_STEPS] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 17, 20, 24, 28, 32, 36, 41, 46, 51, 57, 63, 70, 76, 83, 91, 98, 106, 113, 121, 129, 138, 146, 154, 162, 170, 178, 185, 193, 200, 207, 213, 220, 225, 231, 235, 240, 244, 247, 250, 252, 253, 254, 255, 254, 253, 252, 250, 247, 244, 240, 235, 231, 225, 220, 213, 207, 200, 193, 185, 178, 170, 162, 154, 146, 138, 129, 121, 113, 106, 98, 91, 83, 76, 70, 63, 57, 51, 46, 41, 36, 32, 28, 24, 20, 17, 15, 12, 10, 8, 6, 5, 4, 3, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // Use this before the cie_lightness function. -static inline uint16_t scale_backlight(uint16_t v) { return v / BACKLIGHT_LEVELS * get_backlight_level(); } +static inline uint16_t scale_backlight(uint16_t v) { + return v / BACKLIGHT_LEVELS * get_backlight_level(); +} # ifdef BACKLIGHT_PWM_TIMER void breathing_task(void) @@ -403,7 +415,7 @@ ISR(TIMERx_OVF_vect) set_pwm(cie_lightness(rescale_limit_val(scale_backlight((uint16_t)pgm_read_byte(&breathing_table[index]) * ICRx / 255)))); } -#endif // BACKLIGHT_BREATHING +#endif // BACKLIGHT_BREATHING void backlight_init_ports(void) { // Setup backlight pin as output and output to on state. @@ -415,10 +427,10 @@ void backlight_init_ports(void) { #ifdef BACKLIGHT_PWM_TIMER // TimerX setup, Fast PWM mode count to TOP set in ICRx - TCCRxA = _BV(WGM11); // = 0b00000010; + TCCRxA = _BV(WGM11); // = 0b00000010; // clock select clk/1 - TCCRxB = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001; -#else // hardware PWM + TCCRxB = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001; +#else // hardware PWM // Pin PB7 = OCR1C (Timer 1, Channel C) // Compare Output Mode = Clear on compare match, Channel C = COM1C1=1 COM1C0=0 // (i.e. start high, go low when counter matches.) @@ -430,8 +442,8 @@ void backlight_init_ports(void) { "In fast PWM mode, the compare units allow generation of PWM waveforms on the OCnx pins. Setting the COMnx1:0 bits to two will produce a non-inverted PWM [..]." "In fast PWM mode the counter is incremented until the counter value matches either one of the fixed values 0x00FF, 0x01FF, or 0x03FF (WGMn3:0 = 5, 6, or 7), the value in ICRn (WGMn3:0 = 14), or the value in OCRnA (WGMn3:0 = 15)." */ - TCCRxA = _BV(COMxx1) | _BV(WGM11); // = 0b00001010; - TCCRxB = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001; + TCCRxA = _BV(COMxx1) | _BV(WGM11); // = 0b00001010; + TCCRxB = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001; #endif #ifdef BACKLIGHT_CUSTOM_RESOLUTION diff --git a/quantum/backlight/backlight_chibios.c b/quantum/backlight/backlight_chibios.c index 7c6edd10d6..e8f9e70f78 100644 --- a/quantum/backlight/backlight_chibios.c +++ b/quantum/backlight/backlight_chibios.c @@ -53,14 +53,14 @@ static PWMConfig pwmCFG = {0xFFFF, /* PWM clock frequency */ // See http://jared.geek.nz/2013/feb/linear-led-pwm static uint16_t cie_lightness(uint16_t v) { - if (v <= 5243) // if below 8% of max - return v / 9; // same as dividing by 900% + if (v <= 5243) // if below 8% of max + return v / 9; // same as dividing by 900% else { - uint32_t y = (((uint32_t)v + 10486) << 8) / (10486 + 0xFFFFUL); // add 16% of max and compare + uint32_t y = (((uint32_t)v + 10486) << 8) / (10486 + 0xFFFFUL); // add 16% of max and compare // to get a useful result with integer division, we shift left in the expression above // and revert what we've done again after squaring. y = y * y * y >> 8; - if (y > 0xFFFFUL) // prevent overflow + if (y > 0xFFFFUL) // prevent overflow return 0xFFFFU; else return (uint16_t)y; @@ -117,7 +117,9 @@ static const uint8_t breathing_table[BREATHING_STEPS] = {0, 0, 0, 0, 0, 0, 0, 0, void breathing_callback(PWMDriver *pwmp); -bool is_breathing(void) { return pwmCFG.callback != NULL; } +bool is_breathing(void) { + return pwmCFG.callback != NULL; +} void breathing_enable(void) { pwmCFG.callback = breathing_callback; @@ -133,7 +135,9 @@ void breathing_disable(void) { } // Use this before the cie_lightness function. -static inline uint16_t scale_backlight(uint16_t v) { return v / BACKLIGHT_LEVELS * get_backlight_level(); } +static inline uint16_t scale_backlight(uint16_t v) { + return v / BACKLIGHT_LEVELS * get_backlight_level(); +} void breathing_callback(PWMDriver *pwmp) { uint8_t breathing_period = get_breathing_period(); diff --git a/quantum/backlight/backlight_driver_common.c b/quantum/backlight/backlight_driver_common.c index 270a43c67e..e4c2e90b5f 100644 --- a/quantum/backlight/backlight_driver_common.c +++ b/quantum/backlight/backlight_driver_common.c @@ -44,6 +44,10 @@ void backlight_pins_init(void) { FOR_EACH_LED(setPinOutput(backlight_pin); backlight_off(backlight_pin);) } -void backlight_pins_on(void) { FOR_EACH_LED(backlight_on(backlight_pin);) } +void backlight_pins_on(void) { + FOR_EACH_LED(backlight_on(backlight_pin);) +} -void backlight_pins_off(void) { FOR_EACH_LED(backlight_off(backlight_pin);) } +void backlight_pins_off(void) { + FOR_EACH_LED(backlight_off(backlight_pin);) +} diff --git a/quantum/backlight/backlight_software.c b/quantum/backlight/backlight_software.c index 709304f559..3d412cab52 100644 --- a/quantum/backlight/backlight_software.c +++ b/quantum/backlight/backlight_software.c @@ -30,11 +30,17 @@ static const uint16_t backlight_duty_table[] = { // clang-format on -static uint8_t scale_backlight(uint8_t v) { return v * (backlight_duty_table_size - 1) / BACKLIGHT_LEVELS; } +static uint8_t scale_backlight(uint8_t v) { + return v * (backlight_duty_table_size - 1) / BACKLIGHT_LEVELS; +} -void backlight_init_ports(void) { backlight_pins_init(); } +void backlight_init_ports(void) { + backlight_pins_init(); +} -void backlight_set(uint8_t level) { s_duty_pattern = backlight_duty_table[scale_backlight(level)]; } +void backlight_set(uint8_t level) { + s_duty_pattern = backlight_duty_table[scale_backlight(level)]; +} void backlight_task(void) { static uint8_t backlight_tick = 0; diff --git a/quantum/backlight/backlight_timer.c b/quantum/backlight/backlight_timer.c index c32c35c154..82fb6a6a83 100644 --- a/quantum/backlight/backlight_timer.c +++ b/quantum/backlight/backlight_timer.c @@ -14,14 +14,14 @@ static uint16_t backlight_timer_get_duty(void); // See http://jared.geek.nz/2013/feb/linear-led-pwm static uint16_t cie_lightness(uint16_t v) { - if (v <= 5243) // if below 8% of max - return v / 9; // same as dividing by 900% + if (v <= 5243) // if below 8% of max + return v / 9; // same as dividing by 900% else { - uint32_t y = (((uint32_t)v + 10486) << 8) / (10486 + 0xFFFFUL); // add 16% of max and compare + uint32_t y = (((uint32_t)v + 10486) << 8) / (10486 + 0xFFFFUL); // add 16% of max and compare // to get a useful result with integer division, we shift left in the expression above // and revert what we've done again after squaring. y = y * y * y >> 8; - if (y > 0xFFFFUL) // prevent overflow + if (y > 0xFFFFUL) // prevent overflow return 0xFFFFU; else return (uint16_t)y; @@ -61,7 +61,9 @@ static void backlight_timer_top(void) { } } -static void backlight_timer_cmp(void) { backlight_pins_off(); } +static void backlight_timer_cmp(void) { + backlight_pins_off(); +} void backlight_task(void) {} @@ -77,7 +79,9 @@ static uint16_t breathing_counter = 0; static const uint8_t breathing_table[BREATHING_STEPS] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 17, 20, 24, 28, 32, 36, 41, 46, 51, 57, 63, 70, 76, 83, 91, 98, 106, 113, 121, 129, 138, 146, 154, 162, 170, 178, 185, 193, 200, 207, 213, 220, 225, 231, 235, 240, 244, 247, 250, 252, 253, 254, 255, 254, 253, 252, 250, 247, 244, 240, 235, 231, 225, 220, 213, 207, 200, 193, 185, 178, 170, 162, 154, 146, 138, 129, 121, 113, 106, 98, 91, 83, 76, 70, 63, 57, 51, 46, 41, 36, 32, 28, 24, 20, 17, 15, 12, 10, 8, 6, 5, 4, 3, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // Use this before the cie_lightness function. -static inline uint16_t scale_backlight(uint16_t v) { return v / BACKLIGHT_LEVELS * get_backlight_level(); } +static inline uint16_t scale_backlight(uint16_t v) { + return v / BACKLIGHT_LEVELS * get_backlight_level(); +} void breathing_task(void) { uint8_t breathing_period = get_breathing_period(); @@ -91,13 +95,17 @@ void breathing_task(void) { backlight_timer_set_duty(cie_lightness(scale_backlight((uint16_t)breathing_table[index] * 256))); } -bool is_breathing(void) { return breathing; } +bool is_breathing(void) { + return breathing; +} void breathing_enable(void) { breathing_counter = 0; breathing = true; } -void breathing_disable(void) { breathing = false; } +void breathing_disable(void) { + breathing = false; +} void breathing_pulse(void) { backlight_set(is_backlight_enabled() ? 0 : BACKLIGHT_LEVELS); @@ -140,8 +148,12 @@ static void timerCallback(void) { } } -static void backlight_timer_set_duty(uint16_t duty) { s_duty = duty; } -static uint16_t backlight_timer_get_duty(void) { return s_duty; } +static void backlight_timer_set_duty(uint16_t duty) { + s_duty = duty; +} +static uint16_t backlight_timer_get_duty(void) { + return s_duty; +} // ChibiOS - Map GPT timer onto Software PWM static void gptTimerCallback(GPTDriver *gptp) { diff --git a/quantum/bitwise.c b/quantum/bitwise.c index 861cca0054..1868e14932 100644 --- a/quantum/bitwise.c +++ b/quantum/bitwise.c @@ -20,7 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. // bit population - return number of on-bit __attribute__((noinline)) uint8_t bitpop(uint8_t bits) { uint8_t c; - for (c = 0; bits; c++) bits &= bits - 1; + for (c = 0; bits; c++) + bits &= bits - 1; return c; /* const uint8_t bit_count[] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 }; @@ -30,13 +31,15 @@ __attribute__((noinline)) uint8_t bitpop(uint8_t bits) { uint8_t bitpop16(uint16_t bits) { uint8_t c; - for (c = 0; bits; c++) bits &= bits - 1; + for (c = 0; bits; c++) + bits &= bits - 1; return c; } uint8_t bitpop32(uint32_t bits) { uint8_t c; - for (c = 0; bits; c++) bits &= bits - 1; + for (c = 0; bits; c++) + bits &= bits - 1; return c; } diff --git a/quantum/bootmagic/bootmagic_lite.c b/quantum/bootmagic/bootmagic_lite.c index 54bbf5a2ee..f63c71fc6b 100644 --- a/quantum/bootmagic/bootmagic_lite.c +++ b/quantum/bootmagic/bootmagic_lite.c @@ -19,7 +19,9 @@ * * ...just incase someone wants to only change the eeprom behaviour */ -__attribute__((weak)) void bootmagic_lite_reset_eeprom(void) { eeconfig_disable(); } +__attribute__((weak)) void bootmagic_lite_reset_eeprom(void) { + eeconfig_disable(); +} /** \brief The lite version of TMK's bootmagic based on Wilba. * @@ -57,4 +59,6 @@ __attribute__((weak)) void bootmagic_lite(void) { } } -void bootmagic(void) { bootmagic_lite(); } +void bootmagic(void) { + bootmagic_lite(); +} diff --git a/quantum/color.c b/quantum/color.c index 1c5128e4a2..c80078dbf2 100644 --- a/quantum/color.c +++ b/quantum/color.c @@ -104,7 +104,9 @@ RGB hsv_to_rgb(HSV hsv) { #endif } -RGB hsv_to_rgb_nocie(HSV hsv) { return hsv_to_rgb_impl(hsv, false); } +RGB hsv_to_rgb_nocie(HSV hsv) { + return hsv_to_rgb_impl(hsv, false); +} #ifdef RGBW # ifndef MIN diff --git a/quantum/command.c b/quantum/command.c index 6d56a25ea1..f90d73207c 100644 --- a/quantum/command.c +++ b/quantum/command.c @@ -446,7 +446,7 @@ static bool command_common(uint8_t code) { // NKRO toggle case MAGIC_KC(MAGIC_KEY_NKRO): - clear_keyboard(); // clear to prevent stuck keys + clear_keyboard(); // clear to prevent stuck keys keymap_config.nkro = !keymap_config.nkro; if (keymap_config.nkro) { print("NKRO: on\n"); diff --git a/quantum/debounce/sym_defer_g.c b/quantum/debounce/sym_defer_g.c index 8cac1c37f9..47450992a4 100644 --- a/quantum/debounce/sym_defer_g.c +++ b/quantum/debounce/sym_defer_g.c @@ -45,6 +45,6 @@ void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool } void debounce_free(void) {} -#else // no debouncing. +#else // no debouncing. # include "none.c" #endif diff --git a/quantum/debounce/sym_defer_pr.c b/quantum/debounce/sym_defer_pr.c index 8b33acc6a2..ce24f0922f 100644 --- a/quantum/debounce/sym_defer_pr.c +++ b/quantum/debounce/sym_defer_pr.c @@ -69,4 +69,6 @@ void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool } } -bool debounce_active(void) { return true; } +bool debounce_active(void) { + return true; +} diff --git a/quantum/debounce/sym_eager_pk.c b/quantum/debounce/sym_eager_pk.c index deec463649..fe3e88bb06 100644 --- a/quantum/debounce/sym_eager_pk.c +++ b/quantum/debounce/sym_eager_pk.c @@ -131,7 +131,7 @@ static void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], ui if (*debounce_pointer == DEBOUNCE_ELAPSED) { *debounce_pointer = DEBOUNCE; counters_need_update = true; - existing_row ^= col_mask; // flip the bit. + existing_row ^= col_mask; // flip the bit. } } debounce_pointer++; diff --git a/quantum/debounce/tests/debounce_test_common.cpp b/quantum/debounce/tests/debounce_test_common.cpp index f9414e571d..0d5a7bb766 100644 --- a/quantum/debounce/tests/debounce_test_common.cpp +++ b/quantum/debounce/tests/debounce_test_common.cpp @@ -31,7 +31,9 @@ void set_time(uint32_t t); void advance_time(uint32_t ms); } -void DebounceTest::addEvents(std::initializer_list<DebounceTestEvent> events) { events_.insert(events_.end(), events.begin(), events.end()); } +void DebounceTest::addEvents(std::initializer_list<DebounceTestEvent> events) { + events_.insert(events_.end(), events.begin(), events.end()); +} void DebounceTest::runEvents() { /* Run the test multiple times, from 1kHz to 10kHz scan rate */ diff --git a/quantum/deferred_exec.c b/quantum/deferred_exec.c index a64b451df2..a0046a9648 100644 --- a/quantum/deferred_exec.c +++ b/quantum/deferred_exec.c @@ -157,7 +157,15 @@ void deferred_exec_advanced_task(deferred_executor_t *table, size_t table_count, static uint32_t last_deferred_exec_check = 0; static deferred_executor_t basic_executors[MAX_DEFERRED_EXECUTORS] = {0}; -deferred_token defer_exec(uint32_t delay_ms, deferred_exec_callback callback, void *cb_arg) { return defer_exec_advanced(basic_executors, MAX_DEFERRED_EXECUTORS, delay_ms, callback, cb_arg); } -bool extend_deferred_exec(deferred_token token, uint32_t delay_ms) { return extend_deferred_exec_advanced(basic_executors, MAX_DEFERRED_EXECUTORS, token, delay_ms); } -bool cancel_deferred_exec(deferred_token token) { return cancel_deferred_exec_advanced(basic_executors, MAX_DEFERRED_EXECUTORS, token); } -void deferred_exec_task(void) { deferred_exec_advanced_task(basic_executors, MAX_DEFERRED_EXECUTORS, &last_deferred_exec_check); } +deferred_token defer_exec(uint32_t delay_ms, deferred_exec_callback callback, void *cb_arg) { + return defer_exec_advanced(basic_executors, MAX_DEFERRED_EXECUTORS, delay_ms, callback, cb_arg); +} +bool extend_deferred_exec(deferred_token token, uint32_t delay_ms) { + return extend_deferred_exec_advanced(basic_executors, MAX_DEFERRED_EXECUTORS, token, delay_ms); +} +bool cancel_deferred_exec(deferred_token token) { + return cancel_deferred_exec_advanced(basic_executors, MAX_DEFERRED_EXECUTORS, token); +} +void deferred_exec_task(void) { + deferred_exec_advanced_task(basic_executors, MAX_DEFERRED_EXECUTORS, &last_deferred_exec_check); +} diff --git a/quantum/digitizer.c b/quantum/digitizer.c index e299867429..7925129d0c 100644 --- a/quantum/digitizer.c +++ b/quantum/digitizer.c @@ -24,9 +24,13 @@ __attribute__((weak)) void digitizer_send(void) { } } -__attribute__((weak)) void digitizer_task(void) { digitizer_send(); } +__attribute__((weak)) void digitizer_task(void) { + digitizer_send(); +} -digitizer_t digitizer_get_report(void) { return digitizerReport; } +digitizer_t digitizer_get_report(void) { + return digitizerReport; +} void digitizer_set_report(digitizer_t newDigitizerReport) { digitizerReport = newDigitizerReport; diff --git a/quantum/dip_switch.c b/quantum/dip_switch.c index 133ec85027..eee29aaf91 100644 --- a/quantum/dip_switch.c +++ b/quantum/dip_switch.c @@ -52,13 +52,21 @@ static uint16_t scan_count; static bool dip_switch_state[NUMBER_OF_DIP_SWITCHES] = {0}; static bool last_dip_switch_state[NUMBER_OF_DIP_SWITCHES] = {0}; -__attribute__((weak)) bool dip_switch_update_user(uint8_t index, bool active) { return true; } +__attribute__((weak)) bool dip_switch_update_user(uint8_t index, bool active) { + return true; +} -__attribute__((weak)) bool dip_switch_update_kb(uint8_t index, bool active) { return dip_switch_update_user(index, active); } +__attribute__((weak)) bool dip_switch_update_kb(uint8_t index, bool active) { + return dip_switch_update_user(index, active); +} -__attribute__((weak)) bool dip_switch_update_mask_user(uint32_t state) { return true; } +__attribute__((weak)) bool dip_switch_update_mask_user(uint32_t state) { + return true; +} -__attribute__((weak)) bool dip_switch_update_mask_kb(uint32_t state) { return dip_switch_update_mask_user(state); } +__attribute__((weak)) bool dip_switch_update_mask_kb(uint32_t state) { + return dip_switch_update_mask_user(state); +} void dip_switch_init(void) { #ifdef DIP_SWITCH_PINS diff --git a/quantum/dynamic_keymap.c b/quantum/dynamic_keymap.c index 8f1f39bc0f..f070375ff3 100644 --- a/quantum/dynamic_keymap.c +++ b/quantum/dynamic_keymap.c @@ -14,12 +14,12 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "keymap.h" // to get keymaps[][][] +#include "keymap.h" // to get keymaps[][][] #include "eeprom.h" -#include "progmem.h" // to read default from flash -#include "quantum.h" // for send_string() +#include "progmem.h" // to read default from flash +#include "quantum.h" // for send_string() #include "dynamic_keymap.h" -#include "via.h" // for default VIA_EEPROM_ADDR_END +#include "via.h" // for default VIA_EEPROM_ADDR_END #ifndef DYNAMIC_KEYMAP_LAYER_COUNT # define DYNAMIC_KEYMAP_LAYER_COUNT 4 @@ -79,7 +79,9 @@ # define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE (DYNAMIC_KEYMAP_EEPROM_MAX_ADDR - DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + 1) #endif -uint8_t dynamic_keymap_get_layer_count(void) { return DYNAMIC_KEYMAP_LAYER_COUNT; } +uint8_t dynamic_keymap_get_layer_count(void) { + return DYNAMIC_KEYMAP_LAYER_COUNT; +} void *dynamic_keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t column) { // TODO: optimize this with some left shifts @@ -151,9 +153,13 @@ uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) { } } -uint8_t dynamic_keymap_macro_get_count(void) { return DYNAMIC_KEYMAP_MACRO_COUNT; } +uint8_t dynamic_keymap_macro_get_count(void) { + return DYNAMIC_KEYMAP_MACRO_COUNT; +} -uint16_t dynamic_keymap_macro_get_buffer_size(void) { return DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE; } +uint16_t dynamic_keymap_macro_get_buffer_size(void) { + return DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE; +} void dynamic_keymap_macro_get_buffer(uint16_t offset, uint16_t size, uint8_t *data) { void * source = (void *)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + offset); diff --git a/quantum/eeconfig.c b/quantum/eeconfig.c index 4c2ad2490c..14cd5887f4 100644 --- a/quantum/eeconfig.c +++ b/quantum/eeconfig.c @@ -49,7 +49,7 @@ void eeconfig_init_quantum(void) { eeprom_update_byte(EECONFIG_KEYMAP_UPPER_BYTE, 0); eeprom_update_byte(EECONFIG_MOUSEKEY_ACCEL, 0); eeprom_update_byte(EECONFIG_BACKLIGHT, 0); - eeprom_update_byte(EECONFIG_AUDIO, 0xFF); // On by default + eeprom_update_byte(EECONFIG_AUDIO, 0xFF); // On by default eeprom_update_dword(EECONFIG_RGBLIGHT, 0); eeprom_update_byte(EECONFIG_STENOMODE, 0); eeprom_update_dword(EECONFIG_HAPTIC, 0); @@ -90,13 +90,17 @@ void eeconfig_init_quantum(void) { * * FIXME: needs doc */ -void eeconfig_init(void) { eeconfig_init_quantum(); } +void eeconfig_init(void) { + eeconfig_init_quantum(); +} /** \brief eeconfig enable * * FIXME: needs doc */ -void eeconfig_enable(void) { eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER); } +void eeconfig_enable(void) { + eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER); +} /** \brief eeconfig disable * @@ -141,29 +145,39 @@ bool eeconfig_is_disabled(void) { * * FIXME: needs doc */ -uint8_t eeconfig_read_debug(void) { return eeprom_read_byte(EECONFIG_DEBUG); } +uint8_t eeconfig_read_debug(void) { + return eeprom_read_byte(EECONFIG_DEBUG); +} /** \brief eeconfig update debug * * FIXME: needs doc */ -void eeconfig_update_debug(uint8_t val) { eeprom_update_byte(EECONFIG_DEBUG, val); } +void eeconfig_update_debug(uint8_t val) { + eeprom_update_byte(EECONFIG_DEBUG, val); +} /** \brief eeconfig read default layer * * FIXME: needs doc */ -uint8_t eeconfig_read_default_layer(void) { return eeprom_read_byte(EECONFIG_DEFAULT_LAYER); } +uint8_t eeconfig_read_default_layer(void) { + return eeprom_read_byte(EECONFIG_DEFAULT_LAYER); +} /** \brief eeconfig update default layer * * FIXME: needs doc */ -void eeconfig_update_default_layer(uint8_t val) { eeprom_update_byte(EECONFIG_DEFAULT_LAYER, val); } +void eeconfig_update_default_layer(uint8_t val) { + eeprom_update_byte(EECONFIG_DEFAULT_LAYER, val); +} /** \brief eeconfig read keymap * * FIXME: needs doc */ -uint16_t eeconfig_read_keymap(void) { return (eeprom_read_byte(EECONFIG_KEYMAP_LOWER_BYTE) | (eeprom_read_byte(EECONFIG_KEYMAP_UPPER_BYTE) << 8)); } +uint16_t eeconfig_read_keymap(void) { + return (eeprom_read_byte(EECONFIG_KEYMAP_LOWER_BYTE) | (eeprom_read_byte(EECONFIG_KEYMAP_UPPER_BYTE) << 8)); +} /** \brief eeconfig update keymap * * FIXME: needs doc @@ -177,53 +191,73 @@ void eeconfig_update_keymap(uint16_t val) { * * FIXME: needs doc */ -uint8_t eeconfig_read_audio(void) { return eeprom_read_byte(EECONFIG_AUDIO); } +uint8_t eeconfig_read_audio(void) { + return eeprom_read_byte(EECONFIG_AUDIO); +} /** \brief eeconfig update audio * * FIXME: needs doc */ -void eeconfig_update_audio(uint8_t val) { eeprom_update_byte(EECONFIG_AUDIO, val); } +void eeconfig_update_audio(uint8_t val) { + eeprom_update_byte(EECONFIG_AUDIO, val); +} /** \brief eeconfig read kb * * FIXME: needs doc */ -uint32_t eeconfig_read_kb(void) { return eeprom_read_dword(EECONFIG_KEYBOARD); } +uint32_t eeconfig_read_kb(void) { + return eeprom_read_dword(EECONFIG_KEYBOARD); +} /** \brief eeconfig update kb * * FIXME: needs doc */ -void eeconfig_update_kb(uint32_t val) { eeprom_update_dword(EECONFIG_KEYBOARD, val); } +void eeconfig_update_kb(uint32_t val) { + eeprom_update_dword(EECONFIG_KEYBOARD, val); +} /** \brief eeconfig read user * * FIXME: needs doc */ -uint32_t eeconfig_read_user(void) { return eeprom_read_dword(EECONFIG_USER); } +uint32_t eeconfig_read_user(void) { + return eeprom_read_dword(EECONFIG_USER); +} /** \brief eeconfig update user * * FIXME: needs doc */ -void eeconfig_update_user(uint32_t val) { eeprom_update_dword(EECONFIG_USER, val); } +void eeconfig_update_user(uint32_t val) { + eeprom_update_dword(EECONFIG_USER, val); +} /** \brief eeconfig read haptic * * FIXME: needs doc */ -uint32_t eeconfig_read_haptic(void) { return eeprom_read_dword(EECONFIG_HAPTIC); } +uint32_t eeconfig_read_haptic(void) { + return eeprom_read_dword(EECONFIG_HAPTIC); +} /** \brief eeconfig update haptic * * FIXME: needs doc */ -void eeconfig_update_haptic(uint32_t val) { eeprom_update_dword(EECONFIG_HAPTIC, val); } +void eeconfig_update_haptic(uint32_t val) { + eeprom_update_dword(EECONFIG_HAPTIC, val); +} /** \brief eeconfig read split handedness * * FIXME: needs doc */ -bool eeconfig_read_handedness(void) { return !!eeprom_read_byte(EECONFIG_HANDEDNESS); } +bool eeconfig_read_handedness(void) { + return !!eeprom_read_byte(EECONFIG_HANDEDNESS); +} /** \brief eeconfig update split handedness * * FIXME: needs doc */ -void eeconfig_update_handedness(bool val) { eeprom_update_byte(EECONFIG_HANDEDNESS, !!val); } +void eeconfig_update_handedness(bool val) { + eeprom_update_byte(EECONFIG_HANDEDNESS, !!val); +} diff --git a/quantum/eeconfig.h b/quantum/eeconfig.h index 22d874273c..f3cd1867ab 100644 --- a/quantum/eeconfig.h +++ b/quantum/eeconfig.h @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <stdbool.h> #ifndef EECONFIG_MAGIC_NUMBER -# define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEE9 // When changing, decrement this value to avoid future re-init issues +# define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEE9 // When changing, decrement this value to avoid future re-init issues #endif #define EECONFIG_MAGIC_NUMBER_OFF (uint16_t)0xFFFF @@ -112,28 +112,30 @@ void eeconfig_update_haptic(uint32_t val); bool eeconfig_read_handedness(void); void eeconfig_update_handedness(bool val); -#define EECONFIG_DEBOUNCE_HELPER(name, offset, config) \ - static uint8_t dirty_##name = false; \ - \ - static inline void eeconfig_init_##name(void) { \ - eeprom_read_block(&config, offset, sizeof(config)); \ - dirty_##name = false; \ - } \ - static inline void eeconfig_flush_##name(bool force) { \ - if (force || dirty_##name) { \ - eeprom_update_block(&config, offset, sizeof(config)); \ - dirty_##name = false; \ - } \ - } \ - static inline void eeconfig_flush_##name##_task(uint16_t timeout) { \ - static uint16_t flush_timer = 0; \ - if (timer_elapsed(flush_timer) > timeout) { \ - eeconfig_flush_##name(false); \ - flush_timer = timer_read(); \ - } \ - } \ - static inline void eeconfig_flag_##name(bool v) { dirty_##name |= v; } \ - static inline void eeconfig_write_##name(typeof(config) conf) { \ - memcpy(&config, &conf, sizeof(config)); \ - eeconfig_flag_##name(true); \ +#define EECONFIG_DEBOUNCE_HELPER(name, offset, config) \ + static uint8_t dirty_##name = false; \ + \ + static inline void eeconfig_init_##name(void) { \ + eeprom_read_block(&config, offset, sizeof(config)); \ + dirty_##name = false; \ + } \ + static inline void eeconfig_flush_##name(bool force) { \ + if (force || dirty_##name) { \ + eeprom_update_block(&config, offset, sizeof(config)); \ + dirty_##name = false; \ + } \ + } \ + static inline void eeconfig_flush_##name##_task(uint16_t timeout) { \ + static uint16_t flush_timer = 0; \ + if (timer_elapsed(flush_timer) > timeout) { \ + eeconfig_flush_##name(false); \ + flush_timer = timer_read(); \ + } \ + } \ + static inline void eeconfig_flag_##name(bool v) { \ + dirty_##name |= v; \ + } \ + static inline void eeconfig_write_##name(typeof(config) conf) { \ + memcpy(&config, &conf, sizeof(config)); \ + eeconfig_flag_##name(true); \ } diff --git a/quantum/encoder.c b/quantum/encoder.c index 8fb87281c2..59133f872a 100644 --- a/quantum/encoder.c +++ b/quantum/encoder.c @@ -59,9 +59,13 @@ static uint8_t thisHand, thatHand; static uint8_t encoder_value[NUMBER_OF_ENCODERS] = {0}; #endif -__attribute__((weak)) bool encoder_update_user(uint8_t index, bool clockwise) { return true; } +__attribute__((weak)) bool encoder_update_user(uint8_t index, bool clockwise) { + return true; +} -__attribute__((weak)) bool encoder_update_kb(uint8_t index, bool clockwise) { return encoder_update_user(index, clockwise); } +__attribute__((weak)) bool encoder_update_kb(uint8_t index, bool clockwise) { + return encoder_update_user(index, clockwise); +} void encoder_init(void) { #if defined(SPLIT_KEYBOARD) && defined(ENCODERS_PAD_A_RIGHT) && defined(ENCODERS_PAD_B_RIGHT) @@ -113,7 +117,7 @@ static bool encoder_update(uint8_t index, uint8_t state) { changed = true; encoder_update_kb(index, ENCODER_COUNTER_CLOCKWISE); } - if (encoder_pulses[i] <= -resolution) { // direction is arbitrary here, but this clockwise + if (encoder_pulses[i] <= -resolution) { // direction is arbitrary here, but this clockwise encoder_value[index]--; changed = true; encoder_update_kb(index, ENCODER_CLOCKWISE); @@ -140,7 +144,9 @@ bool encoder_read(void) { #ifdef SPLIT_KEYBOARD void last_encoder_activity_trigger(void); -void encoder_state_raw(uint8_t* slave_state) { memcpy(slave_state, &encoder_value[thisHand], sizeof(uint8_t) * NUMBER_OF_ENCODERS); } +void encoder_state_raw(uint8_t* slave_state) { + memcpy(slave_state, &encoder_value[thisHand], sizeof(uint8_t) * NUMBER_OF_ENCODERS); +} void encoder_update_raw(uint8_t* slave_state) { bool changed = false; diff --git a/quantum/encoder/tests/mock.c b/quantum/encoder/tests/mock.c index d0506a938f..10a00cb8f2 100644 --- a/quantum/encoder/tests/mock.c +++ b/quantum/encoder/tests/mock.c @@ -26,7 +26,9 @@ uint8_t mockSetPinInputHigh(pin_t pin) { return 0; } -bool mockReadPin(pin_t pin) { return pins[pin]; } +bool mockReadPin(pin_t pin) { + return pins[pin]; +} bool setPin(pin_t pin, bool val) { pins[pin] = val; diff --git a/quantum/encoder/tests/mock_split.c b/quantum/encoder/tests/mock_split.c index 68bf3af599..dd3c26d958 100644 --- a/quantum/encoder/tests/mock_split.c +++ b/quantum/encoder/tests/mock_split.c @@ -26,7 +26,9 @@ uint8_t mockSetPinInputHigh(pin_t pin) { return 0; } -bool mockReadPin(pin_t pin) { return pins[pin]; } +bool mockReadPin(pin_t pin) { + return pins[pin]; +} bool setPin(pin_t pin, bool val) { pins[pin] = val; diff --git a/quantum/haptic.c b/quantum/haptic.c index f915acf946..31d1114806 100644 --- a/quantum/haptic.c +++ b/quantum/haptic.c @@ -247,7 +247,9 @@ void haptic_set_dwell(uint8_t dwell) { xprintf("haptic_config.dwell = %u\n", haptic_config.dwell); } -uint8_t haptic_get_enable(void) { return haptic_config.enable; } +uint8_t haptic_get_enable(void) { + return haptic_config.enable; +} uint8_t haptic_get_mode(void) { if (!haptic_config.enable) { diff --git a/quantum/keyboard.c b/quantum/keyboard.c index 6bb2800910..ba5609f0aa 100644 --- a/quantum/keyboard.c +++ b/quantum/keyboard.c @@ -110,18 +110,34 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #endif static uint32_t last_input_modification_time = 0; -uint32_t last_input_activity_time(void) { return last_input_modification_time; } -uint32_t last_input_activity_elapsed(void) { return timer_elapsed32(last_input_modification_time); } +uint32_t last_input_activity_time(void) { + return last_input_modification_time; +} +uint32_t last_input_activity_elapsed(void) { + return timer_elapsed32(last_input_modification_time); +} static uint32_t last_matrix_modification_time = 0; -uint32_t last_matrix_activity_time(void) { return last_matrix_modification_time; } -uint32_t last_matrix_activity_elapsed(void) { return timer_elapsed32(last_matrix_modification_time); } -void last_matrix_activity_trigger(void) { last_matrix_modification_time = last_input_modification_time = timer_read32(); } +uint32_t last_matrix_activity_time(void) { + return last_matrix_modification_time; +} +uint32_t last_matrix_activity_elapsed(void) { + return timer_elapsed32(last_matrix_modification_time); +} +void last_matrix_activity_trigger(void) { + last_matrix_modification_time = last_input_modification_time = timer_read32(); +} static uint32_t last_encoder_modification_time = 0; -uint32_t last_encoder_activity_time(void) { return last_encoder_modification_time; } -uint32_t last_encoder_activity_elapsed(void) { return timer_elapsed32(last_encoder_modification_time); } -void last_encoder_activity_trigger(void) { last_encoder_modification_time = last_input_modification_time = timer_read32(); } +uint32_t last_encoder_activity_time(void) { + return last_encoder_modification_time; +} +uint32_t last_encoder_activity_elapsed(void) { + return timer_elapsed32(last_encoder_modification_time); +} +void last_encoder_activity_trigger(void) { + last_encoder_modification_time = last_input_modification_time = timer_read32(); +} // Only enable this if console is enabled to print to #if defined(DEBUG_MATRIX_SCAN_RATE) @@ -143,7 +159,9 @@ void matrix_scan_perf_task(void) { } } -uint32_t get_matrix_scan_rate(void) { return last_matrix_scan_count; } +uint32_t get_matrix_scan_rate(void) { + return last_matrix_scan_count; +} #else # define matrix_scan_perf_task() #endif @@ -163,7 +181,7 @@ static matrix_row_t get_real_keys(uint8_t row, matrix_row_t rowdata) { } static inline bool popcount_more_than_one(matrix_row_t rowdata) { - rowdata &= rowdata - 1; // if there are less than two bits (keys) set, rowdata will become zero + rowdata &= rowdata - 1; // if there are less than two bits (keys) set, rowdata will become zero return rowdata; } @@ -220,7 +238,9 @@ __attribute__((weak)) void keyboard_pre_init_user(void) {} * * FIXME: needs doc */ -__attribute__((weak)) void keyboard_pre_init_kb(void) { keyboard_pre_init_user(); } +__attribute__((weak)) void keyboard_pre_init_kb(void) { + keyboard_pre_init_user(); +} /** \brief keyboard_post_init_user * @@ -234,7 +254,9 @@ __attribute__((weak)) void keyboard_post_init_user() {} * FIXME: needs doc */ -__attribute__((weak)) void keyboard_post_init_kb(void) { keyboard_post_init_user(); } +__attribute__((weak)) void keyboard_post_init_kb(void) { + keyboard_post_init_user(); +} /** \brief keyboard_setup * @@ -258,13 +280,17 @@ void keyboard_setup(void) { * * FIXME: needs doc */ -__attribute__((weak)) bool is_keyboard_master(void) { return true; } +__attribute__((weak)) bool is_keyboard_master(void) { + return true; +} /** \brief is_keyboard_left * * FIXME: needs doc */ -__attribute__((weak)) bool is_keyboard_left(void) { return true; } +__attribute__((weak)) bool is_keyboard_left(void) { + return true; +} #endif @@ -273,7 +299,9 @@ __attribute__((weak)) bool is_keyboard_left(void) { return true; } * Override this function if you have a condition where keypresses processing should change: * - splits where the slave side needs to process for rgb/oled functionality */ -__attribute__((weak)) bool should_process_keypress(void) { return is_keyboard_master(); } +__attribute__((weak)) bool should_process_keypress(void) { + return is_keyboard_master(); +} /** \brief housekeeping_task_kb * diff --git a/quantum/keyboard.h b/quantum/keyboard.h index 9b0fb3cef8..e122b38264 100644 --- a/quantum/keyboard.h +++ b/quantum/keyboard.h @@ -44,13 +44,21 @@ typedef struct { * 1) (time == 0) to handle (keyevent_t){} as empty event * 2) Matrix(255, 255) to make TICK event available */ -static inline bool IS_NOEVENT(keyevent_t event) { return event.time == 0 || (event.key.row == 255 && event.key.col == 255); } -static inline bool IS_PRESSED(keyevent_t event) { return (!IS_NOEVENT(event) && event.pressed); } -static inline bool IS_RELEASED(keyevent_t event) { return (!IS_NOEVENT(event) && !event.pressed); } +static inline bool IS_NOEVENT(keyevent_t event) { + return event.time == 0 || (event.key.row == 255 && event.key.col == 255); +} +static inline bool IS_PRESSED(keyevent_t event) { + return (!IS_NOEVENT(event) && event.pressed); +} +static inline bool IS_RELEASED(keyevent_t event) { + return (!IS_NOEVENT(event) && !event.pressed); +} /* Tick event */ -#define TICK \ - (keyevent_t) { .key = (keypos_t){.row = 255, .col = 255}, .pressed = false, .time = (timer_read() | 1) } +#define TICK \ + (keyevent_t) { \ + .key = (keypos_t){.row = 255, .col = 255}, .pressed = false, .time = (timer_read() | 1) \ + } /* it runs once at early stage of startup before keyboard_init. */ void keyboard_setup(void); @@ -68,18 +76,18 @@ void keyboard_pre_init_user(void); void keyboard_post_init_kb(void); void keyboard_post_init_user(void); -void housekeeping_task(void); // To be executed by the main loop in each backend TMK protocol -void housekeeping_task_kb(void); // To be overridden by keyboard-level code -void housekeeping_task_user(void); // To be overridden by user/keymap-level code +void housekeeping_task(void); // To be executed by the main loop in each backend TMK protocol +void housekeeping_task_kb(void); // To be overridden by keyboard-level code +void housekeeping_task_user(void); // To be overridden by user/keymap-level code -uint32_t last_input_activity_time(void); // Timestamp of the last matrix or encoder activity -uint32_t last_input_activity_elapsed(void); // Number of milliseconds since the last matrix or encoder activity +uint32_t last_input_activity_time(void); // Timestamp of the last matrix or encoder activity +uint32_t last_input_activity_elapsed(void); // Number of milliseconds since the last matrix or encoder activity -uint32_t last_matrix_activity_time(void); // Timestamp of the last matrix activity -uint32_t last_matrix_activity_elapsed(void); // Number of milliseconds since the last matrix activity +uint32_t last_matrix_activity_time(void); // Timestamp of the last matrix activity +uint32_t last_matrix_activity_elapsed(void); // Number of milliseconds since the last matrix activity -uint32_t last_encoder_activity_time(void); // Timestamp of the last encoder activity -uint32_t last_encoder_activity_elapsed(void); // Number of milliseconds since the last encoder activity +uint32_t last_encoder_activity_time(void); // Timestamp of the last encoder activity +uint32_t last_encoder_activity_elapsed(void); // Number of milliseconds since the last encoder activity uint32_t get_matrix_scan_rate(void); diff --git a/quantum/keycode.h b/quantum/keycode.h index a932550635..3c80a386d1 100644 --- a/quantum/keycode.h +++ b/quantum/keycode.h @@ -251,7 +251,7 @@ enum hid_keyboard_keypad_usage { KC_J, KC_K, KC_L, - KC_M, // 0x10 + KC_M, // 0x10 KC_N, KC_O, KC_P, @@ -267,7 +267,7 @@ enum hid_keyboard_keypad_usage { KC_Z, KC_1, KC_2, - KC_3, // 0x20 + KC_3, // 0x20 KC_4, KC_5, KC_6, @@ -283,7 +283,7 @@ enum hid_keyboard_keypad_usage { KC_MINUS, KC_EQUAL, KC_LEFT_BRACKET, - KC_RIGHT_BRACKET, // 0x30 + KC_RIGHT_BRACKET, // 0x30 KC_BACKSLASH, KC_NONUS_HASH, KC_SEMICOLON, @@ -299,7 +299,7 @@ enum hid_keyboard_keypad_usage { KC_F4, KC_F5, KC_F6, - KC_F7, // 0x40 + KC_F7, // 0x40 KC_F8, KC_F9, KC_F10, @@ -315,7 +315,7 @@ enum hid_keyboard_keypad_usage { KC_END, KC_PAGE_DOWN, KC_RIGHT, - KC_LEFT, // 0x50 + KC_LEFT, // 0x50 KC_DOWN, KC_UP, KC_NUM_LOCK, @@ -331,7 +331,7 @@ enum hid_keyboard_keypad_usage { KC_KP_5, KC_KP_6, KC_KP_7, - KC_KP_8, // 0x60 + KC_KP_8, // 0x60 KC_KP_9, KC_KP_0, KC_KP_DOT, @@ -347,7 +347,7 @@ enum hid_keyboard_keypad_usage { KC_F18, KC_F19, KC_F20, - KC_F21, // 0x70 + KC_F21, // 0x70 KC_F22, KC_F23, KC_F24, @@ -363,7 +363,7 @@ enum hid_keyboard_keypad_usage { KC_PASTE, KC_FIND, KC_KB_MUTE, - KC_KB_VOLUME_UP, // 0x80 + KC_KB_VOLUME_UP, // 0x80 KC_KB_VOLUME_DOWN, KC_LOCKING_CAPS_LOCK, KC_LOCKING_NUM_LOCK, @@ -379,7 +379,7 @@ enum hid_keyboard_keypad_usage { KC_INTERNATIONAL_7, KC_INTERNATIONAL_8, KC_INTERNATIONAL_9, - KC_LANGUAGE_1, // 0x90 + KC_LANGUAGE_1, // 0x90 KC_LANGUAGE_2, KC_LANGUAGE_3, KC_LANGUAGE_4, @@ -395,7 +395,7 @@ enum hid_keyboard_keypad_usage { KC_PRIOR, KC_RETURN, KC_SEPARATOR, - KC_OUT, // 0xA0 + KC_OUT, // 0xA0 KC_OPER, KC_CLEAR_AGAIN, KC_CRSEL, @@ -488,7 +488,7 @@ enum internal_special_keycodes { KC_MEDIA_STOP, KC_MEDIA_PLAY_PAUSE, KC_MEDIA_SELECT, - KC_MEDIA_EJECT, // 0xB0 + KC_MEDIA_EJECT, // 0xB0 KC_MAIL, KC_CALCULATOR, KC_MY_COMPUTER, @@ -514,7 +514,7 @@ enum mouse_keys { #endif KC_MS_DOWN, KC_MS_LEFT, - KC_MS_RIGHT, // 0xF0 + KC_MS_RIGHT, // 0xF0 KC_MS_BTN1, KC_MS_BTN2, KC_MS_BTN3, @@ -539,7 +539,7 @@ enum mouse_keys { /* Acceleration */ KC_MS_ACCEL0, KC_MS_ACCEL1, - KC_MS_ACCEL2 // 0xFF + KC_MS_ACCEL2 // 0xFF }; #include "keycode_legacy.h" diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index cd67f71a8f..a91b2a0b36 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c @@ -77,7 +77,7 @@ action_t action_for_keycode(uint16_t keycode) { case QK_MODS ... QK_MODS_MAX:; // Has a modifier // Split it up - action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF); // adds modifier to key + action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF); // adds modifier to key break; #ifndef NO_ACTION_LAYER case QK_LAYER_TAP ... QK_LAYER_TAP_MAX: diff --git a/quantum/keymap_extras/keymap_nordic.h b/quantum/keymap_extras/keymap_nordic.h index 76d2f4f6b0..55a58a25b0 100644 --- a/quantum/keymap_extras/keymap_nordic.h +++ b/quantum/keymap_extras/keymap_nordic.h @@ -24,7 +24,7 @@ #define NO_ACUT KC_EQL #define NO_AM KC_LBRC -#define NO_QUOT KC_RBRC // this is the "umlaut" char on Nordic keyboards, Apple layout +#define NO_QUOT KC_RBRC // this is the "umlaut" char on Nordic keyboards, Apple layout #define NO_AE KC_SCLN #define NO_OSLH KC_QUOT #define NO_APOS KC_NUHS diff --git a/quantum/keymap_extras/keymap_steno.h b/quantum/keymap_extras/keymap_steno.h index 310aa07409..e888ccd643 100644 --- a/quantum/keymap_extras/keymap_steno.h +++ b/quantum/keymap_extras/keymap_steno.h @@ -70,7 +70,7 @@ enum steno_keycodes { STN_NB, STN_NC, STN_ZR, - STN__MAX = STN_ZR, // must be less than QK_STENO_BOLT + STN__MAX = STN_ZR, // must be less than QK_STENO_BOLT }; #ifdef STENO_COMBINEDMAP diff --git a/quantum/led.c b/quantum/led.c index 7b3f877208..c5ddbc22c5 100644 --- a/quantum/led.c +++ b/quantum/led.c @@ -64,13 +64,17 @@ __attribute__((weak)) void led_set_user(uint8_t usb_led) {} * * \deprecated Use led_update_kb() instead. */ -__attribute__((weak)) void led_set_kb(uint8_t usb_led) { led_set_user(usb_led); } +__attribute__((weak)) void led_set_kb(uint8_t usb_led) { + led_set_user(usb_led); +} /** \brief Lock LED update callback - keymap/user level * * \return True if led_update_kb() should run its own code, false otherwise. */ -__attribute__((weak)) bool led_update_user(led_t led_state) { return true; } +__attribute__((weak)) bool led_update_user(led_t led_state) { + return true; +} /** \brief Lock LED update callback - keyboard level * @@ -156,7 +160,9 @@ void led_suspend(void) { /** \brief Trigger behaviour on transition from suspend */ -void led_wakeup(void) { led_set(host_keyboard_leds()); } +void led_wakeup(void) { + led_set(host_keyboard_leds()); +} /** \brief set host led state * diff --git a/quantum/led_matrix/animations/alpha_mods_anim.h b/quantum/led_matrix/animations/alpha_mods_anim.h index 4d017894a1..01acb3f933 100644 --- a/quantum/led_matrix/animations/alpha_mods_anim.h +++ b/quantum/led_matrix/animations/alpha_mods_anim.h @@ -20,5 +20,5 @@ bool ALPHAS_MODS(effect_params_t* params) { return led_matrix_check_finished_leds(led_max); } -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_ALPHAS_MODS +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_ALPHAS_MODS diff --git a/quantum/led_matrix/animations/band_anim.h b/quantum/led_matrix/animations/band_anim.h index 293be4f67a..d9491849ea 100644 --- a/quantum/led_matrix/animations/band_anim.h +++ b/quantum/led_matrix/animations/band_anim.h @@ -7,7 +7,9 @@ static uint8_t BAND_math(uint8_t val, uint8_t i, uint8_t time) { return scale8(v < 0 ? 0 : v, val); } -bool BAND(effect_params_t* params) { return effect_runner_i(params, &BAND_math); } +bool BAND(effect_params_t* params) { + return effect_runner_i(params, &BAND_math); +} -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_BAND +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_BAND diff --git a/quantum/led_matrix/animations/band_pinwheel_anim.h b/quantum/led_matrix/animations/band_pinwheel_anim.h index f47a3869ce..482d183eb6 100644 --- a/quantum/led_matrix/animations/band_pinwheel_anim.h +++ b/quantum/led_matrix/animations/band_pinwheel_anim.h @@ -2,9 +2,13 @@ LED_MATRIX_EFFECT(BAND_PINWHEEL) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS -static uint8_t BAND_PINWHEEL_math(uint8_t val, int16_t dx, int16_t dy, uint8_t time) { return scale8(val - time - atan2_8(dy, dx) * 3, val); } +static uint8_t BAND_PINWHEEL_math(uint8_t val, int16_t dx, int16_t dy, uint8_t time) { + return scale8(val - time - atan2_8(dy, dx) * 3, val); +} -bool BAND_PINWHEEL(effect_params_t* params) { return effect_runner_dx_dy(params, &BAND_PINWHEEL_math); } +bool BAND_PINWHEEL(effect_params_t* params) { + return effect_runner_dx_dy(params, &BAND_PINWHEEL_math); +} -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_BAND_PINWHEEL +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_BAND_PINWHEEL diff --git a/quantum/led_matrix/animations/band_spiral_anim.h b/quantum/led_matrix/animations/band_spiral_anim.h index a4bd382181..ef93d19270 100644 --- a/quantum/led_matrix/animations/band_spiral_anim.h +++ b/quantum/led_matrix/animations/band_spiral_anim.h @@ -2,9 +2,13 @@ LED_MATRIX_EFFECT(BAND_SPIRAL) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS -static uint8_t BAND_SPIRAL_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { return scale8(val + dist - time - atan2_8(dy, dx), val); } +static uint8_t BAND_SPIRAL_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { + return scale8(val + dist - time - atan2_8(dy, dx), val); +} -bool BAND_SPIRAL(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_math); } +bool BAND_SPIRAL(effect_params_t* params) { + return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_math); +} -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_BAND_SPIRAL +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_BAND_SPIRAL diff --git a/quantum/led_matrix/animations/breathing_anim.h b/quantum/led_matrix/animations/breathing_anim.h index 899925f516..0bd4cb0cc3 100644 --- a/quantum/led_matrix/animations/breathing_anim.h +++ b/quantum/led_matrix/animations/breathing_anim.h @@ -15,5 +15,5 @@ bool BREATHING(effect_params_t* params) { return led_matrix_check_finished_leds(led_max); } -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_BREATHING +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_BREATHING diff --git a/quantum/led_matrix/animations/cycle_left_right_anim.h b/quantum/led_matrix/animations/cycle_left_right_anim.h index 1a8999b831..0a339e6d62 100644 --- a/quantum/led_matrix/animations/cycle_left_right_anim.h +++ b/quantum/led_matrix/animations/cycle_left_right_anim.h @@ -2,9 +2,13 @@ LED_MATRIX_EFFECT(CYCLE_LEFT_RIGHT) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS -static uint8_t CYCLE_LEFT_RIGHT_math(uint8_t val, uint8_t i, uint8_t time) { return scale8(g_led_config.point[i].x - time, val); } +static uint8_t CYCLE_LEFT_RIGHT_math(uint8_t val, uint8_t i, uint8_t time) { + return scale8(g_led_config.point[i].x - time, val); +} -bool CYCLE_LEFT_RIGHT(effect_params_t* params) { return effect_runner_i(params, &CYCLE_LEFT_RIGHT_math); } +bool CYCLE_LEFT_RIGHT(effect_params_t* params) { + return effect_runner_i(params, &CYCLE_LEFT_RIGHT_math); +} -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_CYCLE_LEFT_RIGHT +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_CYCLE_LEFT_RIGHT diff --git a/quantum/led_matrix/animations/cycle_out_in_anim.h b/quantum/led_matrix/animations/cycle_out_in_anim.h index 77d3a14b6f..8311d97fe8 100644 --- a/quantum/led_matrix/animations/cycle_out_in_anim.h +++ b/quantum/led_matrix/animations/cycle_out_in_anim.h @@ -2,9 +2,13 @@ LED_MATRIX_EFFECT(CYCLE_OUT_IN) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS -static uint8_t CYCLE_OUT_IN_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { return scale8(3 * dist / 2 + time, val); } +static uint8_t CYCLE_OUT_IN_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { + return scale8(3 * dist / 2 + time, val); +} -bool CYCLE_OUT_IN(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &CYCLE_OUT_IN_math); } +bool CYCLE_OUT_IN(effect_params_t* params) { + return effect_runner_dx_dy_dist(params, &CYCLE_OUT_IN_math); +} -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_CYCLE_OUT_IN +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_CYCLE_OUT_IN diff --git a/quantum/led_matrix/animations/cycle_up_down_anim.h b/quantum/led_matrix/animations/cycle_up_down_anim.h index b25947199c..7e2d71a0f1 100644 --- a/quantum/led_matrix/animations/cycle_up_down_anim.h +++ b/quantum/led_matrix/animations/cycle_up_down_anim.h @@ -2,9 +2,13 @@ LED_MATRIX_EFFECT(CYCLE_UP_DOWN) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS -static uint8_t CYCLE_UP_DOWN_math(uint8_t val, uint8_t i, uint8_t time) { return scale8(g_led_config.point[i].y - time, val); } +static uint8_t CYCLE_UP_DOWN_math(uint8_t val, uint8_t i, uint8_t time) { + return scale8(g_led_config.point[i].y - time, val); +} -bool CYCLE_UP_DOWN(effect_params_t* params) { return effect_runner_i(params, &CYCLE_UP_DOWN_math); } +bool CYCLE_UP_DOWN(effect_params_t* params) { + return effect_runner_i(params, &CYCLE_UP_DOWN_math); +} -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_CYCLE_UP_DOWN +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_CYCLE_UP_DOWN diff --git a/quantum/led_matrix/animations/dual_beacon_anim.h b/quantum/led_matrix/animations/dual_beacon_anim.h index 81735e323c..1dfb5ffe52 100644 --- a/quantum/led_matrix/animations/dual_beacon_anim.h +++ b/quantum/led_matrix/animations/dual_beacon_anim.h @@ -2,9 +2,13 @@ LED_MATRIX_EFFECT(DUAL_BEACON) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS -static uint8_t DUAL_BEACON_math(uint8_t val, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { return scale8(((g_led_config.point[i].y - k_led_matrix_center.y) * cos + (g_led_config.point[i].x - k_led_matrix_center.x) * sin) / 128, val); } +static uint8_t DUAL_BEACON_math(uint8_t val, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { + return scale8(((g_led_config.point[i].y - k_led_matrix_center.y) * cos + (g_led_config.point[i].x - k_led_matrix_center.x) * sin) / 128, val); +} -bool DUAL_BEACON(effect_params_t* params) { return effect_runner_sin_cos_i(params, &DUAL_BEACON_math); } +bool DUAL_BEACON(effect_params_t* params) { + return effect_runner_sin_cos_i(params, &DUAL_BEACON_math); +} -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_DUAL_BEACON +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_DUAL_BEACON diff --git a/quantum/led_matrix/animations/runners/effect_runner_reactive.h b/quantum/led_matrix/animations/runners/effect_runner_reactive.h index be3090aa53..8468458744 100644 --- a/quantum/led_matrix/animations/runners/effect_runner_reactive.h +++ b/quantum/led_matrix/animations/runners/effect_runner_reactive.h @@ -25,4 +25,4 @@ bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) { return led_matrix_check_finished_leds(led_max); } -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +#endif // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h b/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h index f6ffc825a1..aec4a6ffda 100644 --- a/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h +++ b/quantum/led_matrix/animations/runners/effect_runner_reactive_splash.h @@ -23,4 +23,4 @@ bool effect_runner_reactive_splash(uint8_t start, effect_params_t* params, react return led_matrix_check_finished_leds(led_max); } -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +#endif // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix/animations/solid_anim.h b/quantum/led_matrix/animations/solid_anim.h index c728dbcc98..895542e152 100644 --- a/quantum/led_matrix/animations/solid_anim.h +++ b/quantum/led_matrix/animations/solid_anim.h @@ -12,4 +12,4 @@ bool SOLID(effect_params_t* params) { return led_matrix_check_finished_leds(led_max); } -#endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/led_matrix/animations/solid_reactive_cross.h b/quantum/led_matrix/animations/solid_reactive_cross.h index a149e9a929..55a2556996 100644 --- a/quantum/led_matrix/animations/solid_reactive_cross.h +++ b/quantum/led_matrix/animations/solid_reactive_cross.h @@ -23,13 +23,17 @@ static uint8_t SOLID_REACTIVE_CROSS_math(uint8_t val, int16_t dx, int16_t dy, ui } # ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS -bool SOLID_REACTIVE_CROSS(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_CROSS_math); } +bool SOLID_REACTIVE_CROSS(effect_params_t* params) { + return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_CROSS_math); +} # endif # ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS -bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_CROSS_math); } +bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) { + return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_CROSS_math); +} # endif -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS) || defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS) -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +# endif // defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS) || defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS) +#endif // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix/animations/solid_reactive_nexus.h b/quantum/led_matrix/animations/solid_reactive_nexus.h index 5a86e48c6c..b1ec54e3b1 100644 --- a/quantum/led_matrix/animations/solid_reactive_nexus.h +++ b/quantum/led_matrix/animations/solid_reactive_nexus.h @@ -20,13 +20,17 @@ static uint8_t SOLID_REACTIVE_NEXUS_math(uint8_t val, int16_t dx, int16_t dy, ui } # ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS -bool SOLID_REACTIVE_NEXUS(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_NEXUS_math); } +bool SOLID_REACTIVE_NEXUS(effect_params_t* params) { + return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_NEXUS_math); +} # endif # ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS -bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math); } +bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) { + return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math); +} # endif -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS) -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +# endif // defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS) || defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS) +#endif // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix/animations/solid_reactive_simple_anim.h b/quantum/led_matrix/animations/solid_reactive_simple_anim.h index 14f5e90730..3b289c78dd 100644 --- a/quantum/led_matrix/animations/solid_reactive_simple_anim.h +++ b/quantum/led_matrix/animations/solid_reactive_simple_anim.h @@ -3,10 +3,14 @@ LED_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS -static uint8_t SOLID_REACTIVE_SIMPLE_math(uint8_t val, uint16_t offset) { return scale8(255 - offset, val); } +static uint8_t SOLID_REACTIVE_SIMPLE_math(uint8_t val, uint16_t offset) { + return scale8(255 - offset, val); +} -bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) { return effect_runner_reactive(params, &SOLID_REACTIVE_SIMPLE_math); } +bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) { + return effect_runner_reactive(params, &SOLID_REACTIVE_SIMPLE_math); +} -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // ENABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +# endif // ENABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE +#endif // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix/animations/solid_reactive_wide.h b/quantum/led_matrix/animations/solid_reactive_wide.h index 3aa88063a7..96338113f1 100644 --- a/quantum/led_matrix/animations/solid_reactive_wide.h +++ b/quantum/led_matrix/animations/solid_reactive_wide.h @@ -18,13 +18,17 @@ static uint8_t SOLID_REACTIVE_WIDE_math(uint8_t val, int16_t dx, int16_t dy, uin } # ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE -bool SOLID_REACTIVE_WIDE(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_WIDE_math); } +bool SOLID_REACTIVE_WIDE(effect_params_t* params) { + return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_WIDE_math); +} # endif # ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE -bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math); } +bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) { + return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math); +} # endif -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // !defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE) || !defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE) -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +# endif // !defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE) || !defined(ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE) +#endif // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix/animations/solid_splash_anim.h b/quantum/led_matrix/animations/solid_splash_anim.h index 17b692a09a..b8b6e8ea5e 100644 --- a/quantum/led_matrix/animations/solid_splash_anim.h +++ b/quantum/led_matrix/animations/solid_splash_anim.h @@ -18,13 +18,17 @@ uint8_t SOLID_SPLASH_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uin } # ifdef ENABLE_LED_MATRIX_SOLID_SPLASH -bool SOLID_SPLASH(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_SPLASH_math); } +bool SOLID_SPLASH(effect_params_t* params) { + return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_SPLASH_math); +} # endif # ifdef ENABLE_LED_MATRIX_SOLID_MULTISPLASH -bool SOLID_MULTISPLASH(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_SPLASH_math); } +bool SOLID_MULTISPLASH(effect_params_t* params) { + return effect_runner_reactive_splash(0, params, &SOLID_SPLASH_math); +} # endif -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // defined(ENABLE_LED_MATRIX_SPLASH) || defined(ENABLE_LED_MATRIX_MULTISPLASH) -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +# endif // defined(ENABLE_LED_MATRIX_SPLASH) || defined(ENABLE_LED_MATRIX_MULTISPLASH) +#endif // LED_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/led_matrix/animations/wave_left_right_anim.h b/quantum/led_matrix/animations/wave_left_right_anim.h index 76487f8515..8dedd64738 100644 --- a/quantum/led_matrix/animations/wave_left_right_anim.h +++ b/quantum/led_matrix/animations/wave_left_right_anim.h @@ -2,9 +2,13 @@ LED_MATRIX_EFFECT(WAVE_LEFT_RIGHT) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS -static uint8_t WAVE_LEFT_RIGHT_math(uint8_t val, uint8_t i, uint8_t time) { return scale8(sin8(g_led_config.point[i].x - time), val); } +static uint8_t WAVE_LEFT_RIGHT_math(uint8_t val, uint8_t i, uint8_t time) { + return scale8(sin8(g_led_config.point[i].x - time), val); +} -bool WAVE_LEFT_RIGHT(effect_params_t* params) { return effect_runner_i(params, &WAVE_LEFT_RIGHT_math); } +bool WAVE_LEFT_RIGHT(effect_params_t* params) { + return effect_runner_i(params, &WAVE_LEFT_RIGHT_math); +} -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_WAVE_LEFT_RIGHT +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_WAVE_LEFT_RIGHT diff --git a/quantum/led_matrix/animations/wave_up_down_anim.h b/quantum/led_matrix/animations/wave_up_down_anim.h index 94710f5c6e..4564f3e493 100644 --- a/quantum/led_matrix/animations/wave_up_down_anim.h +++ b/quantum/led_matrix/animations/wave_up_down_anim.h @@ -2,9 +2,13 @@ LED_MATRIX_EFFECT(WAVE_UP_DOWN) # ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS -static uint8_t WAVE_UP_DOWN_math(uint8_t val, uint8_t i, uint8_t time) { return scale8(sin8(g_led_config.point[i].y - time), val); } +static uint8_t WAVE_UP_DOWN_math(uint8_t val, uint8_t i, uint8_t time) { + return scale8(sin8(g_led_config.point[i].y - time), val); +} -bool WAVE_UP_DOWN(effect_params_t* params) { return effect_runner_i(params, &WAVE_UP_DOWN_math); } +bool WAVE_UP_DOWN(effect_params_t* params) { + return effect_runner_i(params, &WAVE_UP_DOWN_math); +} -# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_LED_MATRIX_WAVE_UP_DOWN +# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_LED_MATRIX_WAVE_UP_DOWN diff --git a/quantum/led_matrix/led_matrix.c b/quantum/led_matrix/led_matrix.c index be1494e884..38ed79bed0 100644 --- a/quantum/led_matrix/led_matrix.c +++ b/quantum/led_matrix/led_matrix.c @@ -88,14 +88,14 @@ const led_point_t k_led_matrix_center = LED_MATRIX_CENTER; #endif // globals -led_eeconfig_t led_matrix_eeconfig; // TODO: would like to prefix this with g_ for global consistancy, do this in another pr +led_eeconfig_t led_matrix_eeconfig; // TODO: would like to prefix this with g_ for global consistancy, do this in another pr uint32_t g_led_timer; #ifdef LED_MATRIX_FRAMEBUFFER_EFFECTS uint8_t g_led_frame_buffer[MATRIX_ROWS][MATRIX_COLS] = {{0}}; -#endif // LED_MATRIX_FRAMEBUFFER_EFFECTS +#endif // LED_MATRIX_FRAMEBUFFER_EFFECTS #ifdef LED_MATRIX_KEYREACTIVE_ENABLED last_hit_t g_last_hit_tracker; -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +#endif // LED_MATRIX_KEYREACTIVE_ENABLED // internals static bool suspend_state = false; @@ -105,13 +105,13 @@ static effect_params_t led_effect_params = {0, LED_FLAG_ALL, false}; static led_task_states led_task_state = SYNCING; #if LED_DISABLE_TIMEOUT > 0 static uint32_t led_anykey_timer; -#endif // LED_DISABLE_TIMEOUT > 0 +#endif // LED_DISABLE_TIMEOUT > 0 // double buffers static uint32_t led_timer_buffer; #ifdef LED_MATRIX_KEYREACTIVE_ENABLED static last_hit_t last_hit_buffer; -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +#endif // LED_MATRIX_KEYREACTIVE_ENABLED // split led matrix #if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) @@ -120,7 +120,9 @@ const uint8_t k_led_matrix_split[2] = LED_MATRIX_SPLIT; EECONFIG_DEBOUNCE_HELPER(led_matrix, EECONFIG_LED_MATRIX, led_matrix_eeconfig); -void eeconfig_update_led_matrix(void) { eeconfig_flush_led_matrix(true); } +void eeconfig_update_led_matrix(void) { + eeconfig_flush_led_matrix(true); +} void eeconfig_update_led_matrix_default(void) { dprintf("eeconfig_update_led_matrix_default\n"); @@ -141,7 +143,9 @@ void eeconfig_debug_led_matrix(void) { dprintf("led_matrix_eeconfig.flags = %d\n", led_matrix_eeconfig.flags); } -__attribute__((weak)) uint8_t led_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) { return 0; } +__attribute__((weak)) uint8_t led_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) { + return 0; +} uint8_t led_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i) { uint8_t led_count = led_matrix_map_row_column_to_led_kb(row, column, led_i); @@ -153,7 +157,9 @@ uint8_t led_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *l return led_count; } -void led_matrix_update_pwm_buffers(void) { led_matrix_driver.flush(); } +void led_matrix_update_pwm_buffers(void) { + led_matrix_driver.flush(); +} void led_matrix_set_value(int index, uint8_t value) { #ifdef USE_CIE1931_CURVE @@ -164,7 +170,8 @@ void led_matrix_set_value(int index, uint8_t value) { void led_matrix_set_value_all(uint8_t value) { #if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) - for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) led_matrix_set_value(i, value); + for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) + led_matrix_set_value(i, value); #else # ifdef USE_CIE1931_CURVE led_matrix_driver.set_value_all(pgm_read_byte(&CIE1931_CURVE[value])); @@ -180,7 +187,7 @@ void process_led_matrix(uint8_t row, uint8_t col, bool pressed) { #endif #if LED_DISABLE_TIMEOUT > 0 led_anykey_timer = 0; -#endif // LED_DISABLE_TIMEOUT > 0 +#endif // LED_DISABLE_TIMEOUT > 0 #ifdef LED_MATRIX_KEYREACTIVE_ENABLED uint8_t led[LED_HITS_TO_REMEMBER]; @@ -190,7 +197,7 @@ void process_led_matrix(uint8_t row, uint8_t col, bool pressed) { if (!pressed) # elif defined(LED_MATRIX_KEYPRESSES) if (pressed) -# endif // defined(LED_MATRIX_KEYRELEASES) +# endif // defined(LED_MATRIX_KEYRELEASES) { led_count = led_matrix_map_row_column_to_led(row, col, led); } @@ -198,7 +205,7 @@ void process_led_matrix(uint8_t row, uint8_t col, bool pressed) { if (last_hit_buffer.count + led_count > LED_HITS_TO_REMEMBER) { memcpy(&last_hit_buffer.x[0], &last_hit_buffer.x[led_count], LED_HITS_TO_REMEMBER - led_count); memcpy(&last_hit_buffer.y[0], &last_hit_buffer.y[led_count], LED_HITS_TO_REMEMBER - led_count); - memcpy(&last_hit_buffer.tick[0], &last_hit_buffer.tick[led_count], (LED_HITS_TO_REMEMBER - led_count) * 2); // 16 bit + memcpy(&last_hit_buffer.tick[0], &last_hit_buffer.tick[led_count], (LED_HITS_TO_REMEMBER - led_count) * 2); // 16 bit memcpy(&last_hit_buffer.index[0], &last_hit_buffer.index[led_count], LED_HITS_TO_REMEMBER - led_count); last_hit_buffer.count = LED_HITS_TO_REMEMBER - led_count; } @@ -211,13 +218,13 @@ void process_led_matrix(uint8_t row, uint8_t col, bool pressed) { last_hit_buffer.tick[index] = 0; last_hit_buffer.count++; } -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +#endif // LED_MATRIX_KEYREACTIVE_ENABLED #if defined(LED_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_LED_MATRIX_TYPING_HEATMAP) if (led_matrix_eeconfig.mode == LED_MATRIX_TYPING_HEATMAP) { process_led_matrix_typing_heatmap(row, col); } -#endif // defined(LED_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_LED_MATRIX_TYPING_HEATMAP) +#endif // defined(LED_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_LED_MATRIX_TYPING_HEATMAP) } static bool led_matrix_none(effect_params_t *params) { @@ -232,7 +239,7 @@ static bool led_matrix_none(effect_params_t *params) { static void led_task_timers(void) { #if defined(LED_MATRIX_KEYREACTIVE_ENABLED) || LED_DISABLE_TIMEOUT > 0 uint32_t deltaTime = sync_timer_elapsed32(led_timer_buffer); -#endif // defined(LED_MATRIX_KEYREACTIVE_ENABLED) || LED_DISABLE_TIMEOUT > 0 +#endif // defined(LED_MATRIX_KEYREACTIVE_ENABLED) || LED_DISABLE_TIMEOUT > 0 led_timer_buffer = sync_timer_read32(); // Update double buffer timers @@ -244,7 +251,7 @@ static void led_task_timers(void) { led_anykey_timer += deltaTime; } } -#endif // LED_DISABLE_TIMEOUT > 0 +#endif // LED_DISABLE_TIMEOUT > 0 // Update double buffer last hit timers #ifdef LED_MATRIX_KEYREACTIVE_ENABLED @@ -256,7 +263,7 @@ static void led_task_timers(void) { } last_hit_buffer.tick[i] += deltaTime; } -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +#endif // LED_MATRIX_KEYREACTIVE_ENABLED } static void led_task_sync(void) { @@ -273,7 +280,7 @@ static void led_task_start(void) { g_led_timer = led_timer_buffer; #ifdef LED_MATRIX_KEYREACTIVE_ENABLED g_last_hit_tracker = last_hit_buffer; -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +#endif // LED_MATRIX_KEYREACTIVE_ENABLED // next task led_task_state = RENDERING; @@ -352,7 +359,7 @@ void led_matrix_task(void) { bool suspend_backlight = suspend_state || #if LED_DISABLE_TIMEOUT > 0 (led_anykey_timer > (uint32_t)LED_DISABLE_TIMEOUT) || -#endif // LED_DISABLE_TIMEOUT > 0 +#endif // LED_DISABLE_TIMEOUT > 0 false; uint8_t effect = suspend_backlight || !led_matrix_eeconfig.enable ? 0 : led_matrix_eeconfig.mode; @@ -421,7 +428,7 @@ void led_matrix_init(void) { for (uint8_t i = 0; i < LED_HITS_TO_REMEMBER; ++i) { last_hit_buffer.tick[i] = UINT16_MAX; } -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +#endif // LED_MATRIX_KEYREACTIVE_ENABLED if (!eeconfig_is_enabled()) { dprintf("led_matrix_init_drivers eeconfig is not enabled.\n"); @@ -434,20 +441,22 @@ void led_matrix_init(void) { dprintf("led_matrix_init_drivers led_matrix_eeconfig.mode = 0. Write default values to EEPROM.\n"); eeconfig_update_led_matrix_default(); } - eeconfig_debug_led_matrix(); // display current eeprom values + eeconfig_debug_led_matrix(); // display current eeprom values } void led_matrix_set_suspend_state(bool state) { #ifdef LED_DISABLE_WHEN_USB_SUSPENDED - if (state && !suspend_state && is_keyboard_master()) { // only run if turning off, and only once - led_task_render(0); // turn off all LEDs when suspending - led_task_flush(0); // and actually flash led state to LEDs + if (state && !suspend_state && is_keyboard_master()) { // only run if turning off, and only once + led_task_render(0); // turn off all LEDs when suspending + led_task_flush(0); // and actually flash led state to LEDs } suspend_state = state; #endif } -bool led_matrix_get_suspend_state(void) { return suspend_state; } +bool led_matrix_get_suspend_state(void) { + return suspend_state; +} void led_matrix_toggle_eeprom_helper(bool write_to_eeprom) { led_matrix_eeconfig.enable ^= 1; @@ -455,8 +464,12 @@ void led_matrix_toggle_eeprom_helper(bool write_to_eeprom) { eeconfig_flag_led_matrix(write_to_eeprom); dprintf("led matrix toggle [%s]: led_matrix_eeconfig.enable = %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.enable); } -void led_matrix_toggle_noeeprom(void) { led_matrix_toggle_eeprom_helper(false); } -void led_matrix_toggle(void) { led_matrix_toggle_eeprom_helper(true); } +void led_matrix_toggle_noeeprom(void) { + led_matrix_toggle_eeprom_helper(false); +} +void led_matrix_toggle(void) { + led_matrix_toggle_eeprom_helper(true); +} void led_matrix_enable(void) { led_matrix_enable_noeeprom(); @@ -478,7 +491,9 @@ void led_matrix_disable_noeeprom(void) { led_matrix_eeconfig.enable = 0; } -uint8_t led_matrix_is_enabled(void) { return led_matrix_eeconfig.enable; } +uint8_t led_matrix_is_enabled(void) { + return led_matrix_eeconfig.enable; +} void led_matrix_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) { if (!led_matrix_eeconfig.enable) { @@ -495,24 +510,38 @@ void led_matrix_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) { eeconfig_flag_led_matrix(write_to_eeprom); dprintf("led matrix mode [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.mode); } -void led_matrix_mode_noeeprom(uint8_t mode) { led_matrix_mode_eeprom_helper(mode, false); } -void led_matrix_mode(uint8_t mode) { led_matrix_mode_eeprom_helper(mode, true); } +void led_matrix_mode_noeeprom(uint8_t mode) { + led_matrix_mode_eeprom_helper(mode, false); +} +void led_matrix_mode(uint8_t mode) { + led_matrix_mode_eeprom_helper(mode, true); +} -uint8_t led_matrix_get_mode(void) { return led_matrix_eeconfig.mode; } +uint8_t led_matrix_get_mode(void) { + return led_matrix_eeconfig.mode; +} void led_matrix_step_helper(bool write_to_eeprom) { uint8_t mode = led_matrix_eeconfig.mode + 1; led_matrix_mode_eeprom_helper((mode < LED_MATRIX_EFFECT_MAX) ? mode : 1, write_to_eeprom); } -void led_matrix_step_noeeprom(void) { led_matrix_step_helper(false); } -void led_matrix_step(void) { led_matrix_step_helper(true); } +void led_matrix_step_noeeprom(void) { + led_matrix_step_helper(false); +} +void led_matrix_step(void) { + led_matrix_step_helper(true); +} void led_matrix_step_reverse_helper(bool write_to_eeprom) { uint8_t mode = led_matrix_eeconfig.mode - 1; led_matrix_mode_eeprom_helper((mode < 1) ? LED_MATRIX_EFFECT_MAX - 1 : mode, write_to_eeprom); } -void led_matrix_step_reverse_noeeprom(void) { led_matrix_step_reverse_helper(false); } -void led_matrix_step_reverse(void) { led_matrix_step_reverse_helper(true); } +void led_matrix_step_reverse_noeeprom(void) { + led_matrix_step_reverse_helper(false); +} +void led_matrix_step_reverse(void) { + led_matrix_step_reverse_helper(true); +} void led_matrix_set_val_eeprom_helper(uint8_t val, bool write_to_eeprom) { if (!led_matrix_eeconfig.enable) { @@ -522,37 +551,77 @@ void led_matrix_set_val_eeprom_helper(uint8_t val, bool write_to_eeprom) { eeconfig_flag_led_matrix(write_to_eeprom); dprintf("led matrix set val [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.val); } -void led_matrix_set_val_noeeprom(uint8_t val) { led_matrix_set_val_eeprom_helper(val, false); } -void led_matrix_set_val(uint8_t val) { led_matrix_set_val_eeprom_helper(val, true); } +void led_matrix_set_val_noeeprom(uint8_t val) { + led_matrix_set_val_eeprom_helper(val, false); +} +void led_matrix_set_val(uint8_t val) { + led_matrix_set_val_eeprom_helper(val, true); +} -uint8_t led_matrix_get_val(void) { return led_matrix_eeconfig.val; } +uint8_t led_matrix_get_val(void) { + return led_matrix_eeconfig.val; +} -void led_matrix_increase_val_helper(bool write_to_eeprom) { led_matrix_set_val_eeprom_helper(qadd8(led_matrix_eeconfig.val, LED_MATRIX_VAL_STEP), write_to_eeprom); } -void led_matrix_increase_val_noeeprom(void) { led_matrix_increase_val_helper(false); } -void led_matrix_increase_val(void) { led_matrix_increase_val_helper(true); } +void led_matrix_increase_val_helper(bool write_to_eeprom) { + led_matrix_set_val_eeprom_helper(qadd8(led_matrix_eeconfig.val, LED_MATRIX_VAL_STEP), write_to_eeprom); +} +void led_matrix_increase_val_noeeprom(void) { + led_matrix_increase_val_helper(false); +} +void led_matrix_increase_val(void) { + led_matrix_increase_val_helper(true); +} -void led_matrix_decrease_val_helper(bool write_to_eeprom) { led_matrix_set_val_eeprom_helper(qsub8(led_matrix_eeconfig.val, LED_MATRIX_VAL_STEP), write_to_eeprom); } -void led_matrix_decrease_val_noeeprom(void) { led_matrix_decrease_val_helper(false); } -void led_matrix_decrease_val(void) { led_matrix_decrease_val_helper(true); } +void led_matrix_decrease_val_helper(bool write_to_eeprom) { + led_matrix_set_val_eeprom_helper(qsub8(led_matrix_eeconfig.val, LED_MATRIX_VAL_STEP), write_to_eeprom); +} +void led_matrix_decrease_val_noeeprom(void) { + led_matrix_decrease_val_helper(false); +} +void led_matrix_decrease_val(void) { + led_matrix_decrease_val_helper(true); +} void led_matrix_set_speed_eeprom_helper(uint8_t speed, bool write_to_eeprom) { led_matrix_eeconfig.speed = speed; eeconfig_flag_led_matrix(write_to_eeprom); dprintf("led matrix set speed [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.speed); } -void led_matrix_set_speed_noeeprom(uint8_t speed) { led_matrix_set_speed_eeprom_helper(speed, false); } -void led_matrix_set_speed(uint8_t speed) { led_matrix_set_speed_eeprom_helper(speed, true); } +void led_matrix_set_speed_noeeprom(uint8_t speed) { + led_matrix_set_speed_eeprom_helper(speed, false); +} +void led_matrix_set_speed(uint8_t speed) { + led_matrix_set_speed_eeprom_helper(speed, true); +} -uint8_t led_matrix_get_speed(void) { return led_matrix_eeconfig.speed; } +uint8_t led_matrix_get_speed(void) { + return led_matrix_eeconfig.speed; +} -void led_matrix_increase_speed_helper(bool write_to_eeprom) { led_matrix_set_speed_eeprom_helper(qadd8(led_matrix_eeconfig.speed, LED_MATRIX_SPD_STEP), write_to_eeprom); } -void led_matrix_increase_speed_noeeprom(void) { led_matrix_increase_speed_helper(false); } -void led_matrix_increase_speed(void) { led_matrix_increase_speed_helper(true); } +void led_matrix_increase_speed_helper(bool write_to_eeprom) { + led_matrix_set_speed_eeprom_helper(qadd8(led_matrix_eeconfig.speed, LED_MATRIX_SPD_STEP), write_to_eeprom); +} +void led_matrix_increase_speed_noeeprom(void) { + led_matrix_increase_speed_helper(false); +} +void led_matrix_increase_speed(void) { + led_matrix_increase_speed_helper(true); +} -void led_matrix_decrease_speed_helper(bool write_to_eeprom) { led_matrix_set_speed_eeprom_helper(qsub8(led_matrix_eeconfig.speed, LED_MATRIX_SPD_STEP), write_to_eeprom); } -void led_matrix_decrease_speed_noeeprom(void) { led_matrix_decrease_speed_helper(false); } -void led_matrix_decrease_speed(void) { led_matrix_decrease_speed_helper(true); } +void led_matrix_decrease_speed_helper(bool write_to_eeprom) { + led_matrix_set_speed_eeprom_helper(qsub8(led_matrix_eeconfig.speed, LED_MATRIX_SPD_STEP), write_to_eeprom); +} +void led_matrix_decrease_speed_noeeprom(void) { + led_matrix_decrease_speed_helper(false); +} +void led_matrix_decrease_speed(void) { + led_matrix_decrease_speed_helper(true); +} -led_flags_t led_matrix_get_flags(void) { return led_matrix_eeconfig.flags; } +led_flags_t led_matrix_get_flags(void) { + return led_matrix_eeconfig.flags; +} -void led_matrix_set_flags(led_flags_t flags) { led_matrix_eeconfig.flags = flags; } +void led_matrix_set_flags(led_flags_t flags) { + led_matrix_eeconfig.flags = flags; +} diff --git a/quantum/led_matrix/led_matrix_types.h b/quantum/led_matrix/led_matrix_types.h index 61cdbd9b8e..3dc533100f 100644 --- a/quantum/led_matrix/led_matrix_types.h +++ b/quantum/led_matrix/led_matrix_types.h @@ -36,7 +36,7 @@ // Last led hit #ifndef LED_HITS_TO_REMEMBER # define LED_HITS_TO_REMEMBER 8 -#endif // LED_HITS_TO_REMEMBER +#endif // LED_HITS_TO_REMEMBER #ifdef LED_MATRIX_KEYREACTIVE_ENABLED typedef struct PACKED { @@ -46,7 +46,7 @@ typedef struct PACKED { uint8_t index[LED_HITS_TO_REMEMBER]; uint16_t tick[LED_HITS_TO_REMEMBER]; } last_hit_t; -#endif // LED_MATRIX_KEYREACTIVE_ENABLED +#endif // LED_MATRIX_KEYREACTIVE_ENABLED typedef enum led_task_states { STARTING, RENDERING, FLUSHING, SYNCING } led_task_states; @@ -87,7 +87,7 @@ typedef union { uint8_t mode : 6; uint16_t reserved; uint8_t val; - uint8_t speed; // EECONFIG needs to be increased to support this + uint8_t speed; // EECONFIG needs to be increased to support this led_flags_t flags; }; } led_eeconfig_t; diff --git a/quantum/logging/debug.c b/quantum/logging/debug.c index ea62deaa8c..ca7654eda2 100644 --- a/quantum/logging/debug.c +++ b/quantum/logging/debug.c @@ -17,9 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "debug.h" debug_config_t debug_config = { - .enable = false, // - .matrix = false, // - .keyboard = false, // - .mouse = false, // - .reserved = 0 // + .enable = false, // + .matrix = false, // + .keyboard = false, // + .mouse = false, // + .reserved = 0 // }; diff --git a/quantum/logging/print.c b/quantum/logging/print.c index e8440e55ee..50a6b826ee 100644 --- a/quantum/logging/print.c +++ b/quantum/logging/print.c @@ -19,9 +19,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. // bind lib/printf to console interface - sendchar -static int8_t null_sendchar_func(uint8_t c) { return 0; } +static int8_t null_sendchar_func(uint8_t c) { + return 0; +} static sendchar_func_t func = null_sendchar_func; -void print_set_sendchar(sendchar_func_t send) { func = send; } +void print_set_sendchar(sendchar_func_t send) { + func = send; +} -void _putchar(char character) { func(character); } +void _putchar(char character) { + func(character); +} diff --git a/quantum/logging/print.h b/quantum/logging/print.h index 8c055f549e..aa72fc7074 100644 --- a/quantum/logging/print.h +++ b/quantum/logging/print.h @@ -37,7 +37,7 @@ void print_set_sendchar(sendchar_func_t func); # include_next "_print.h" /* Include the platforms print.h */ # else // Fall back to lib/printf -# include "printf.h" // lib/printf/printf.h +# include "printf.h" // lib/printf/printf.h // Create user & normal print defines # define print(s) printf(s) diff --git a/quantum/logging/sendchar.c b/quantum/logging/sendchar.c index 9422382f6f..5bc744b743 100644 --- a/quantum/logging/sendchar.c +++ b/quantum/logging/sendchar.c @@ -17,4 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "sendchar.h" /* default noop "null" implementation */ -__attribute__((weak)) int8_t sendchar(uint8_t c) { return 0; } +__attribute__((weak)) int8_t sendchar(uint8_t c) { + return 0; +} diff --git a/quantum/main.c b/quantum/main.c index 6ed6b95741..faba668056 100644 --- a/quantum/main.c +++ b/quantum/main.c @@ -45,7 +45,7 @@ void protocol_task(void) { #ifdef DEFERRED_EXEC_ENABLE void deferred_exec_task(void); -#endif // DEFERRED_EXEC_ENABLE +#endif // DEFERRED_EXEC_ENABLE /** \brief Main * @@ -66,7 +66,7 @@ int main(void) { #ifdef DEFERRED_EXEC_ENABLE // Run deferred executions deferred_exec_task(); -#endif // DEFERRED_EXEC_ENABLE +#endif // DEFERRED_EXEC_ENABLE housekeeping_task(); } diff --git a/quantum/matrix.c b/quantum/matrix.c index 0b16184e12..db59b73754 100644 --- a/quantum/matrix.c +++ b/quantum/matrix.c @@ -51,15 +51,15 @@ static SPLIT_MUTABLE pin_t direct_pins[ROWS_PER_HAND][MATRIX_COLS] = DIRECT_PINS #elif (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW) # ifdef MATRIX_ROW_PINS static SPLIT_MUTABLE_ROW pin_t row_pins[ROWS_PER_HAND] = MATRIX_ROW_PINS; -# endif // MATRIX_ROW_PINS +# endif // MATRIX_ROW_PINS # ifdef MATRIX_COL_PINS static SPLIT_MUTABLE_COL pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; -# endif // MATRIX_COL_PINS +# endif // MATRIX_COL_PINS #endif /* matrix state(1:on, 0:off) */ -extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values -extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values +extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values +extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values #ifdef SPLIT_KEYBOARD // row offsets for each hand @@ -86,7 +86,9 @@ static inline void setPinOutput_writeHigh(pin_t pin) { } static inline void setPinInputHigh_atomic(pin_t pin) { - ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); } + ATOMIC_BLOCK_FORCEON { + setPinInputHigh(pin); + } } static inline uint8_t readMatrixPin(pin_t pin) { @@ -171,8 +173,8 @@ __attribute__((weak)) void matrix_read_cols_on_row(matrix_row_t current_matrix[] // Start with a clear matrix row matrix_row_t current_row_value = 0; - if (!select_row(current_row)) { // Select row - return; // skip NO_PIN row + if (!select_row(current_row)) { // Select row + return; // skip NO_PIN row } matrix_output_select_delay(); @@ -187,7 +189,7 @@ __attribute__((weak)) void matrix_read_cols_on_row(matrix_row_t current_matrix[] // Unselect row unselect_row(current_row); - matrix_output_unselect_delay(current_row, current_row_value != 0); // wait for all Col signals to go HIGH + matrix_output_unselect_delay(current_row, current_row_value != 0); // wait for all Col signals to go HIGH // Update the matrix current_matrix[current_row] = current_row_value; @@ -234,8 +236,8 @@ __attribute__((weak)) void matrix_read_rows_on_col(matrix_row_t current_matrix[] bool key_pressed = false; // Select col - if (!select_col(current_col)) { // select col - return; // skip NO_PIN col + if (!select_col(current_col)) { // select col + return; // skip NO_PIN col } matrix_output_select_delay(); @@ -254,13 +256,13 @@ __attribute__((weak)) void matrix_read_rows_on_col(matrix_row_t current_matrix[] // Unselect col unselect_col(current_col); - matrix_output_unselect_delay(current_col, key_pressed); // wait for all Row signals to go HIGH + matrix_output_unselect_delay(current_col, key_pressed); // wait for all Row signals to go HIGH } # else # error DIODE_DIRECTION must be one of COL2ROW or ROW2COL! # endif -# endif // defined(MATRIX_ROW_PINS) && defined(MATRIX_COL_PINS) +# endif // defined(MATRIX_ROW_PINS) && defined(MATRIX_COL_PINS) #else # error DIODE_DIRECTION is not defined! #endif @@ -311,7 +313,7 @@ void matrix_init(void) { // Fallback implementation for keyboards not using the standard split_util.c __attribute__((weak)) bool transport_master_if_connected(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { transport_master(master_matrix, slave_matrix); - return true; // Treat the transport as always connected + return true; // Treat the transport as always connected } #endif diff --git a/quantum/matrix_common.c b/quantum/matrix_common.c index d67aaf508c..1497ceae71 100644 --- a/quantum/matrix_common.c +++ b/quantum/matrix_common.c @@ -33,9 +33,13 @@ extern const matrix_row_t matrix_mask[]; // user-defined overridable functions -__attribute__((weak)) void matrix_init_kb(void) { matrix_init_user(); } +__attribute__((weak)) void matrix_init_kb(void) { + matrix_init_user(); +} -__attribute__((weak)) void matrix_scan_kb(void) { matrix_scan_user(); } +__attribute__((weak)) void matrix_scan_kb(void) { + matrix_scan_user(); +} __attribute__((weak)) void matrix_init_user(void) {} @@ -43,11 +47,17 @@ __attribute__((weak)) void matrix_scan_user(void) {} // helper functions -inline uint8_t matrix_rows(void) { return MATRIX_ROWS; } +inline uint8_t matrix_rows(void) { + return MATRIX_ROWS; +} -inline uint8_t matrix_cols(void) { return MATRIX_COLS; } +inline uint8_t matrix_cols(void) { + return MATRIX_COLS; +} -inline bool matrix_is_on(uint8_t row, uint8_t col) { return (matrix[row] & ((matrix_row_t)1 << col)); } +inline bool matrix_is_on(uint8_t row, uint8_t col) { + return (matrix[row] & ((matrix_row_t)1 << col)); +} inline matrix_row_t matrix_get_row(uint8_t row) { // Matrix mask lets you disable switches in the returned matrix data. For example, if you have a @@ -124,16 +134,26 @@ bool matrix_post_scan(void) { #endif /* `matrix_io_delay ()` exists for backwards compatibility. From now on, use matrix_output_unselect_delay(). */ -__attribute__((weak)) void matrix_io_delay(void) { wait_us(MATRIX_IO_DELAY); } -__attribute__((weak)) void matrix_output_select_delay(void) { waitInputPinDelay(); } -__attribute__((weak)) void matrix_output_unselect_delay(uint8_t line, bool key_pressed) { matrix_io_delay(); } +__attribute__((weak)) void matrix_io_delay(void) { + wait_us(MATRIX_IO_DELAY); +} +__attribute__((weak)) void matrix_output_select_delay(void) { + waitInputPinDelay(); +} +__attribute__((weak)) void matrix_output_unselect_delay(uint8_t line, bool key_pressed) { + matrix_io_delay(); +} // CUSTOM MATRIX 'LITE' __attribute__((weak)) void matrix_init_custom(void) {} -__attribute__((weak)) bool matrix_scan_custom(matrix_row_t current_matrix[]) { return true; } +__attribute__((weak)) bool matrix_scan_custom(matrix_row_t current_matrix[]) { + return true; +} #ifdef SPLIT_KEYBOARD -__attribute__((weak)) void matrix_slave_scan_kb(void) { matrix_slave_scan_user(); } +__attribute__((weak)) void matrix_slave_scan_kb(void) { + matrix_slave_scan_user(); +} __attribute__((weak)) void matrix_slave_scan_user(void) {} #endif @@ -170,4 +190,6 @@ __attribute__((weak)) uint8_t matrix_scan(void) { return changed; } -__attribute__((weak)) bool peek_matrix(uint8_t row_index, uint8_t col_index, bool raw) { return 0 != ((raw ? raw_matrix[row_index] : matrix[row_index]) & (MATRIX_ROW_SHIFTER << col_index)); } +__attribute__((weak)) bool peek_matrix(uint8_t row_index, uint8_t col_index, bool raw) { + return 0 != ((raw ? raw_matrix[row_index] : matrix[row_index]) & (MATRIX_ROW_SHIFTER << col_index)); +} diff --git a/quantum/mousekey.c b/quantum/mousekey.c index c2291fb397..8bafbf977a 100644 --- a/quantum/mousekey.c +++ b/quantum/mousekey.c @@ -487,4 +487,6 @@ static void mousekey_debug(void) { print(")\n"); } -report_mouse_t mousekey_get_report(void) { return mouse_report; } +report_mouse_t mousekey_get_report(void) { + return mouse_report; +} diff --git a/quantum/pointing_device.c b/quantum/pointing_device.c index cce292e0bf..9627cab4b8 100644 --- a/quantum/pointing_device.c +++ b/quantum/pointing_device.c @@ -39,7 +39,9 @@ uint16_t shared_cpi = 0; * * @param[in] new_mouse_report report_mouse_t */ -void pointing_device_set_shared_report(report_mouse_t new_mouse_report) { shared_mouse_report = new_mouse_report; } +void pointing_device_set_shared_report(report_mouse_t new_mouse_report) { + shared_mouse_report = new_mouse_report; +} /** * @brief Gets current pointing device CPI if supported @@ -50,7 +52,9 @@ void pointing_device_set_shared_report(report_mouse_t new_mouse_report) { shared * * @return cpi value as uint16_t */ -uint16_t pointing_device_get_shared_cpi(void) { return shared_cpi; } +uint16_t pointing_device_get_shared_cpi(void) { + return shared_cpi; +} # if defined(POINTING_DEVICE_LEFT) # define POINTING_DEVICE_THIS_SIDE is_keyboard_left() @@ -60,7 +64,7 @@ uint16_t pointing_device_get_shared_cpi(void) { return shared_cpi; } # define POINTING_DEVICE_THIS_SIDE true # endif -#endif // defined(SPLIT_POINTING_ENABLE) +#endif // defined(SPLIT_POINTING_ENABLE) static report_mouse_t local_mouse_report = {}; @@ -73,7 +77,9 @@ extern const pointing_device_driver_t pointing_device_driver; * @param[in] old report_mouse_t * @return bool result */ -__attribute__((weak)) bool has_mouse_report_changed(report_mouse_t new, report_mouse_t old) { return memcmp(&new, &old, sizeof(new)); } +__attribute__((weak)) bool has_mouse_report_changed(report_mouse_t new, report_mouse_t old) { + return memcmp(&new, &old, sizeof(new)); +} /** * @brief Keyboard level code pointing device initialisation @@ -95,7 +101,9 @@ __attribute__((weak)) void pointing_device_init_user(void) {} * @param[in] mouse_report report_mouse_t * @return report_mouse_t */ -__attribute__((weak)) report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { return pointing_device_task_user(mouse_report); } +__attribute__((weak)) report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { + return pointing_device_task_user(mouse_report); +} /** * @brief Weak function allowing for user level mouse report modification @@ -105,7 +113,9 @@ __attribute__((weak)) report_mouse_t pointing_device_task_kb(report_mouse_t mous * @param[in] mouse_report report_mouse_t * @return report_mouse_t */ -__attribute__((weak)) report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { return mouse_report; } +__attribute__((weak)) report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { + return mouse_report; +} /** * @brief Handles pointing device buttons @@ -246,7 +256,7 @@ __attribute__((weak)) void pointing_device_task(void) { # endif #else local_mouse_report = pointing_device_driver.get_report(local_mouse_report); -#endif // defined(SPLIT_POINTING_ENABLE) +#endif // defined(SPLIT_POINTING_ENABLE) // allow kb to intercept and modify report #if defined(SPLIT_POINTING_ENABLE) && defined(POINTING_DEVICE_COMBINED) @@ -275,14 +285,18 @@ __attribute__((weak)) void pointing_device_task(void) { * * @return report_mouse_t */ -report_mouse_t pointing_device_get_report(void) { return local_mouse_report; } +report_mouse_t pointing_device_get_report(void) { + return local_mouse_report; +} /** * @brief Sets mouse report used be pointing device task * * @param[in] new_mouse_report */ -void pointing_device_set_report(report_mouse_t new_mouse_report) { local_mouse_report = new_mouse_report; } +void pointing_device_set_report(report_mouse_t new_mouse_report) { + local_mouse_report = new_mouse_report; +} /** * @brief Gets current pointing device CPI if supported @@ -422,7 +436,9 @@ report_mouse_t pointing_device_adjust_by_defines_right(report_mouse_t mouse_repo * @param[in] right_report report_mouse_t * @return pointing_device_task_combined_user(left_report, right_report) by default */ -__attribute__((weak)) report_mouse_t pointing_device_task_combined_kb(report_mouse_t left_report, report_mouse_t right_report) { return pointing_device_task_combined_user(left_report, right_report); } +__attribute__((weak)) report_mouse_t pointing_device_task_combined_kb(report_mouse_t left_report, report_mouse_t right_report) { + return pointing_device_task_combined_user(left_report, right_report); +} /** * @brief Weak function allowing for user level mouse report modification @@ -435,5 +451,7 @@ __attribute__((weak)) report_mouse_t pointing_device_task_combined_kb(report_mou * @param[in] right_report report_mouse_t * @return pointing_device_combine_reports(left_report, right_report) by default */ -__attribute__((weak)) report_mouse_t pointing_device_task_combined_user(report_mouse_t left_report, report_mouse_t right_report) { return pointing_device_combine_reports(left_report, right_report); } +__attribute__((weak)) report_mouse_t pointing_device_task_combined_user(report_mouse_t left_report, report_mouse_t right_report) { + return pointing_device_combine_reports(left_report, right_report); +} #endif diff --git a/quantum/pointing_device.h b/quantum/pointing_device.h index 8394c20952..5f3845227a 100644 --- a/quantum/pointing_device.h +++ b/quantum/pointing_device.h @@ -103,5 +103,5 @@ report_mouse_t pointing_device_combine_reports(report_mouse_t left_report, repor report_mouse_t pointing_device_task_combined_kb(report_mouse_t left_report, report_mouse_t right_report); report_mouse_t pointing_device_task_combined_user(report_mouse_t left_report, report_mouse_t right_report); report_mouse_t pointing_device_adjust_by_defines_right(report_mouse_t mouse_report); -# endif // defined(POINTING_DEVICE_COMBINED) -#endif // defined(SPLIT_POINTING_ENABLE) +# endif // defined(POINTING_DEVICE_COMBINED) +#endif // defined(SPLIT_POINTING_ENABLE) diff --git a/quantum/pointing_device_drivers.c b/quantum/pointing_device_drivers.c index 7702958f88..b8ef6e67e5 100644 --- a/quantum/pointing_device_drivers.c +++ b/quantum/pointing_device_drivers.c @@ -120,7 +120,7 @@ report_mouse_t cirque_pinnacle_get_report(report_mouse_t mouse_report) { int8_t report_x = 0, report_y = 0; static bool is_z_down = false; - cirque_pinnacle_scale_data(&touchData, cirque_pinnacle_get_scale(), cirque_pinnacle_get_scale()); // Scale coordinates to arbitrary X, Y resolution + cirque_pinnacle_scale_data(&touchData, cirque_pinnacle_get_scale(), cirque_pinnacle_get_scale()); // Scale coordinates to arbitrary X, Y resolution if (x && y && touchData.xValue && touchData.yValue) { report_x = (int8_t)(touchData.xValue - x); @@ -207,11 +207,13 @@ const pointing_device_driver_t pointing_device_driver = { }; // clang-format on #elif defined(POINTING_DEVICE_DRIVER_pmw3360) -static void pmw3360_device_init(void) { pmw3360_init(); } +static void pmw3360_device_init(void) { + pmw3360_init(); +} report_mouse_t pmw3360_get_report(report_mouse_t mouse_report) { report_pmw3360_t data = pmw3360_read_burst(); - static uint16_t MotionStart = 0; // Timer for accel, 0 is resting state + static uint16_t MotionStart = 0; // Timer for accel, 0 is resting state if (data.isOnSurface && data.isMotion) { // Reset timer if stopped moving @@ -243,11 +245,13 @@ const pointing_device_driver_t pointing_device_driver = { }; // clang-format on #elif defined(POINTING_DEVICE_DRIVER_pmw3389) -static void pmw3389_device_init(void) { pmw3389_init(); } +static void pmw3389_device_init(void) { + pmw3389_init(); +} report_mouse_t pmw3389_get_report(report_mouse_t mouse_report) { report_pmw3389_t data = pmw3389_read_burst(); - static uint16_t MotionStart = 0; // Timer for accel, 0 is resting state + static uint16_t MotionStart = 0; // Timer for accel, 0 is resting state if (data.isOnSurface && data.isMotion) { // Reset timer if stopped moving @@ -280,9 +284,13 @@ const pointing_device_driver_t pointing_device_driver = { // clang-format on #else __attribute__((weak)) void pointing_device_driver_init(void) {} -__attribute__((weak)) report_mouse_t pointing_device_driver_get_report(report_mouse_t mouse_report) { return mouse_report; } -__attribute__((weak)) uint16_t pointing_device_driver_get_cpi(void) { return 0; } -__attribute__((weak)) void pointing_device_driver_set_cpi(uint16_t cpi) {} +__attribute__((weak)) report_mouse_t pointing_device_driver_get_report(report_mouse_t mouse_report) { + return mouse_report; +} +__attribute__((weak)) uint16_t pointing_device_driver_get_cpi(void) { + return 0; +} +__attribute__((weak)) void pointing_device_driver_set_cpi(uint16_t cpi) {} // clang-format off const pointing_device_driver_t pointing_device_driver = { 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; +} void enable_printing() { printing_enabled = true; @@ -39,7 +47,9 @@ void enable_printing() { serial_high(); } -void disable_printing() { printing_enabled = false; } +void disable_printing() { + printing_enabled = false; +} uint8_t shifted_numbers[10] = {0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, 0x26, 0x2A, 0x28, 0x29}; @@ -61,7 +71,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]); } bool process_printer(uint16_t keycode, keyrecord_t *record) { diff --git a/quantum/process_keycode/process_steno.c b/quantum/process_keycode/process_steno.c index 5d0bb313b4..12ee898212 100644 --- a/quantum/process_keycode/process_steno.c +++ b/quantum/process_keycode/process_steno.c @@ -102,11 +102,17 @@ void steno_set_mode(steno_mode_t new_mode) { /* override to intercept chords right before they get sent. * return zero to suppress normal sending behavior. */ -__attribute__((weak)) bool send_steno_chord_user(steno_mode_t mode, uint8_t chord[6]) { return true; } +__attribute__((weak)) bool send_steno_chord_user(steno_mode_t mode, uint8_t chord[6]) { + return true; +} -__attribute__((weak)) bool postprocess_steno_user(uint16_t keycode, keyrecord_t *record, steno_mode_t mode, uint8_t chord[6], int8_t pressed) { return true; } +__attribute__((weak)) bool postprocess_steno_user(uint16_t keycode, keyrecord_t *record, steno_mode_t mode, uint8_t chord[6], int8_t pressed) { + return true; +} -__attribute__((weak)) bool process_steno_user(uint16_t keycode, keyrecord_t *record) { return true; } +__attribute__((weak)) bool process_steno_user(uint16_t keycode, keyrecord_t *record) { + return true; +} static void send_steno_chord(void) { if (send_steno_chord_user(mode, chord)) { @@ -114,11 +120,11 @@ static void send_steno_chord(void) { case STENO_MODE_BOLT: send_steno_state(BOLT_STATE_SIZE, false); #ifdef VIRTSER_ENABLE - virtser_send(0); // terminating byte + virtser_send(0); // terminating byte #endif break; case STENO_MODE_GEMINI: - chord[0] |= 0x80; // Indicate start of packet + chord[0] |= 0x80; // Indicate start of packet send_steno_state(GEMINI_STATE_SIZE, true); break; } @@ -126,9 +132,13 @@ static void send_steno_chord(void) { steno_clear_state(); } -uint8_t *steno_get_state(void) { return &state[0]; } +uint8_t *steno_get_state(void) { + return &state[0]; +} -uint8_t *steno_get_chord(void) { return &chord[0]; } +uint8_t *steno_get_chord(void) { + return &chord[0]; +} static bool update_state_bolt(uint8_t key, bool press) { uint8_t boltcode = pgm_read_byte(boltmap + key); diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index 035c9c265d..e99119b2ae 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c @@ -86,7 +86,9 @@ static inline void _process_tap_dance_action_fn(qk_tap_dance_state_t *state, voi } } -static inline void process_tap_dance_action_on_each_tap(qk_tap_dance_action_t *action) { _process_tap_dance_action_fn(&action->state, action->user_data, action->fn.on_each_tap); } +static inline void process_tap_dance_action_on_each_tap(qk_tap_dance_action_t *action) { + _process_tap_dance_action_fn(&action->state, action->user_data, action->fn.on_each_tap); +} static inline void process_tap_dance_action_on_dance_finished(qk_tap_dance_action_t *action) { if (action->state.finished) return; diff --git a/quantum/process_keycode/process_terminal.c b/quantum/process_keycode/process_terminal.c index a059f3a521..da1c4d506f 100644 --- a/quantum/process_keycode/process_terminal.c +++ b/quantum/process_keycode/process_terminal.c @@ -27,12 +27,12 @@ bool terminal_enabled = false; char buffer[80] = ""; char cmd_buffer[CMD_BUFF_SIZE][80]; -bool cmd_buffer_enabled = true; // replace with ifdef? +bool cmd_buffer_enabled = true; // replace with ifdef? char newline[2] = "\n"; char arguments[6][20]; bool firstTime = true; -short int current_cmd_buffer_pos = 0; // used for up/down arrows - keeps track of where you are in the command buffer +short int current_cmd_buffer_pos = 0; // used for up/down arrows - keeps track of where you are in the command buffer __attribute__((weak)) const char terminal_prompt[8] = "> "; @@ -59,7 +59,8 @@ void enable_terminal(void) { terminal_enabled = true; strcpy(buffer, ""); memset(cmd_buffer, 0, CMD_BUFF_SIZE * 80); - for (int i = 0; i < 6; i++) strcpy(arguments[i], ""); + for (int i = 0; i < 6; i++) + strcpy(arguments[i], ""); // select all text to start over // SEND_STRING(SS_LCTL("a")); send_string(terminal_prompt); @@ -160,7 +161,7 @@ void print_cmd_buff(void) { for (int i = 0; i < CMD_BUFF_SIZE; i++) { char tmpChar = ' '; itoa(i, &tmpChar, 10); - const char *tmpCnstCharStr = &tmpChar; // because sned_string wont take a normal char * + const char *tmpCnstCharStr = &tmpChar; // because sned_string wont take a normal char * send_string(tmpCnstCharStr); SEND_STRING(". "); send_string(cmd_buffer[i]); @@ -185,7 +186,7 @@ void terminal_help(void) { } void command_not_found(void) { - wait_ms(50); // sometimes buffer isnt grabbed quick enough + wait_ms(50); // sometimes buffer isnt grabbed quick enough SEND_STRING("command \""); send_string(buffer); SEND_STRING("\" not found\n"); @@ -217,15 +218,16 @@ void process_terminal_command(void) { if (terminal_enabled) { strcpy(buffer, ""); - for (int i = 0; i < 6; i++) strcpy(arguments[i], ""); + for (int i = 0; i < 6; i++) + strcpy(arguments[i], ""); SEND_STRING(SS_TAP(X_HOME)); send_string(terminal_prompt); } } void check_pos(void) { - if (current_cmd_buffer_pos >= CMD_BUFF_SIZE) { // if over the top, move it back down to the top of the buffer so you can climb back down... + if (current_cmd_buffer_pos >= CMD_BUFF_SIZE) { // if over the top, move it back down to the top of the buffer so you can climb back down... current_cmd_buffer_pos = CMD_BUFF_SIZE - 1; - } else if (current_cmd_buffer_pos < 0) { //...and if you fall under the bottom of the buffer, reset back to 0 so you can climb back up + } else if (current_cmd_buffer_pos < 0) { //...and if you fall under the bottom of the buffer, reset back to 0 so you can climb back up current_cmd_buffer_pos = 0; } } @@ -278,33 +280,33 @@ bool process_terminal(uint16_t keycode, keyrecord_t *record) { case KC_RIGHT: return false; break; - case KC_UP: // 0 = recent - check_pos(); // check our current buffer position is valid - if (current_cmd_buffer_pos <= CMD_BUFF_SIZE - 1) { // once we get to the top, dont do anything + case KC_UP: // 0 = recent + check_pos(); // check our current buffer position is valid + if (current_cmd_buffer_pos <= CMD_BUFF_SIZE - 1) { // once we get to the top, dont do anything str_len = strlen(buffer); for (int i = 0; i < str_len; ++i) { - send_string(SS_TAP(X_BSPACE)); // clear w/e is on the line already + send_string(SS_TAP(X_BSPACE)); // clear w/e is on the line already // process_terminal(KC_BACKSPACE,record); } strncpy(buffer, cmd_buffer[current_cmd_buffer_pos], 80); send_string(buffer); - ++current_cmd_buffer_pos; // get ready to access the above cmd if up/down is pressed again + ++current_cmd_buffer_pos; // get ready to access the above cmd if up/down is pressed again } return false; break; case KC_DOWN: check_pos(); - if (current_cmd_buffer_pos >= 0) { // once we get to the bottom, dont do anything + if (current_cmd_buffer_pos >= 0) { // once we get to the bottom, dont do anything str_len = strlen(buffer); for (int i = 0; i < str_len; ++i) { - send_string(SS_TAP(X_BSPACE)); // clear w/e is on the line already + send_string(SS_TAP(X_BSPACE)); // clear w/e is on the line already // process_terminal(KC_BACKSPACE,record); } strncpy(buffer, cmd_buffer[current_cmd_buffer_pos], 79); send_string(buffer); - --current_cmd_buffer_pos; // get ready to access the above cmd if down/up is pressed again + --current_cmd_buffer_pos; // get ready to access the above cmd if down/up is pressed again } return false; break; diff --git a/quantum/process_keycode/process_ucis.c b/quantum/process_keycode/process_ucis.c index d084d2b66c..6a8d8f0ff6 100644 --- a/quantum/process_keycode/process_ucis.c +++ b/quantum/process_keycode/process_ucis.c @@ -27,7 +27,7 @@ void qk_ucis_start(void) { __attribute__((weak)) void qk_ucis_start_user(void) { unicode_input_start(); - register_hex(0x2328); // ⌨ + register_hex(0x2328); // ⌨ unicode_input_finish(); } diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c index 7685bb1c99..46b77e14ba 100644 --- a/quantum/process_keycode/process_unicode_common.c +++ b/quantum/process_keycode/process_unicode_common.c @@ -54,7 +54,9 @@ void unicode_input_mode_init(void) { dprintf("Unicode input mode init to: %u\n", unicode_config.input_mode); } -uint8_t get_unicode_input_mode(void) { return unicode_config.input_mode; } +uint8_t get_unicode_input_mode(void) { + return unicode_config.input_mode; +} void set_unicode_input_mode(uint8_t mode) { unicode_config.input_mode = mode; @@ -76,7 +78,9 @@ void cycle_unicode_input_mode(int8_t offset) { #endif } -void persist_unicode_input_mode(void) { eeprom_update_byte(EECONFIG_UNICODEMODE, unicode_config.input_mode); } +void persist_unicode_input_mode(void) { + eeprom_update_byte(EECONFIG_UNICODEMODE, unicode_config.input_mode); +} __attribute__((weak)) void unicode_input_start(void) { unicode_saved_caps_lock = host_keyboard_led_state().caps_lock; @@ -90,8 +94,8 @@ __attribute__((weak)) void unicode_input_start(void) { tap_code(KC_CAPS_LOCK); } - unicode_saved_mods = get_mods(); // Save current mods - clear_mods(); // Unregister mods to start from a clean state + unicode_saved_mods = get_mods(); // Save current mods + clear_mods(); // Unregister mods to start from a clean state switch (unicode_config.input_mode) { case UC_MAC: @@ -140,7 +144,7 @@ __attribute__((weak)) void unicode_input_finish(void) { break; } - set_mods(unicode_saved_mods); // Reregister previously set mods + set_mods(unicode_saved_mods); // Reregister previously set mods } __attribute__((weak)) void unicode_input_cancel(void) { @@ -165,7 +169,7 @@ __attribute__((weak)) void unicode_input_cancel(void) { break; } - set_mods(unicode_saved_mods); // Reregister previously set mods + set_mods(unicode_saved_mods); // Reregister previously set mods } // clang-format off @@ -262,16 +266,16 @@ void send_unicode_hex_string(const char *str) { static const char *decode_utf8(const char *str, int32_t *code_point) { const char *next; - if (str[0] < 0x80) { // U+0000-007F + if (str[0] < 0x80) { // U+0000-007F *code_point = str[0]; next = str + 1; - } else if ((str[0] & 0xE0) == 0xC0) { // U+0080-07FF + } else if ((str[0] & 0xE0) == 0xC0) { // U+0080-07FF *code_point = ((int32_t)(str[0] & 0x1F) << 6) | ((int32_t)(str[1] & 0x3F) << 0); next = str + 2; - } else if ((str[0] & 0xF0) == 0xE0) { // U+0800-FFFF + } else if ((str[0] & 0xF0) == 0xE0) { // U+0800-FFFF *code_point = ((int32_t)(str[0] & 0x0F) << 12) | ((int32_t)(str[1] & 0x3F) << 6) | ((int32_t)(str[2] & 0x3F) << 0); next = str + 3; - } else if ((str[0] & 0xF8) == 0xF0 && (str[0] <= 0xF4)) { // U+10000-10FFFF + } else if ((str[0] & 0xF8) == 0xF0 && (str[0] <= 0xF4)) { // U+10000-10FFFF *code_point = ((int32_t)(str[0] & 0x07) << 18) | ((int32_t)(str[1] & 0x3F) << 12) | ((int32_t)(str[2] & 0x3F) << 6) | ((int32_t)(str[3] & 0x3F) << 0); next = str + 4; } else { diff --git a/quantum/process_keycode/process_unicode_common.h b/quantum/process_keycode/process_unicode_common.h index 72defb445e..1a6607c757 100644 --- a/quantum/process_keycode/process_unicode_common.h +++ b/quantum/process_keycode/process_unicode_common.h @@ -59,12 +59,12 @@ #define UC_OSX UC_MAC enum unicode_input_modes { - UC_MAC, // macOS using Unicode Hex Input - UC_LNX, // Linux using IBus - UC_WIN, // Windows using EnableHexNumpad - UC_BSD, // BSD (not implemented) - UC_WINC, // Windows using WinCompose (https://github.com/samhocevar/wincompose) - UC__COUNT // Number of available input modes (always leave at the end) + UC_MAC, // macOS using Unicode Hex Input + UC_LNX, // Linux using IBus + UC_WIN, // Windows using EnableHexNumpad + UC_BSD, // BSD (not implemented) + UC_WINC, // Windows using WinCompose (https://github.com/samhocevar/wincompose) + UC__COUNT // Number of available input modes (always leave at the end) }; typedef union { diff --git a/quantum/programmable_button.c b/quantum/programmable_button.c index be828fd17c..a3ef42d82b 100644 --- a/quantum/programmable_button.c +++ b/quantum/programmable_button.c @@ -22,16 +22,30 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. static uint32_t programmable_button_report = 0; -void programmable_button_clear(void) { programmable_button_report = 0; } +void programmable_button_clear(void) { + programmable_button_report = 0; +} -void programmable_button_send(void) { host_programmable_button_send(programmable_button_report); } +void programmable_button_send(void) { + host_programmable_button_send(programmable_button_report); +} -void programmable_button_on(uint8_t index) { programmable_button_report |= REPORT_BIT(index); } +void programmable_button_on(uint8_t index) { + programmable_button_report |= REPORT_BIT(index); +} -void programmable_button_off(uint8_t index) { programmable_button_report &= ~REPORT_BIT(index); } +void programmable_button_off(uint8_t index) { + programmable_button_report &= ~REPORT_BIT(index); +} -bool programmable_button_is_on(uint8_t index) { return !!(programmable_button_report & REPORT_BIT(index)); }; +bool programmable_button_is_on(uint8_t index) { + return !!(programmable_button_report & REPORT_BIT(index)); +}; -uint32_t programmable_button_get_report(void) { return programmable_button_report; }; +uint32_t programmable_button_get_report(void) { + return programmable_button_report; +}; -void programmable_button_set_report(uint32_t report) { programmable_button_report = report; } +void programmable_button_set_report(uint32_t report) { + programmable_button_report = report; +} diff --git a/quantum/quantum.c b/quantum/quantum.c index fb6220efa2..dce41c08ae 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -56,7 +56,7 @@ uint8_t extract_mod_bits(uint16_t code) { uint8_t mods_to_send = 0; - if (code & QK_RMODS_MIN) { // Right mod flag is set + if (code & QK_RMODS_MIN) { // Right mod flag is set if (code & QK_LCTL) mods_to_send |= MOD_BIT(KC_RIGHT_CTRL); if (code & QK_LSFT) mods_to_send |= MOD_BIT(KC_RIGHT_SHIFT); if (code & QK_LALT) mods_to_send |= MOD_BIT(KC_RIGHT_ALT); @@ -71,7 +71,9 @@ uint8_t extract_mod_bits(uint16_t code) { return mods_to_send; } -void do_code16(uint16_t code, void (*f)(uint8_t)) { f(extract_mod_bits(code)); } +void do_code16(uint16_t code, void (*f)(uint8_t)) { + f(extract_mod_bits(code)); +} __attribute__((weak)) void register_code16(uint16_t code) { if (IS_MOD(code) || code == KC_NO) { @@ -101,13 +103,21 @@ __attribute__((weak)) void tap_code16(uint16_t code) { unregister_code16(code); } -__attribute__((weak)) bool process_action_kb(keyrecord_t *record) { return true; } +__attribute__((weak)) bool process_action_kb(keyrecord_t *record) { + return true; +} -__attribute__((weak)) bool process_record_kb(uint16_t keycode, keyrecord_t *record) { return process_record_user(keycode, record); } +__attribute__((weak)) bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + return process_record_user(keycode, record); +} -__attribute__((weak)) bool process_record_user(uint16_t keycode, keyrecord_t *record) { return true; } +__attribute__((weak)) bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} -__attribute__((weak)) void post_process_record_kb(uint16_t keycode, keyrecord_t *record) { post_process_record_user(keycode, record); } +__attribute__((weak)) void post_process_record_kb(uint16_t keycode, keyrecord_t *record) { + post_process_record_user(keycode, record); +} __attribute__((weak)) void post_process_record_user(uint16_t keycode, keyrecord_t *record) {} @@ -123,7 +133,8 @@ void reset_keyboard(void) { uint16_t timer_start = timer_read(); PLAY_SONG(goodbye_song); shutdown_user(); - while (timer_elapsed(timer_start) < 250) wait_ms(1); + while (timer_elapsed(timer_start) < 250) + wait_ms(1); stop_all_notes(); #else shutdown_user(); @@ -178,7 +189,7 @@ bool pre_process_record_quantum(keyrecord_t *record) { true)) { return false; } - return true; // continue processing + return true; // continue processing } /* Get keycode, and then call keyboard function */ @@ -367,11 +378,17 @@ layer_state_t update_tri_layer_state(layer_state_t state, uint8_t layer1, uint8_ return (state & mask12) == mask12 ? (state | mask3) : (state & ~mask3); } -void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) { layer_state_set(update_tri_layer_state(layer_state, layer1, layer2, layer3)); } +void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) { + layer_state_set(update_tri_layer_state(layer_state, layer1, layer2, layer3)); +} // TODO: remove legacy api -void matrix_init_quantum() { matrix_init_kb(); } -void matrix_scan_quantum() { matrix_scan_kb(); } +void matrix_init_quantum() { + matrix_init_kb(); +} +void matrix_scan_quantum() { + matrix_scan_kb(); +} //------------------------------------------------------------------------------ // Override these functions in your keymap file to play different tunes on diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index b5b3566786..2552c48165 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h @@ -77,421 +77,421 @@ enum quantum_keycodes { // Loose keycodes - to be used directly QK_BOOTLOADER = 0x5C00, - QK_DEBUG_TOGGLE, // 5C01 + QK_DEBUG_TOGGLE, // 5C01 // Magic - MAGIC_SWAP_CONTROL_CAPSLOCK, // 5C02 - MAGIC_CAPSLOCK_TO_CONTROL, // 5C03 - MAGIC_SWAP_LALT_LGUI, // 5C04 - MAGIC_SWAP_RALT_RGUI, // 5C05 - MAGIC_NO_GUI, // 5C06 - MAGIC_SWAP_GRAVE_ESC, // 5C07 - MAGIC_SWAP_BACKSLASH_BACKSPACE, // 5C08 - MAGIC_HOST_NKRO, // 5C09 - MAGIC_SWAP_ALT_GUI, // 5C0A - MAGIC_UNSWAP_CONTROL_CAPSLOCK, // 5C0B - MAGIC_UNCAPSLOCK_TO_CONTROL, // 5C0C - MAGIC_UNSWAP_LALT_LGUI, // 5C0D - MAGIC_UNSWAP_RALT_RGUI, // 5C0E - MAGIC_UNNO_GUI, // 5C0F - MAGIC_UNSWAP_GRAVE_ESC, // 5C10 - MAGIC_UNSWAP_BACKSLASH_BACKSPACE, // 5C11 - MAGIC_UNHOST_NKRO, // 5C12 - MAGIC_UNSWAP_ALT_GUI, // 5C13 - MAGIC_TOGGLE_NKRO, // 5C14 - MAGIC_TOGGLE_ALT_GUI, // 5C15 + MAGIC_SWAP_CONTROL_CAPSLOCK, // 5C02 + MAGIC_CAPSLOCK_TO_CONTROL, // 5C03 + MAGIC_SWAP_LALT_LGUI, // 5C04 + MAGIC_SWAP_RALT_RGUI, // 5C05 + MAGIC_NO_GUI, // 5C06 + MAGIC_SWAP_GRAVE_ESC, // 5C07 + MAGIC_SWAP_BACKSLASH_BACKSPACE, // 5C08 + MAGIC_HOST_NKRO, // 5C09 + MAGIC_SWAP_ALT_GUI, // 5C0A + MAGIC_UNSWAP_CONTROL_CAPSLOCK, // 5C0B + MAGIC_UNCAPSLOCK_TO_CONTROL, // 5C0C + MAGIC_UNSWAP_LALT_LGUI, // 5C0D + MAGIC_UNSWAP_RALT_RGUI, // 5C0E + MAGIC_UNNO_GUI, // 5C0F + MAGIC_UNSWAP_GRAVE_ESC, // 5C10 + MAGIC_UNSWAP_BACKSLASH_BACKSPACE, // 5C11 + MAGIC_UNHOST_NKRO, // 5C12 + MAGIC_UNSWAP_ALT_GUI, // 5C13 + MAGIC_TOGGLE_NKRO, // 5C14 + MAGIC_TOGGLE_ALT_GUI, // 5C15 // Grave Escape - QK_GRAVE_ESCAPE, // 5C16 + QK_GRAVE_ESCAPE, // 5C16 // Auto Shift - KC_ASUP, // 5C17 - KC_ASDN, // 5C18 - KC_ASRP, // 5C19 - KC_ASTG, // 5C1A - KC_ASON, // 5C1B - KC_ASOFF, // 5C1C + KC_ASUP, // 5C17 + KC_ASDN, // 5C18 + KC_ASRP, // 5C19 + KC_ASTG, // 5C1A + KC_ASON, // 5C1B + KC_ASOFF, // 5C1C // Audio - AU_ON, // 5C1D - AU_OFF, // 5C1E - AU_TOG, // 5C1F + AU_ON, // 5C1D + AU_OFF, // 5C1E + AU_TOG, // 5C1F // Audio Clicky - CLICKY_TOGGLE, // 5C20 - CLICKY_ENABLE, // 5C21 - CLICKY_DISABLE, // 5C22 - CLICKY_UP, // 5C23 - CLICKY_DOWN, // 5C24 - CLICKY_RESET, // 5C25 + CLICKY_TOGGLE, // 5C20 + CLICKY_ENABLE, // 5C21 + CLICKY_DISABLE, // 5C22 + CLICKY_UP, // 5C23 + CLICKY_DOWN, // 5C24 + CLICKY_RESET, // 5C25 // Music mode - MU_ON, // 5C26 - MU_OFF, // 5C27 - MU_TOG, // 5C28 - MU_MOD, // 5C29 - MUV_IN, // 5C2A - MUV_DE, // 5C2B + MU_ON, // 5C26 + MU_OFF, // 5C27 + MU_TOG, // 5C28 + MU_MOD, // 5C29 + MUV_IN, // 5C2A + MUV_DE, // 5C2B // MIDI - MI_ON, // 5C2C - MI_OFF, // 5C2D - MI_TOG, // 5C2E + MI_ON, // 5C2C + MI_OFF, // 5C2D + MI_TOG, // 5C2E - MI_C, // 5C2F - MI_Cs, // 5C30 + MI_C, // 5C2F + MI_Cs, // 5C30 MI_Db = MI_Cs, - MI_D, // 5C31 - MI_Ds, // 5C32 + MI_D, // 5C31 + MI_Ds, // 5C32 MI_Eb = MI_Ds, - MI_E, // 5C33 - MI_F, // 5C34 - MI_Fs, // 5C35 + MI_E, // 5C33 + MI_F, // 5C34 + MI_Fs, // 5C35 MI_Gb = MI_Fs, - MI_G, // 5C36 - MI_Gs, // 5C37 + MI_G, // 5C36 + MI_Gs, // 5C37 MI_Ab = MI_Gs, - MI_A, // 5C38 - MI_As, // 5C39 + MI_A, // 5C38 + MI_As, // 5C39 MI_Bb = MI_As, - MI_B, // 5C3A + MI_B, // 5C3A - MI_C_1, // 5C3B - MI_Cs_1, // 5C3C + MI_C_1, // 5C3B + MI_Cs_1, // 5C3C MI_Db_1 = MI_Cs_1, - MI_D_1, // 5C3D - MI_Ds_1, // 5C3E + MI_D_1, // 5C3D + MI_Ds_1, // 5C3E MI_Eb_1 = MI_Ds_1, - MI_E_1, // 5C3F - MI_F_1, // 5C40 - MI_Fs_1, // 5C41 + MI_E_1, // 5C3F + MI_F_1, // 5C40 + MI_Fs_1, // 5C41 MI_Gb_1 = MI_Fs_1, - MI_G_1, // 5C42 - MI_Gs_1, // 5C43 + MI_G_1, // 5C42 + MI_Gs_1, // 5C43 MI_Ab_1 = MI_Gs_1, - MI_A_1, // 5C44 - MI_As_1, // 5C45 + MI_A_1, // 5C44 + MI_As_1, // 5C45 MI_Bb_1 = MI_As_1, - MI_B_1, // 5C46 + MI_B_1, // 5C46 - MI_C_2, // 5C47 - MI_Cs_2, // 5C48 + MI_C_2, // 5C47 + MI_Cs_2, // 5C48 MI_Db_2 = MI_Cs_2, - MI_D_2, // 5C49 - MI_Ds_2, // 5C4A + MI_D_2, // 5C49 + MI_Ds_2, // 5C4A MI_Eb_2 = MI_Ds_2, - MI_E_2, // 5C4B - MI_F_2, // 5C4C - MI_Fs_2, // 5C4D + MI_E_2, // 5C4B + MI_F_2, // 5C4C + MI_Fs_2, // 5C4D MI_Gb_2 = MI_Fs_2, - MI_G_2, // 5C4E - MI_Gs_2, // 5C4F + MI_G_2, // 5C4E + MI_Gs_2, // 5C4F MI_Ab_2 = MI_Gs_2, - MI_A_2, // 5C50 - MI_As_2, // 5C51 + MI_A_2, // 5C50 + MI_As_2, // 5C51 MI_Bb_2 = MI_As_2, - MI_B_2, // 5C52 + MI_B_2, // 5C52 - MI_C_3, // 5C53 - MI_Cs_3, // 5C54 + MI_C_3, // 5C53 + MI_Cs_3, // 5C54 MI_Db_3 = MI_Cs_3, - MI_D_3, // 5C55 - MI_Ds_3, // 5C56 + MI_D_3, // 5C55 + MI_Ds_3, // 5C56 MI_Eb_3 = MI_Ds_3, - MI_E_3, // 5C57 - MI_F_3, // 5C58 - MI_Fs_3, // 5C59 + MI_E_3, // 5C57 + MI_F_3, // 5C58 + MI_Fs_3, // 5C59 MI_Gb_3 = MI_Fs_3, - MI_G_3, // 5C5A - MI_Gs_3, // 5C5B + MI_G_3, // 5C5A + MI_Gs_3, // 5C5B MI_Ab_3 = MI_Gs_3, - MI_A_3, // 5C5C - MI_As_3, // 5C5D + MI_A_3, // 5C5C + MI_As_3, // 5C5D MI_Bb_3 = MI_As_3, - MI_B_3, // 5C5E + MI_B_3, // 5C5E - MI_C_4, // 5C5F - MI_Cs_4, // 5C60 + MI_C_4, // 5C5F + MI_Cs_4, // 5C60 MI_Db_4 = MI_Cs_4, - MI_D_4, // 5C61 - MI_Ds_4, // 5C62 + MI_D_4, // 5C61 + MI_Ds_4, // 5C62 MI_Eb_4 = MI_Ds_4, - MI_E_4, // 5C63 - MI_F_4, // 5C64 - MI_Fs_4, // 5C65 + MI_E_4, // 5C63 + MI_F_4, // 5C64 + MI_Fs_4, // 5C65 MI_Gb_4 = MI_Fs_4, - MI_G_4, // 5C66 - MI_Gs_4, // 5C67 + MI_G_4, // 5C66 + MI_Gs_4, // 5C67 MI_Ab_4 = MI_Gs_4, - MI_A_4, // 5C68 - MI_As_4, // 5C69 + MI_A_4, // 5C68 + MI_As_4, // 5C69 MI_Bb_4 = MI_As_4, - MI_B_4, // 5C6A + MI_B_4, // 5C6A - MI_C_5, // 5C6B - MI_Cs_5, // 5C6C + MI_C_5, // 5C6B + MI_Cs_5, // 5C6C MI_Db_5 = MI_Cs_5, - MI_D_5, // 5C6D - MI_Ds_5, // 5C6E + MI_D_5, // 5C6D + MI_Ds_5, // 5C6E MI_Eb_5 = MI_Ds_5, - MI_E_5, // 5C6F - MI_F_5, // 5C70 - MI_Fs_5, // 5C71 + MI_E_5, // 5C6F + MI_F_5, // 5C70 + MI_Fs_5, // 5C71 MI_Gb_5 = MI_Fs_5, - MI_G_5, // 5C72 - MI_Gs_5, // 5C73 + MI_G_5, // 5C72 + MI_Gs_5, // 5C73 MI_Ab_5 = MI_Gs_5, - MI_A_5, // 5C74 - MI_As_5, // 5C75 + MI_A_5, // 5C74 + MI_As_5, // 5C75 MI_Bb_5 = MI_As_5, - MI_B_5, // 5C76 - - MI_OCT_N2, // 5C77 - MI_OCT_N1, // 5C78 - MI_OCT_0, // 5C79 - MI_OCT_1, // 5C7A - MI_OCT_2, // 5C7B - MI_OCT_3, // 5C7C - MI_OCT_4, // 5C7D - MI_OCT_5, // 5C7E - MI_OCT_6, // 5C7F - MI_OCT_7, // 5C80 - MI_OCTD, // 5C81 - MI_OCTU, // 5C82 - - MI_TRNS_N6, // 5C83 - MI_TRNS_N5, // 5C84 - MI_TRNS_N4, // 5C85 - MI_TRNS_N3, // 5C86 - MI_TRNS_N2, // 5C87 - MI_TRNS_N1, // 5C88 - MI_TRNS_0, // 5C89 - MI_TRNS_1, // 5C8A - MI_TRNS_2, // 5C8B - MI_TRNS_3, // 5C8C - MI_TRNS_4, // 5C8D - MI_TRNS_5, // 5C8E - MI_TRNS_6, // 5C8F - MI_TRNSD, // 5C90 - MI_TRNSU, // 5C91 - - MI_VEL_0, // 5C92 + MI_B_5, // 5C76 + + MI_OCT_N2, // 5C77 + MI_OCT_N1, // 5C78 + MI_OCT_0, // 5C79 + MI_OCT_1, // 5C7A + MI_OCT_2, // 5C7B + MI_OCT_3, // 5C7C + MI_OCT_4, // 5C7D + MI_OCT_5, // 5C7E + MI_OCT_6, // 5C7F + MI_OCT_7, // 5C80 + MI_OCTD, // 5C81 + MI_OCTU, // 5C82 + + MI_TRNS_N6, // 5C83 + MI_TRNS_N5, // 5C84 + MI_TRNS_N4, // 5C85 + MI_TRNS_N3, // 5C86 + MI_TRNS_N2, // 5C87 + MI_TRNS_N1, // 5C88 + MI_TRNS_0, // 5C89 + MI_TRNS_1, // 5C8A + MI_TRNS_2, // 5C8B + MI_TRNS_3, // 5C8C + MI_TRNS_4, // 5C8D + MI_TRNS_5, // 5C8E + MI_TRNS_6, // 5C8F + MI_TRNSD, // 5C90 + MI_TRNSU, // 5C91 + + MI_VEL_0, // 5C92 #ifdef VIA_ENABLE MI_VEL_1 = MI_VEL_0, #else - MI_VEL_1, // 5C93 + MI_VEL_1, // 5C93 #endif - MI_VEL_2, // 5C94 - MI_VEL_3, // 5C95 - MI_VEL_4, // 5C96 - MI_VEL_5, // 5C97 - MI_VEL_6, // 5C98 - MI_VEL_7, // 5C99 - MI_VEL_8, // 5C9A - MI_VEL_9, // 5C9B - MI_VEL_10, // 5C9C - MI_VELD, // 5C9D - MI_VELU, // 5C9E - - MI_CH1, // 5C9F - MI_CH2, // 5CA0 - MI_CH3, // 5CA1 - MI_CH4, // 5CA2 - MI_CH5, // 5CA3 - MI_CH6, // 5CA4 - MI_CH7, // 5CA5 - MI_CH8, // 5CA6 - MI_CH9, // 5CA7 - MI_CH10, // 5CA8 - MI_CH11, // 5CA9 - MI_CH12, // 5CAA - MI_CH13, // 5CAB - MI_CH14, // 5CAC - MI_CH15, // 5CAD - MI_CH16, // 5CAE - MI_CHD, // 5CAF - MI_CHU, // 5CB0 - - MI_ALLOFF, // 5CB1 - - MI_SUS, // 5CB2 - MI_PORT, // 5CB3 - MI_SOST, // 5CB4 - MI_SOFT, // 5CB5 - MI_LEG, // 5CB6 - - MI_MOD, // 5CB7 - MI_MODSD, // 5CB8 - MI_MODSU, // 5CB9 - - MI_BENDD, // 5CBA - MI_BENDU, // 5CBB + MI_VEL_2, // 5C94 + MI_VEL_3, // 5C95 + MI_VEL_4, // 5C96 + MI_VEL_5, // 5C97 + MI_VEL_6, // 5C98 + MI_VEL_7, // 5C99 + MI_VEL_8, // 5C9A + MI_VEL_9, // 5C9B + MI_VEL_10, // 5C9C + MI_VELD, // 5C9D + MI_VELU, // 5C9E + + MI_CH1, // 5C9F + MI_CH2, // 5CA0 + MI_CH3, // 5CA1 + MI_CH4, // 5CA2 + MI_CH5, // 5CA3 + MI_CH6, // 5CA4 + MI_CH7, // 5CA5 + MI_CH8, // 5CA6 + MI_CH9, // 5CA7 + MI_CH10, // 5CA8 + MI_CH11, // 5CA9 + MI_CH12, // 5CAA + MI_CH13, // 5CAB + MI_CH14, // 5CAC + MI_CH15, // 5CAD + MI_CH16, // 5CAE + MI_CHD, // 5CAF + MI_CHU, // 5CB0 + + MI_ALLOFF, // 5CB1 + + MI_SUS, // 5CB2 + MI_PORT, // 5CB3 + MI_SOST, // 5CB4 + MI_SOFT, // 5CB5 + MI_LEG, // 5CB6 + + MI_MOD, // 5CB7 + MI_MODSD, // 5CB8 + MI_MODSU, // 5CB9 + + MI_BENDD, // 5CBA + MI_BENDU, // 5CBB // Backlight - BL_ON, // 5CBC - BL_OFF, // 5CBD - BL_DEC, // 5CBE - BL_INC, // 5CBF - BL_TOGG, // 5CC0 - BL_STEP, // 5CC1 - BL_BRTG, // 5CC2 + BL_ON, // 5CBC + BL_OFF, // 5CBD + BL_DEC, // 5CBE + BL_INC, // 5CBF + BL_TOGG, // 5CC0 + BL_STEP, // 5CC1 + BL_BRTG, // 5CC2 // RGB underglow/matrix - RGB_TOG, // 5CC3 - RGB_MODE_FORWARD, // 5CC4 - RGB_MODE_REVERSE, // 5CC5 - RGB_HUI, // 5CC6 - RGB_HUD, // 5CC7 - RGB_SAI, // 5CC8 - RGB_SAD, // 5CC9 - RGB_VAI, // 5CCA - RGB_VAD, // 5CCB - RGB_SPI, // 5CCC - RGB_SPD, // 5CCD - RGB_MODE_PLAIN, // 5CCE - RGB_MODE_BREATHE, // 5CCF - RGB_MODE_RAINBOW, // 5CD0 - RGB_MODE_SWIRL, // 5CD1 - RGB_MODE_SNAKE, // 5CD2 - RGB_MODE_KNIGHT, // 5CD3 - RGB_MODE_XMAS, // 5CD4 - RGB_MODE_GRADIENT, // 5CD5 - RGB_MODE_RGBTEST, // 5CD6 + RGB_TOG, // 5CC3 + RGB_MODE_FORWARD, // 5CC4 + RGB_MODE_REVERSE, // 5CC5 + RGB_HUI, // 5CC6 + RGB_HUD, // 5CC7 + RGB_SAI, // 5CC8 + RGB_SAD, // 5CC9 + RGB_VAI, // 5CCA + RGB_VAD, // 5CCB + RGB_SPI, // 5CCC + RGB_SPD, // 5CCD + RGB_MODE_PLAIN, // 5CCE + RGB_MODE_BREATHE, // 5CCF + RGB_MODE_RAINBOW, // 5CD0 + RGB_MODE_SWIRL, // 5CD1 + RGB_MODE_SNAKE, // 5CD2 + RGB_MODE_KNIGHT, // 5CD3 + RGB_MODE_XMAS, // 5CD4 + RGB_MODE_GRADIENT, // 5CD5 + RGB_MODE_RGBTEST, // 5CD6 // Velocikey - VLK_TOG, // 5CD7 + VLK_TOG, // 5CD7 // Space Cadet - KC_LSPO, // 5CD8 - KC_RSPC, // 5CD9 - KC_SFTENT, // 5CDA + KC_LSPO, // 5CD8 + KC_RSPC, // 5CD9 + KC_SFTENT, // 5CDA // Thermal Printer - PRINT_ON, // 5CDB - PRINT_OFF, // 5CDC + PRINT_ON, // 5CDB + PRINT_OFF, // 5CDC // Bluetooth: output selection - OUT_AUTO, // 5CDD - OUT_USB, // 5CDE + OUT_AUTO, // 5CDD + OUT_USB, // 5CDE // Clear EEPROM - QK_CLEAR_EEPROM, // 5CDF + QK_CLEAR_EEPROM, // 5CDF // Unicode - UNICODE_MODE_FORWARD, // 5CE0 - UNICODE_MODE_REVERSE, // 5CE1 - UNICODE_MODE_MAC, // 5CE2 - UNICODE_MODE_LNX, // 5CE3 - UNICODE_MODE_WIN, // 5CE4 - UNICODE_MODE_BSD, // 5CE5 - UNICODE_MODE_WINC, // 5CE6 + UNICODE_MODE_FORWARD, // 5CE0 + UNICODE_MODE_REVERSE, // 5CE1 + UNICODE_MODE_MAC, // 5CE2 + UNICODE_MODE_LNX, // 5CE3 + UNICODE_MODE_WIN, // 5CE4 + UNICODE_MODE_BSD, // 5CE5 + UNICODE_MODE_WINC, // 5CE6 // Haptic - HPT_ON, // 5CE7 - HPT_OFF, // 5CE8 - HPT_TOG, // 5CE9 - HPT_RST, // 5CEA - HPT_FBK, // 5CEB - HPT_BUZ, // 5CEC - HPT_MODI, // 5CED - HPT_MODD, // 5CEE - HPT_CONT, // 5CEF - HPT_CONI, // 5CF0 - HPT_COND, // 5CF1 - HPT_DWLI, // 5CF2 - HPT_DWLD, // 5CF3 + HPT_ON, // 5CE7 + HPT_OFF, // 5CE8 + HPT_TOG, // 5CE9 + HPT_RST, // 5CEA + HPT_FBK, // 5CEB + HPT_BUZ, // 5CEC + HPT_MODI, // 5CED + HPT_MODD, // 5CEE + HPT_CONT, // 5CEF + HPT_CONI, // 5CF0 + HPT_COND, // 5CF1 + HPT_DWLI, // 5CF2 + HPT_DWLD, // 5CF3 // Space Cadet (continued) - KC_LCPO, // 5CF4 - KC_RCPC, // 5CF5 - KC_LAPO, // 5CF6 - KC_RAPC, // 5CF7 + KC_LCPO, // 5CF4 + KC_RCPC, // 5CF5 + KC_LAPO, // 5CF6 + KC_RAPC, // 5CF7 // Combos - CMB_ON, // 5CF8 - CMB_OFF, // 5CF9 - CMB_TOG, // 5CFA + CMB_ON, // 5CF8 + CMB_OFF, // 5CF9 + CMB_TOG, // 5CFA // Magic (continued) - MAGIC_SWAP_LCTL_LGUI, // 5CFB - MAGIC_SWAP_RCTL_RGUI, // 5CFC - MAGIC_UNSWAP_LCTL_LGUI, // 5CFD - MAGIC_UNSWAP_RCTL_RGUI, // 5CFE - MAGIC_SWAP_CTL_GUI, // 5CFF - MAGIC_UNSWAP_CTL_GUI, // 5D00 - MAGIC_TOGGLE_CTL_GUI, // 5D01 - MAGIC_EE_HANDS_LEFT, // 5D02 - MAGIC_EE_HANDS_RIGHT, // 5D03 + MAGIC_SWAP_LCTL_LGUI, // 5CFB + MAGIC_SWAP_RCTL_RGUI, // 5CFC + MAGIC_UNSWAP_LCTL_LGUI, // 5CFD + MAGIC_UNSWAP_RCTL_RGUI, // 5CFE + MAGIC_SWAP_CTL_GUI, // 5CFF + MAGIC_UNSWAP_CTL_GUI, // 5D00 + MAGIC_TOGGLE_CTL_GUI, // 5D01 + MAGIC_EE_HANDS_LEFT, // 5D02 + MAGIC_EE_HANDS_RIGHT, // 5D03 // Dynamic Macros - DYN_REC_START1, // 5D04 - DYN_REC_START2, // 5D05 - DYN_REC_STOP, // 5D06 - DYN_MACRO_PLAY1, // 5D07 - DYN_MACRO_PLAY2, // 5D08 + DYN_REC_START1, // 5D04 + DYN_REC_START2, // 5D05 + DYN_REC_STOP, // 5D06 + DYN_MACRO_PLAY1, // 5D07 + DYN_MACRO_PLAY2, // 5D08 // Joystick - JS_BUTTON0, // 5D09 - JS_BUTTON1, // 5D0A - JS_BUTTON2, // 5D0B - JS_BUTTON3, // 5D0C - JS_BUTTON4, // 5D0D - JS_BUTTON5, // 5D0E - JS_BUTTON6, // 5D0F - JS_BUTTON7, // 5D10 - JS_BUTTON8, // 5D11 - JS_BUTTON9, // 5D12 - JS_BUTTON10, // 5D13 - JS_BUTTON11, // 5D14 - JS_BUTTON12, // 5D15 - JS_BUTTON13, // 5D16 - JS_BUTTON14, // 5D17 - JS_BUTTON15, // 5D18 - JS_BUTTON16, // 5D19 - JS_BUTTON17, // 5D1A - JS_BUTTON18, // 5D1B - JS_BUTTON19, // 5D1C - JS_BUTTON20, // 5D1D - JS_BUTTON21, // 5D1E - JS_BUTTON22, // 5D1F - JS_BUTTON23, // 5D20 - JS_BUTTON24, // 5D21 - JS_BUTTON25, // 5D22 - JS_BUTTON26, // 5D23 - JS_BUTTON27, // 5D24 - JS_BUTTON28, // 5D25 - JS_BUTTON29, // 5D26 - JS_BUTTON30, // 5D27 - JS_BUTTON31, // 5D28 + JS_BUTTON0, // 5D09 + JS_BUTTON1, // 5D0A + JS_BUTTON2, // 5D0B + JS_BUTTON3, // 5D0C + JS_BUTTON4, // 5D0D + JS_BUTTON5, // 5D0E + JS_BUTTON6, // 5D0F + JS_BUTTON7, // 5D10 + JS_BUTTON8, // 5D11 + JS_BUTTON9, // 5D12 + JS_BUTTON10, // 5D13 + JS_BUTTON11, // 5D14 + JS_BUTTON12, // 5D15 + JS_BUTTON13, // 5D16 + JS_BUTTON14, // 5D17 + JS_BUTTON15, // 5D18 + JS_BUTTON16, // 5D19 + JS_BUTTON17, // 5D1A + JS_BUTTON18, // 5D1B + JS_BUTTON19, // 5D1C + JS_BUTTON20, // 5D1D + JS_BUTTON21, // 5D1E + JS_BUTTON22, // 5D1F + JS_BUTTON23, // 5D20 + JS_BUTTON24, // 5D21 + JS_BUTTON25, // 5D22 + JS_BUTTON26, // 5D23 + JS_BUTTON27, // 5D24 + JS_BUTTON28, // 5D25 + JS_BUTTON29, // 5D26 + JS_BUTTON30, // 5D27 + JS_BUTTON31, // 5D28 // Leader Key - KC_LEAD, // 5D29 + KC_LEAD, // 5D29 // Bluetooth: output selection (continued) - OUT_BT, // 5D2A + OUT_BT, // 5D2A // Lock Key - KC_LOCK, // 5D2B + KC_LOCK, // 5D2B // Terminal - TERM_ON, // 5D2C - TERM_OFF, // 5D2D + TERM_ON, // 5D2C + TERM_OFF, // 5D2D // Sequencer - SQ_ON, // 5D2E - SQ_OFF, // 5D2F - SQ_TOG, // 5D30 + SQ_ON, // 5D2E + SQ_OFF, // 5D2F + SQ_TOG, // 5D30 - SQ_TMPD, // 5D31 - SQ_TMPU, // 5D32 + SQ_TMPD, // 5D31 + SQ_TMPU, // 5D32 - SQ_RESD, // 5D33 - SQ_RESU, // 5D34 + SQ_RESD, // 5D33 + SQ_RESU, // 5D34 - SQ_SALL, // 5D35 - SQ_SCLR, // 5D36 + SQ_SALL, // 5D35 + SQ_SCLR, // 5D36 - SEQUENCER_STEP_MIN, // 5D37 + SEQUENCER_STEP_MIN, // 5D37 SEQUENCER_STEP_MAX = SEQUENCER_STEP_MIN + SEQUENCER_STEPS, SEQUENCER_RESOLUTION_MIN, @@ -636,69 +636,69 @@ enum quantum_keycodes { #define MOD_MEH 0x7 // US ANSI shifted keycode aliases -#define KC_TILDE LSFT(KC_GRAVE) // ~ +#define KC_TILDE LSFT(KC_GRAVE) // ~ #define KC_TILD KC_TILDE -#define KC_EXCLAIM LSFT(KC_1) // ! +#define KC_EXCLAIM LSFT(KC_1) // ! #define KC_EXLM KC_EXCLAIM -#define KC_AT LSFT(KC_2) // @ +#define KC_AT LSFT(KC_2) // @ -#define KC_HASH LSFT(KC_3) // # +#define KC_HASH LSFT(KC_3) // # -#define KC_DOLLAR LSFT(KC_4) // $ +#define KC_DOLLAR LSFT(KC_4) // $ #define KC_DLR KC_DOLLAR -#define KC_PERCENT LSFT(KC_5) // % +#define KC_PERCENT LSFT(KC_5) // % #define KC_PERC KC_PERCENT -#define KC_CIRCUMFLEX LSFT(KC_6) // ^ +#define KC_CIRCUMFLEX LSFT(KC_6) // ^ #define KC_CIRC KC_CIRCUMFLEX -#define KC_AMPERSAND LSFT(KC_7) // & +#define KC_AMPERSAND LSFT(KC_7) // & #define KC_AMPR KC_AMPERSAND -#define KC_ASTERISK LSFT(KC_8) // * +#define KC_ASTERISK LSFT(KC_8) // * #define KC_ASTR KC_ASTERISK -#define KC_LEFT_PAREN LSFT(KC_9) // ( +#define KC_LEFT_PAREN LSFT(KC_9) // ( #define KC_LPRN KC_LEFT_PAREN -#define KC_RIGHT_PAREN LSFT(KC_0) // ) +#define KC_RIGHT_PAREN LSFT(KC_0) // ) #define KC_RPRN KC_RIGHT_PAREN -#define KC_UNDERSCORE LSFT(KC_MINUS) // _ +#define KC_UNDERSCORE LSFT(KC_MINUS) // _ #define KC_UNDS KC_UNDERSCORE -#define KC_PLUS LSFT(KC_EQUAL) // + +#define KC_PLUS LSFT(KC_EQUAL) // + -#define KC_LEFT_CURLY_BRACE LSFT(KC_LEFT_BRACKET) // { +#define KC_LEFT_CURLY_BRACE LSFT(KC_LEFT_BRACKET) // { #define KC_LCBR KC_LEFT_CURLY_BRACE -#define KC_RIGHT_CURLY_BRACE LSFT(KC_RIGHT_BRACKET) // } +#define KC_RIGHT_CURLY_BRACE LSFT(KC_RIGHT_BRACKET) // } #define KC_RCBR KC_RIGHT_CURLY_BRACE -#define KC_LEFT_ANGLE_BRACKET LSFT(KC_COMMA) // < +#define KC_LEFT_ANGLE_BRACKET LSFT(KC_COMMA) // < #define KC_LABK KC_LEFT_ANGLE_BRACKET #define KC_LT KC_LEFT_ANGLE_BRACKET -#define KC_RIGHT_ANGLE_BRACKET LSFT(KC_DOT) // > +#define KC_RIGHT_ANGLE_BRACKET LSFT(KC_DOT) // > #define KC_RABK KC_RIGHT_ANGLE_BRACKET #define KC_GT KC_RIGHT_ANGLE_BRACKET -#define KC_COLON LSFT(KC_SEMICOLON) // : +#define KC_COLON LSFT(KC_SEMICOLON) // : #define KC_COLN KC_COLON -#define KC_PIPE LSFT(KC_BACKSLASH) // | +#define KC_PIPE LSFT(KC_BACKSLASH) // | -#define KC_QUESTION LSFT(KC_SLASH) // ? +#define KC_QUESTION LSFT(KC_SLASH) // ? #define KC_QUES KC_QUESTION -#define KC_DOUBLE_QUOTE LSFT(KC_QUOTE) // " +#define KC_DOUBLE_QUOTE LSFT(KC_QUOTE) // " #define KC_DQUO KC_DOUBLE_QUOTE #define KC_DQT KC_DOUBLE_QUOTE -#define KC_DELT KC_DELETE // Del key (four letter code) +#define KC_DELT KC_DELETE // Del key (four letter code) // Modified keycode aliases #define C(kc) LCTL(kc) @@ -841,22 +841,22 @@ enum quantum_keycodes { #define CMD_T(kc) LCMD_T(kc) #define WIN_T(kc) LWIN_T(kc) -#define C_S_T(kc) MT(MOD_LCTL | MOD_LSFT, kc) // Left Control + Shift e.g. for gnome-terminal -#define MEH_T(kc) MT(MOD_LCTL | MOD_LSFT | MOD_LALT, kc) // Meh is a less hyper version of the Hyper key -- doesn't include GUI, so just Left Control + Shift + Alt -#define LCAG_T(kc) MT(MOD_LCTL | MOD_LALT | MOD_LGUI, kc) // Left Control + Alt + GUI -#define RCAG_T(kc) MT(MOD_RCTL | MOD_RALT | MOD_RGUI, kc) // Right Control + Alt + GUI -#define HYPR_T(kc) MT(MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI, kc) // see http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/ -#define LSG_T(kc) MT(MOD_LSFT | MOD_LGUI, kc) // Left Shift + GUI +#define C_S_T(kc) MT(MOD_LCTL | MOD_LSFT, kc) // Left Control + Shift e.g. for gnome-terminal +#define MEH_T(kc) MT(MOD_LCTL | MOD_LSFT | MOD_LALT, kc) // Meh is a less hyper version of the Hyper key -- doesn't include GUI, so just Left Control + Shift + Alt +#define LCAG_T(kc) MT(MOD_LCTL | MOD_LALT | MOD_LGUI, kc) // Left Control + Alt + GUI +#define RCAG_T(kc) MT(MOD_RCTL | MOD_RALT | MOD_RGUI, kc) // Right Control + Alt + GUI +#define HYPR_T(kc) MT(MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI, kc) // see http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/ +#define LSG_T(kc) MT(MOD_LSFT | MOD_LGUI, kc) // Left Shift + GUI #define SGUI_T(kc) LSG_T(kc) #define SCMD_T(kc) LSG_T(kc) #define SWIN_T(kc) LSG_T(kc) -#define LAG_T(kc) MT(MOD_LALT | MOD_LGUI, kc) // Left Alt + GUI -#define RSG_T(kc) MT(MOD_RSFT | MOD_RGUI, kc) // Right Shift + GUI -#define RAG_T(kc) MT(MOD_RALT | MOD_RGUI, kc) // Right Alt + GUI -#define LCA_T(kc) MT(MOD_LCTL | MOD_LALT, kc) // Left Control + Alt -#define LSA_T(kc) MT(MOD_LSFT | MOD_LALT, kc) // Left Shift + Alt -#define RSA_T(kc) MT(MOD_RSFT | MOD_RALT, kc) // Right Shift + Alt -#define RCS_T(kc) MT(MOD_RCTL | MOD_RSFT, kc) // Right Control + Shift +#define LAG_T(kc) MT(MOD_LALT | MOD_LGUI, kc) // Left Alt + GUI +#define RSG_T(kc) MT(MOD_RSFT | MOD_RGUI, kc) // Right Shift + GUI +#define RAG_T(kc) MT(MOD_RALT | MOD_RGUI, kc) // Right Alt + GUI +#define LCA_T(kc) MT(MOD_LCTL | MOD_LALT, kc) // Left Control + Alt +#define LSA_T(kc) MT(MOD_LSFT | MOD_LALT, kc) // Left Shift + Alt +#define RSA_T(kc) MT(MOD_RSFT | MOD_RALT, kc) // Right Shift + Alt +#define RCS_T(kc) MT(MOD_RCTL | MOD_RSFT, kc) // Right Control + Shift #define SAGR_T(kc) RSA_T(kc) #define ALL_T(kc) HYPR_T(kc) @@ -870,14 +870,14 @@ enum quantum_keycodes { #define UC(c) (QK_UNICODE | (c)) // UNICODEMAP_ENABLE - Allows Unicode input up to 0x10FFFF, requires unicode_map #define X(i) (QK_UNICODEMAP | (i)) -#define XP(i, j) (QK_UNICODEMAP_PAIR | ((i)&0x7F) | (((j)&0x7F) << 7)) // 127 max i and j +#define XP(i, j) (QK_UNICODEMAP_PAIR | ((i)&0x7F) | (((j)&0x7F) << 7)) // 127 max i and j #define UC_MOD UNICODE_MODE_FORWARD #define UC_RMOD UNICODE_MODE_REVERSE #define UC_M_MA UNICODE_MODE_MAC -#define UNICODE_MODE_OSX UNICODE_MODE_MAC // Deprecated alias -#define UC_M_OS UNICODE_MODE_MAC // Deprecated alias +#define UNICODE_MODE_OSX UNICODE_MODE_MAC // Deprecated alias +#define UC_M_OS UNICODE_MODE_MAC // Deprecated alias #define UC_M_LN UNICODE_MODE_LNX #define UC_M_WI UNICODE_MODE_WIN #define UC_M_BS UNICODE_MODE_BSD diff --git a/quantum/rgb_matrix/animations/alpha_mods_anim.h b/quantum/rgb_matrix/animations/alpha_mods_anim.h index d6136f1ba4..59b8381d69 100644 --- a/quantum/rgb_matrix/animations/alpha_mods_anim.h +++ b/quantum/rgb_matrix/animations/alpha_mods_anim.h @@ -22,5 +22,5 @@ bool ALPHAS_MODS(effect_params_t* params) { return rgb_matrix_check_finished_leds(led_max); } -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_ALPHAS_MODS +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_ALPHAS_MODS diff --git a/quantum/rgb_matrix/animations/breathing_anim.h b/quantum/rgb_matrix/animations/breathing_anim.h index 29187e1543..e9a3c96e1b 100644 --- a/quantum/rgb_matrix/animations/breathing_anim.h +++ b/quantum/rgb_matrix/animations/breathing_anim.h @@ -16,5 +16,5 @@ bool BREATHING(effect_params_t* params) { return rgb_matrix_check_finished_leds(led_max); } -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_BREATHING +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_BREATHING diff --git a/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h b/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h index 0375d4937d..06aa8b5ed5 100644 --- a/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h +++ b/quantum/rgb_matrix/animations/colorband_pinwheel_sat_anim.h @@ -7,7 +7,9 @@ static HSV BAND_PINWHEEL_SAT_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) return hsv; } -bool BAND_PINWHEEL_SAT(effect_params_t* params) { return effect_runner_dx_dy(params, &BAND_PINWHEEL_SAT_math); } +bool BAND_PINWHEEL_SAT(effect_params_t* params) { + return effect_runner_dx_dy(params, &BAND_PINWHEEL_SAT_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT diff --git a/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h b/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h index e40bf4cd1f..bcbc319498 100644 --- a/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h +++ b/quantum/rgb_matrix/animations/colorband_pinwheel_val_anim.h @@ -7,7 +7,9 @@ static HSV BAND_PINWHEEL_VAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) return hsv; } -bool BAND_PINWHEEL_VAL(effect_params_t* params) { return effect_runner_dx_dy(params, &BAND_PINWHEEL_VAL_math); } +bool BAND_PINWHEEL_VAL(effect_params_t* params) { + return effect_runner_dx_dy(params, &BAND_PINWHEEL_VAL_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL diff --git a/quantum/rgb_matrix/animations/colorband_sat_anim.h b/quantum/rgb_matrix/animations/colorband_sat_anim.h index 1c4f7de575..cb0897ad3e 100644 --- a/quantum/rgb_matrix/animations/colorband_sat_anim.h +++ b/quantum/rgb_matrix/animations/colorband_sat_anim.h @@ -8,7 +8,9 @@ static HSV BAND_SAT_math(HSV hsv, uint8_t i, uint8_t time) { return hsv; } -bool BAND_SAT(effect_params_t* params) { return effect_runner_i(params, &BAND_SAT_math); } +bool BAND_SAT(effect_params_t* params) { + return effect_runner_i(params, &BAND_SAT_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_BAND_SAT +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_BAND_SAT diff --git a/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h b/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h index cdd02b3797..d26eb37855 100644 --- a/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h +++ b/quantum/rgb_matrix/animations/colorband_spiral_sat_anim.h @@ -7,7 +7,9 @@ static HSV BAND_SPIRAL_SAT_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, u return hsv; } -bool BAND_SPIRAL_SAT(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_SAT_math); } +bool BAND_SPIRAL_SAT(effect_params_t* params) { + return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_SAT_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT diff --git a/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h b/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h index e1331eaebe..3ae34bb6f0 100644 --- a/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h +++ b/quantum/rgb_matrix/animations/colorband_spiral_val_anim.h @@ -7,7 +7,9 @@ static HSV BAND_SPIRAL_VAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, u return hsv; } -bool BAND_SPIRAL_VAL(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_VAL_math); } +bool BAND_SPIRAL_VAL(effect_params_t* params) { + return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_VAL_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL diff --git a/quantum/rgb_matrix/animations/colorband_val_anim.h b/quantum/rgb_matrix/animations/colorband_val_anim.h index 02ee4add67..69c29f53a3 100644 --- a/quantum/rgb_matrix/animations/colorband_val_anim.h +++ b/quantum/rgb_matrix/animations/colorband_val_anim.h @@ -8,7 +8,9 @@ static HSV BAND_VAL_math(HSV hsv, uint8_t i, uint8_t time) { return hsv; } -bool BAND_VAL(effect_params_t* params) { return effect_runner_i(params, &BAND_VAL_math); } +bool BAND_VAL(effect_params_t* params) { + return effect_runner_i(params, &BAND_VAL_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_BAND_VAL +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_BAND_VAL diff --git a/quantum/rgb_matrix/animations/cycle_all_anim.h b/quantum/rgb_matrix/animations/cycle_all_anim.h index 3b73b9d385..d8c7220d95 100644 --- a/quantum/rgb_matrix/animations/cycle_all_anim.h +++ b/quantum/rgb_matrix/animations/cycle_all_anim.h @@ -7,7 +7,9 @@ static HSV CYCLE_ALL_math(HSV hsv, uint8_t i, uint8_t time) { return hsv; } -bool CYCLE_ALL(effect_params_t* params) { return effect_runner_i(params, &CYCLE_ALL_math); } +bool CYCLE_ALL(effect_params_t* params) { + return effect_runner_i(params, &CYCLE_ALL_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_CYCLE_ALL +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_CYCLE_ALL diff --git a/quantum/rgb_matrix/animations/cycle_left_right_anim.h b/quantum/rgb_matrix/animations/cycle_left_right_anim.h index bf6a574069..84c2127aff 100644 --- a/quantum/rgb_matrix/animations/cycle_left_right_anim.h +++ b/quantum/rgb_matrix/animations/cycle_left_right_anim.h @@ -7,7 +7,9 @@ static HSV CYCLE_LEFT_RIGHT_math(HSV hsv, uint8_t i, uint8_t time) { return hsv; } -bool CYCLE_LEFT_RIGHT(effect_params_t* params) { return effect_runner_i(params, &CYCLE_LEFT_RIGHT_math); } +bool CYCLE_LEFT_RIGHT(effect_params_t* params) { + return effect_runner_i(params, &CYCLE_LEFT_RIGHT_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT diff --git a/quantum/rgb_matrix/animations/cycle_out_in_anim.h b/quantum/rgb_matrix/animations/cycle_out_in_anim.h index 2bdb9d9375..9513fe9593 100644 --- a/quantum/rgb_matrix/animations/cycle_out_in_anim.h +++ b/quantum/rgb_matrix/animations/cycle_out_in_anim.h @@ -7,7 +7,9 @@ static HSV CYCLE_OUT_IN_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint return hsv; } -bool CYCLE_OUT_IN(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &CYCLE_OUT_IN_math); } +bool CYCLE_OUT_IN(effect_params_t* params) { + return effect_runner_dx_dy_dist(params, &CYCLE_OUT_IN_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_CYCLE_OUT_IN +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_CYCLE_OUT_IN diff --git a/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h b/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h index 51979c44fe..3cca45f27a 100644 --- a/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h +++ b/quantum/rgb_matrix/animations/cycle_out_in_dual_anim.h @@ -9,7 +9,9 @@ static HSV CYCLE_OUT_IN_DUAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) return hsv; } -bool CYCLE_OUT_IN_DUAL(effect_params_t* params) { return effect_runner_dx_dy(params, &CYCLE_OUT_IN_DUAL_math); } +bool CYCLE_OUT_IN_DUAL(effect_params_t* params) { + return effect_runner_dx_dy(params, &CYCLE_OUT_IN_DUAL_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL diff --git a/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h b/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h index 10ba2b7c2c..de5993992c 100644 --- a/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h +++ b/quantum/rgb_matrix/animations/cycle_pinwheel_anim.h @@ -7,7 +7,9 @@ static HSV CYCLE_PINWHEEL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t time) { return hsv; } -bool CYCLE_PINWHEEL(effect_params_t* params) { return effect_runner_dx_dy(params, &CYCLE_PINWHEEL_math); } +bool CYCLE_PINWHEEL(effect_params_t* params) { + return effect_runner_dx_dy(params, &CYCLE_PINWHEEL_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_CYCLE_PINWHEEL diff --git a/quantum/rgb_matrix/animations/cycle_spiral_anim.h b/quantum/rgb_matrix/animations/cycle_spiral_anim.h index 482c7e7da6..904450179e 100644 --- a/quantum/rgb_matrix/animations/cycle_spiral_anim.h +++ b/quantum/rgb_matrix/animations/cycle_spiral_anim.h @@ -7,7 +7,9 @@ static HSV CYCLE_SPIRAL_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint return hsv; } -bool CYCLE_SPIRAL(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &CYCLE_SPIRAL_math); } +bool CYCLE_SPIRAL(effect_params_t* params) { + return effect_runner_dx_dy_dist(params, &CYCLE_SPIRAL_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_CYCLE_SPIRAL +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_CYCLE_SPIRAL diff --git a/quantum/rgb_matrix/animations/cycle_up_down_anim.h b/quantum/rgb_matrix/animations/cycle_up_down_anim.h index 277edccb2f..dce05fecff 100644 --- a/quantum/rgb_matrix/animations/cycle_up_down_anim.h +++ b/quantum/rgb_matrix/animations/cycle_up_down_anim.h @@ -7,7 +7,9 @@ static HSV CYCLE_UP_DOWN_math(HSV hsv, uint8_t i, uint8_t time) { return hsv; } -bool CYCLE_UP_DOWN(effect_params_t* params) { return effect_runner_i(params, &CYCLE_UP_DOWN_math); } +bool CYCLE_UP_DOWN(effect_params_t* params) { + return effect_runner_i(params, &CYCLE_UP_DOWN_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_CYCLE_UP_DOWN diff --git a/quantum/rgb_matrix/animations/digital_rain_anim.h b/quantum/rgb_matrix/animations/digital_rain_anim.h index 8ce8fd7039..4633145ff6 100644 --- a/quantum/rgb_matrix/animations/digital_rain_anim.h +++ b/quantum/rgb_matrix/animations/digital_rain_anim.h @@ -71,5 +71,5 @@ bool DIGITAL_RAIN(effect_params_t* params) { return false; } -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(ENABLE_RGB_MATRIX_DIGITAL_RAIN) +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && !defined(ENABLE_RGB_MATRIX_DIGITAL_RAIN) diff --git a/quantum/rgb_matrix/animations/dual_beacon_anim.h b/quantum/rgb_matrix/animations/dual_beacon_anim.h index dbe9b3ecf1..5585015b86 100644 --- a/quantum/rgb_matrix/animations/dual_beacon_anim.h +++ b/quantum/rgb_matrix/animations/dual_beacon_anim.h @@ -7,7 +7,9 @@ static HSV DUAL_BEACON_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t return hsv; } -bool DUAL_BEACON(effect_params_t* params) { return effect_runner_sin_cos_i(params, &DUAL_BEACON_math); } +bool DUAL_BEACON(effect_params_t* params) { + return effect_runner_sin_cos_i(params, &DUAL_BEACON_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_DUAL_BEACON +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_DUAL_BEACON diff --git a/quantum/rgb_matrix/animations/gradient_left_right_anim.h b/quantum/rgb_matrix/animations/gradient_left_right_anim.h index 8bb5e570bd..ebb06f59f2 100644 --- a/quantum/rgb_matrix/animations/gradient_left_right_anim.h +++ b/quantum/rgb_matrix/animations/gradient_left_right_anim.h @@ -18,5 +18,5 @@ bool GRADIENT_LEFT_RIGHT(effect_params_t* params) { return rgb_matrix_check_finished_leds(led_max); } -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT diff --git a/quantum/rgb_matrix/animations/gradient_up_down_anim.h b/quantum/rgb_matrix/animations/gradient_up_down_anim.h index a5674583e3..febc3919a8 100644 --- a/quantum/rgb_matrix/animations/gradient_up_down_anim.h +++ b/quantum/rgb_matrix/animations/gradient_up_down_anim.h @@ -18,5 +18,5 @@ bool GRADIENT_UP_DOWN(effect_params_t* params) { return rgb_matrix_check_finished_leds(led_max); } -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN diff --git a/quantum/rgb_matrix/animations/hue_breathing_anim.h b/quantum/rgb_matrix/animations/hue_breathing_anim.h index 82be1a4424..8537762832 100644 --- a/quantum/rgb_matrix/animations/hue_breathing_anim.h +++ b/quantum/rgb_matrix/animations/hue_breathing_anim.h @@ -18,5 +18,5 @@ bool HUE_BREATHING(effect_params_t* params) { return rgb_matrix_check_finished_leds(led_max); } -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // DISABLE_RGB_HUE_BREATHING +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // DISABLE_RGB_HUE_BREATHING diff --git a/quantum/rgb_matrix/animations/hue_pendulum_anim.h b/quantum/rgb_matrix/animations/hue_pendulum_anim.h index a6e1c1074d..7d8cbcdfb2 100644 --- a/quantum/rgb_matrix/animations/hue_pendulum_anim.h +++ b/quantum/rgb_matrix/animations/hue_pendulum_anim.h @@ -11,7 +11,9 @@ static HSV HUE_PENDULUM_math(HSV hsv, uint8_t i, uint8_t time) { return hsv; } -bool HUE_PENDULUM(effect_params_t* params) { return effect_runner_i(params, &HUE_PENDULUM_math); } +bool HUE_PENDULUM(effect_params_t* params) { + return effect_runner_i(params, &HUE_PENDULUM_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // DISABLE_RGB_HUE_PENDULUM +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // DISABLE_RGB_HUE_PENDULUM diff --git a/quantum/rgb_matrix/animations/hue_wave_anim.h b/quantum/rgb_matrix/animations/hue_wave_anim.h index b1c72b7336..81aa7e139e 100644 --- a/quantum/rgb_matrix/animations/hue_wave_anim.h +++ b/quantum/rgb_matrix/animations/hue_wave_anim.h @@ -11,7 +11,9 @@ static HSV HUE_WAVE_math(HSV hsv, uint8_t i, uint8_t time) { return hsv; } -bool HUE_WAVE(effect_params_t* params) { return effect_runner_i(params, &HUE_WAVE_math); } +bool HUE_WAVE(effect_params_t* params) { + return effect_runner_i(params, &HUE_WAVE_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // DISABLE_RGB_HUE_WAVE +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // DISABLE_RGB_HUE_WAVE diff --git a/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h b/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h index 3ffb57eb35..31dffcbc5a 100644 --- a/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h +++ b/quantum/rgb_matrix/animations/jellybean_raindrops_anim.h @@ -25,5 +25,5 @@ bool JELLYBEAN_RAINDROPS(effect_params_t* params) { return rgb_matrix_check_finished_leds(led_max); } -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS diff --git a/quantum/rgb_matrix/animations/pixel_flow_anim.h b/quantum/rgb_matrix/animations/pixel_flow_anim.h index 312c87628c..714f5d174e 100644 --- a/quantum/rgb_matrix/animations/pixel_flow_anim.h +++ b/quantum/rgb_matrix/animations/pixel_flow_anim.h @@ -14,7 +14,9 @@ static bool PIXEL_FLOW(effect_params_t* params) { return false; } - inline uint32_t interval(void) { return 3000 / scale16by8(qadd8(rgb_matrix_config.speed, 16), 16); } + inline uint32_t interval(void) { + return 3000 / scale16by8(qadd8(rgb_matrix_config.speed, 16), 16); + } if (params->init) { // Clear LEDs and fill the state array @@ -45,5 +47,5 @@ static bool PIXEL_FLOW(effect_params_t* params) { return rgb_matrix_check_finished_leds(led_max); } -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_PIXEL_FLOW +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_PIXEL_FLOW diff --git a/quantum/rgb_matrix/animations/pixel_fractal_anim.h b/quantum/rgb_matrix/animations/pixel_fractal_anim.h index 35187b92de..906da1a48e 100644 --- a/quantum/rgb_matrix/animations/pixel_fractal_anim.h +++ b/quantum/rgb_matrix/animations/pixel_fractal_anim.h @@ -29,7 +29,9 @@ static bool PIXEL_FRACTAL(effect_params_t* params) { return false; } - inline uint32_t interval(void) { return 3000 / scale16by8(qadd8(rgb_matrix_config.speed, 16), 16); } + inline uint32_t interval(void) { + return 3000 / scale16by8(qadd8(rgb_matrix_config.speed, 16), 16); + } if (params->init) { rgb_matrix_set_color_all(0, 0, 0); @@ -37,7 +39,7 @@ static bool PIXEL_FRACTAL(effect_params_t* params) { RGB rgb = rgb_matrix_hsv_to_rgb(rgb_matrix_config.hsv); for (uint8_t h = 0; h < MATRIX_ROWS; ++h) { - for (uint8_t l = 0; l < MID_COL - 1; ++l) { // Light and move left columns outwards + for (uint8_t l = 0; l < MID_COL - 1; ++l) { // Light and move left columns outwards if (led[h][l]) { rgb_matrix_set_color(g_led_config.matrix_co[h][l], rgb.r, rgb.g, rgb.b); } else { @@ -46,7 +48,7 @@ static bool PIXEL_FRACTAL(effect_params_t* params) { led[h][l] = led[h][l + 1]; } - for (uint8_t r = MATRIX_COLS - 1; r > MID_COL; --r) { // Light and move right columns outwards + for (uint8_t r = MATRIX_COLS - 1; r > MID_COL; --r) { // Light and move right columns outwards if (led[h][r]) { rgb_matrix_set_color(g_led_config.matrix_co[h][r], rgb.r, rgb.g, rgb.b); } else { @@ -74,5 +76,5 @@ static bool PIXEL_FRACTAL(effect_params_t* params) { wait_timer = g_rgb_timer + interval(); return false; } -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_PIXEL_FRACTAL +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_PIXEL_FRACTAL diff --git a/quantum/rgb_matrix/animations/pixel_rain_anim.h b/quantum/rgb_matrix/animations/pixel_rain_anim.h index 001649aa6e..03488b43df 100644 --- a/quantum/rgb_matrix/animations/pixel_rain_anim.h +++ b/quantum/rgb_matrix/animations/pixel_rain_anim.h @@ -24,7 +24,9 @@ static bool PIXEL_RAIN(effect_params_t* params) { return false; } - inline uint32_t interval(void) { return 500 / scale16by8(qadd8(rgb_matrix_config.speed, 16), 16); } + inline uint32_t interval(void) { + return 500 / scale16by8(qadd8(rgb_matrix_config.speed, 16), 16); + } bool rain_pixel(uint8_t i, effect_params_t * params, bool off) { if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) { @@ -44,5 +46,5 @@ static bool PIXEL_RAIN(effect_params_t* params) { return rain_pixel(mod8(random8(), DRIVER_LED_TOTAL), params, random8() & 2); } -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_PIXEL_RAIN +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_PIXEL_RAIN diff --git a/quantum/rgb_matrix/animations/rainbow_beacon_anim.h b/quantum/rgb_matrix/animations/rainbow_beacon_anim.h index cd529958db..bdcca5530f 100644 --- a/quantum/rgb_matrix/animations/rainbow_beacon_anim.h +++ b/quantum/rgb_matrix/animations/rainbow_beacon_anim.h @@ -7,7 +7,9 @@ static HSV RAINBOW_BEACON_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, uint8 return hsv; } -bool RAINBOW_BEACON(effect_params_t* params) { return effect_runner_sin_cos_i(params, &RAINBOW_BEACON_math); } +bool RAINBOW_BEACON(effect_params_t* params) { + return effect_runner_sin_cos_i(params, &RAINBOW_BEACON_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_RAINBOW_BEACON +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_RAINBOW_BEACON diff --git a/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h b/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h index 2f3de64e9d..f7b8f6c2f3 100644 --- a/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h +++ b/quantum/rgb_matrix/animations/rainbow_moving_chevron_anim.h @@ -7,7 +7,9 @@ static HSV RAINBOW_MOVING_CHEVRON_math(HSV hsv, uint8_t i, uint8_t time) { return hsv; } -bool RAINBOW_MOVING_CHEVRON(effect_params_t* params) { return effect_runner_i(params, &RAINBOW_MOVING_CHEVRON_math); } +bool RAINBOW_MOVING_CHEVRON(effect_params_t* params) { + return effect_runner_i(params, &RAINBOW_MOVING_CHEVRON_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON diff --git a/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h b/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h index dae2b5d190..91e31ea8cc 100644 --- a/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h +++ b/quantum/rgb_matrix/animations/rainbow_pinwheels_anim.h @@ -7,7 +7,9 @@ static HSV RAINBOW_PINWHEELS_math(HSV hsv, int8_t sin, int8_t cos, uint8_t i, ui return hsv; } -bool RAINBOW_PINWHEELS(effect_params_t* params) { return effect_runner_sin_cos_i(params, &RAINBOW_PINWHEELS_math); } +bool RAINBOW_PINWHEELS(effect_params_t* params) { + return effect_runner_sin_cos_i(params, &RAINBOW_PINWHEELS_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS diff --git a/quantum/rgb_matrix/animations/raindrops_anim.h b/quantum/rgb_matrix/animations/raindrops_anim.h index 4b1b9dd9ec..2d4b53b7b0 100644 --- a/quantum/rgb_matrix/animations/raindrops_anim.h +++ b/quantum/rgb_matrix/animations/raindrops_anim.h @@ -35,5 +35,5 @@ bool RAINDROPS(effect_params_t* params) { return rgb_matrix_check_finished_leds(led_max); } -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // ENABLE_RGB_MATRIX_RAINDROPS +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // ENABLE_RGB_MATRIX_RAINDROPS diff --git a/quantum/rgb_matrix/animations/runners/effect_runner_reactive.h b/quantum/rgb_matrix/animations/runners/effect_runner_reactive.h index d5c1a26cef..f9584d7071 100644 --- a/quantum/rgb_matrix/animations/runners/effect_runner_reactive.h +++ b/quantum/rgb_matrix/animations/runners/effect_runner_reactive.h @@ -26,4 +26,4 @@ bool effect_runner_reactive(effect_params_t* params, reactive_f effect_func) { return rgb_matrix_check_finished_leds(led_max); } -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED +#endif // RGB_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/rgb_matrix/animations/runners/effect_runner_reactive_splash.h b/quantum/rgb_matrix/animations/runners/effect_runner_reactive_splash.h index d3a6e4e72f..41020eb47f 100644 --- a/quantum/rgb_matrix/animations/runners/effect_runner_reactive_splash.h +++ b/quantum/rgb_matrix/animations/runners/effect_runner_reactive_splash.h @@ -26,4 +26,4 @@ bool effect_runner_reactive_splash(uint8_t start, effect_params_t* params, react return rgb_matrix_check_finished_leds(led_max); } -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED +#endif // RGB_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/rgb_matrix/animations/solid_color_anim.h b/quantum/rgb_matrix/animations/solid_color_anim.h index 4209959468..c8762dcbc2 100644 --- a/quantum/rgb_matrix/animations/solid_color_anim.h +++ b/quantum/rgb_matrix/animations/solid_color_anim.h @@ -12,4 +12,4 @@ bool SOLID_COLOR(effect_params_t* params) { return rgb_matrix_check_finished_leds(led_max); } -#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/quantum/rgb_matrix/animations/solid_reactive_anim.h b/quantum/rgb_matrix/animations/solid_reactive_anim.h index 360d05a67a..d3a7ebbdf7 100644 --- a/quantum/rgb_matrix/animations/solid_reactive_anim.h +++ b/quantum/rgb_matrix/animations/solid_reactive_anim.h @@ -8,8 +8,10 @@ static HSV SOLID_REACTIVE_math(HSV hsv, uint16_t offset) { return hsv; } -bool SOLID_REACTIVE(effect_params_t* params) { return effect_runner_reactive(params, &SOLID_REACTIVE_math); } +bool SOLID_REACTIVE(effect_params_t* params) { + return effect_runner_reactive(params, &SOLID_REACTIVE_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // ENABLE_RGB_MATRIX_SOLID_REACTIVE -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +# endif // ENABLE_RGB_MATRIX_SOLID_REACTIVE +#endif // RGB_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/rgb_matrix/animations/solid_reactive_cross.h b/quantum/rgb_matrix/animations/solid_reactive_cross.h index 496651f8a5..043a369b73 100644 --- a/quantum/rgb_matrix/animations/solid_reactive_cross.h +++ b/quantum/rgb_matrix/animations/solid_reactive_cross.h @@ -24,13 +24,17 @@ static HSV SOLID_REACTIVE_CROSS_math(HSV hsv, int16_t dx, int16_t dy, uint8_t di } # ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS -bool SOLID_REACTIVE_CROSS(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_CROSS_math); } +bool SOLID_REACTIVE_CROSS(effect_params_t* params) { + return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_CROSS_math); +} # endif # ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS -bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_CROSS_math); } +bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) { + return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_CROSS_math); +} # endif -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS) -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +# endif // !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS) +#endif // RGB_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/rgb_matrix/animations/solid_reactive_nexus.h b/quantum/rgb_matrix/animations/solid_reactive_nexus.h index 3562e74a72..8d62a49fea 100644 --- a/quantum/rgb_matrix/animations/solid_reactive_nexus.h +++ b/quantum/rgb_matrix/animations/solid_reactive_nexus.h @@ -22,13 +22,17 @@ static HSV SOLID_REACTIVE_NEXUS_math(HSV hsv, int16_t dx, int16_t dy, uint8_t di } # ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS -bool SOLID_REACTIVE_NEXUS(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_NEXUS_math); } +bool SOLID_REACTIVE_NEXUS(effect_params_t* params) { + return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_NEXUS_math); +} # endif # ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS -bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math); } +bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) { + return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math); +} # endif -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS) -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +# endif // !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS) +#endif // RGB_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h b/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h index 69189f636b..0d0a424cf3 100644 --- a/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h +++ b/quantum/rgb_matrix/animations/solid_reactive_simple_anim.h @@ -8,8 +8,10 @@ static HSV SOLID_REACTIVE_SIMPLE_math(HSV hsv, uint16_t offset) { return hsv; } -bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) { return effect_runner_reactive(params, &SOLID_REACTIVE_SIMPLE_math); } +bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) { + return effect_runner_reactive(params, &SOLID_REACTIVE_SIMPLE_math); +} -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +# endif // ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +#endif // RGB_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/rgb_matrix/animations/solid_reactive_wide.h b/quantum/rgb_matrix/animations/solid_reactive_wide.h index a613c7ff5f..7598796316 100644 --- a/quantum/rgb_matrix/animations/solid_reactive_wide.h +++ b/quantum/rgb_matrix/animations/solid_reactive_wide.h @@ -19,13 +19,17 @@ static HSV SOLID_REACTIVE_WIDE_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dis } # ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE -bool SOLID_REACTIVE_WIDE(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_WIDE_math); } +bool SOLID_REACTIVE_WIDE(effect_params_t* params) { + return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_WIDE_math); +} # endif # ifdef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE -bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math); } +bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) { + return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math); +} # endif -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE) -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +# endif // !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE) +#endif // RGB_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/rgb_matrix/animations/solid_splash_anim.h b/quantum/rgb_matrix/animations/solid_splash_anim.h index bd9c1cfe2b..77d6f8c5eb 100644 --- a/quantum/rgb_matrix/animations/solid_splash_anim.h +++ b/quantum/rgb_matrix/animations/solid_splash_anim.h @@ -19,13 +19,17 @@ HSV SOLID_SPLASH_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t ti } # ifdef ENABLE_RGB_MATRIX_SOLID_SPLASH -bool SOLID_SPLASH(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_SPLASH_math); } +bool SOLID_SPLASH(effect_params_t* params) { + return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_SPLASH_math); +} # endif # ifdef ENABLE_RGB_MATRIX_SOLID_MULTISPLASH -bool SOLID_MULTISPLASH(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_SPLASH_math); } +bool SOLID_MULTISPLASH(effect_params_t* params) { + return effect_runner_reactive_splash(0, params, &SOLID_SPLASH_math); +} # endif -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // !defined(ENABLE_RGB_MATRIX_SPLASH) && !defined(ENABLE_RGB_MATRIX_MULTISPLASH) -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +# endif // !defined(ENABLE_RGB_MATRIX_SPLASH) && !defined(ENABLE_RGB_MATRIX_MULTISPLASH) +#endif // RGB_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/rgb_matrix/animations/splash_anim.h b/quantum/rgb_matrix/animations/splash_anim.h index 382355e9ed..06459e1b0a 100644 --- a/quantum/rgb_matrix/animations/splash_anim.h +++ b/quantum/rgb_matrix/animations/splash_anim.h @@ -20,13 +20,17 @@ HSV SPLASH_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dist, uint16_t tick) { } # ifdef ENABLE_RGB_MATRIX_SPLASH -bool SPLASH(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SPLASH_math); } +bool SPLASH(effect_params_t* params) { + return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SPLASH_math); +} # endif # ifdef ENABLE_RGB_MATRIX_MULTISPLASH -bool MULTISPLASH(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SPLASH_math); } +bool MULTISPLASH(effect_params_t* params) { + return effect_runner_reactive_splash(0, params, &SPLASH_math); +} # endif -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -# endif // !defined(ENABLE_RGB_MATRIX_SPLASH) || !defined(ENABLE_RGB_MATRIX_MULTISPLASH) -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +# endif // !defined(ENABLE_RGB_MATRIX_SPLASH) || !defined(ENABLE_RGB_MATRIX_MULTISPLASH) +#endif // RGB_MATRIX_KEYREACTIVE_ENABLED diff --git a/quantum/rgb_matrix/animations/typing_heatmap_anim.h b/quantum/rgb_matrix/animations/typing_heatmap_anim.h index b66667b9b8..f3a94280c0 100644 --- a/quantum/rgb_matrix/animations/typing_heatmap_anim.h +++ b/quantum/rgb_matrix/animations/typing_heatmap_anim.h @@ -82,5 +82,5 @@ bool TYPING_HEATMAP(effect_params_t* params) { return led_max < sizeof(g_rgb_frame_buffer); } -# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS -#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP) +# endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS +#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP) diff --git a/quantum/rgb_matrix/rgb_matrix.c b/quantum/rgb_matrix/rgb_matrix.c index 5a4556f097..f721dfc7f2 100644 --- a/quantum/rgb_matrix/rgb_matrix.c +++ b/quantum/rgb_matrix/rgb_matrix.c @@ -31,7 +31,9 @@ const led_point_t k_rgb_matrix_center = {112, 32}; const led_point_t k_rgb_matrix_center = RGB_MATRIX_CENTER; #endif -__attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) { return hsv_to_rgb(hsv); } +__attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) { + return hsv_to_rgb(hsv); +} // Generic effect runners #include "rgb_matrix_runners.inc" @@ -109,14 +111,14 @@ __attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) { return hsv_to_rgb(hsv #endif // globals -rgb_config_t rgb_matrix_config; // TODO: would like to prefix this with g_ for global consistancy, do this in another pr +rgb_config_t rgb_matrix_config; // TODO: would like to prefix this with g_ for global consistancy, do this in another pr uint32_t g_rgb_timer; #ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS uint8_t g_rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS] = {{0}}; -#endif // RGB_MATRIX_FRAMEBUFFER_EFFECTS +#endif // RGB_MATRIX_FRAMEBUFFER_EFFECTS #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED last_hit_t g_last_hit_tracker; -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED +#endif // RGB_MATRIX_KEYREACTIVE_ENABLED // internals static bool suspend_state = false; @@ -126,13 +128,13 @@ static effect_params_t rgb_effect_params = {0, LED_FLAG_ALL, false}; static rgb_task_states rgb_task_state = SYNCING; #if RGB_DISABLE_TIMEOUT > 0 static uint32_t rgb_anykey_timer; -#endif // RGB_DISABLE_TIMEOUT > 0 +#endif // RGB_DISABLE_TIMEOUT > 0 // double buffers static uint32_t rgb_timer_buffer; #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED static last_hit_t last_hit_buffer; -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED +#endif // RGB_MATRIX_KEYREACTIVE_ENABLED // split rgb matrix #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) @@ -141,7 +143,9 @@ const uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT; EECONFIG_DEBOUNCE_HELPER(rgb_matrix, EECONFIG_RGB_MATRIX, rgb_matrix_config); -void eeconfig_update_rgb_matrix(void) { eeconfig_flush_rgb_matrix(true); } +void eeconfig_update_rgb_matrix(void) { + eeconfig_flush_rgb_matrix(true); +} void eeconfig_update_rgb_matrix_default(void) { dprintf("eeconfig_update_rgb_matrix_default\n"); @@ -168,13 +172,15 @@ void rgb_matrix_reload_from_eeprom(void) { rgb_matrix_disable_noeeprom(); /* Reset back to what we have in eeprom */ eeconfig_init_rgb_matrix(); - eeconfig_debug_rgb_matrix(); // display current eeprom values + eeconfig_debug_rgb_matrix(); // display current eeprom values if (rgb_matrix_config.enable) { rgb_matrix_mode_noeeprom(rgb_matrix_config.mode); } } -__attribute__((weak)) uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) { return 0; } +__attribute__((weak)) uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) { + return 0; +} uint8_t rgb_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i) { uint8_t led_count = rgb_matrix_map_row_column_to_led_kb(row, column, led_i); @@ -186,13 +192,18 @@ uint8_t rgb_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *l return led_count; } -void rgb_matrix_update_pwm_buffers(void) { rgb_matrix_driver.flush(); } +void rgb_matrix_update_pwm_buffers(void) { + rgb_matrix_driver.flush(); +} -void rgb_matrix_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { rgb_matrix_driver.set_color(index, red, green, blue); } +void rgb_matrix_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { + rgb_matrix_driver.set_color(index, red, green, blue); +} void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) - for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) rgb_matrix_set_color(i, red, green, blue); + for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) + rgb_matrix_set_color(i, red, green, blue); #else rgb_matrix_driver.set_color_all(red, green, blue); #endif @@ -204,7 +215,7 @@ void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) { #endif #if RGB_DISABLE_TIMEOUT > 0 rgb_anykey_timer = 0; -#endif // RGB_DISABLE_TIMEOUT > 0 +#endif // RGB_DISABLE_TIMEOUT > 0 #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED uint8_t led[LED_HITS_TO_REMEMBER]; @@ -214,7 +225,7 @@ void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) { if (!pressed) # elif defined(RGB_MATRIX_KEYPRESSES) if (pressed) -# endif // defined(RGB_MATRIX_KEYRELEASES) +# endif // defined(RGB_MATRIX_KEYRELEASES) { led_count = rgb_matrix_map_row_column_to_led(row, col, led); } @@ -222,7 +233,7 @@ void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) { if (last_hit_buffer.count + led_count > LED_HITS_TO_REMEMBER) { memcpy(&last_hit_buffer.x[0], &last_hit_buffer.x[led_count], LED_HITS_TO_REMEMBER - led_count); memcpy(&last_hit_buffer.y[0], &last_hit_buffer.y[led_count], LED_HITS_TO_REMEMBER - led_count); - memcpy(&last_hit_buffer.tick[0], &last_hit_buffer.tick[led_count], (LED_HITS_TO_REMEMBER - led_count) * 2); // 16 bit + memcpy(&last_hit_buffer.tick[0], &last_hit_buffer.tick[led_count], (LED_HITS_TO_REMEMBER - led_count) * 2); // 16 bit memcpy(&last_hit_buffer.index[0], &last_hit_buffer.index[led_count], LED_HITS_TO_REMEMBER - led_count); last_hit_buffer.count = LED_HITS_TO_REMEMBER - led_count; } @@ -235,13 +246,13 @@ void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) { last_hit_buffer.tick[index] = 0; last_hit_buffer.count++; } -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED +#endif // RGB_MATRIX_KEYREACTIVE_ENABLED #if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP) if (rgb_matrix_config.mode == RGB_MATRIX_TYPING_HEATMAP) { process_rgb_matrix_typing_heatmap(row, col); } -#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP) +#endif // defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP) } void rgb_matrix_test(void) { @@ -280,7 +291,7 @@ static bool rgb_matrix_none(effect_params_t *params) { static void rgb_task_timers(void) { #if defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_DISABLE_TIMEOUT > 0 uint32_t deltaTime = sync_timer_elapsed32(rgb_timer_buffer); -#endif // defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_DISABLE_TIMEOUT > 0 +#endif // defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_DISABLE_TIMEOUT > 0 rgb_timer_buffer = sync_timer_read32(); // Update double buffer timers @@ -288,7 +299,7 @@ static void rgb_task_timers(void) { if (rgb_anykey_timer + deltaTime <= UINT32_MAX) { rgb_anykey_timer += deltaTime; } -#endif // RGB_DISABLE_TIMEOUT > 0 +#endif // RGB_DISABLE_TIMEOUT > 0 // Update double buffer last hit timers #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED @@ -300,7 +311,7 @@ static void rgb_task_timers(void) { } last_hit_buffer.tick[i] += deltaTime; } -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED +#endif // RGB_MATRIX_KEYREACTIVE_ENABLED } static void rgb_task_sync(void) { @@ -317,7 +328,7 @@ static void rgb_task_start(void) { g_rgb_timer = rgb_timer_buffer; #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED g_last_hit_tracker = last_hit_buffer; -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED +#endif // RGB_MATRIX_KEYREACTIVE_ENABLED // next task rgb_task_state = RENDERING; @@ -403,7 +414,7 @@ void rgb_matrix_task(void) { bool suspend_backlight = suspend_state || #if RGB_DISABLE_TIMEOUT > 0 (rgb_anykey_timer > (uint32_t)RGB_DISABLE_TIMEOUT) || -#endif // RGB_DISABLE_TIMEOUT > 0 +#endif // RGB_DISABLE_TIMEOUT > 0 false; uint8_t effect = suspend_backlight || !rgb_matrix_config.enable ? 0 : rgb_matrix_config.mode; @@ -472,7 +483,7 @@ void rgb_matrix_init(void) { for (uint8_t i = 0; i < LED_HITS_TO_REMEMBER; ++i) { last_hit_buffer.tick[i] = UINT16_MAX; } -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED +#endif // RGB_MATRIX_KEYREACTIVE_ENABLED if (!eeconfig_is_enabled()) { dprintf("rgb_matrix_init_drivers eeconfig is not enabled.\n"); @@ -485,20 +496,22 @@ void rgb_matrix_init(void) { dprintf("rgb_matrix_init_drivers rgb_matrix_config.mode = 0. Write default values to EEPROM.\n"); eeconfig_update_rgb_matrix_default(); } - eeconfig_debug_rgb_matrix(); // display current eeprom values + eeconfig_debug_rgb_matrix(); // display current eeprom values } void rgb_matrix_set_suspend_state(bool state) { #ifdef RGB_DISABLE_WHEN_USB_SUSPENDED - if (state && !suspend_state) { // only run if turning off, and only once - rgb_task_render(0); // turn off all LEDs when suspending - rgb_task_flush(0); // and actually flash led state to LEDs + if (state && !suspend_state) { // only run if turning off, and only once + rgb_task_render(0); // turn off all LEDs when suspending + rgb_task_flush(0); // and actually flash led state to LEDs } suspend_state = state; #endif } -bool rgb_matrix_get_suspend_state(void) { return suspend_state; } +bool rgb_matrix_get_suspend_state(void) { + return suspend_state; +} void rgb_matrix_toggle_eeprom_helper(bool write_to_eeprom) { rgb_matrix_config.enable ^= 1; @@ -506,8 +519,12 @@ void rgb_matrix_toggle_eeprom_helper(bool write_to_eeprom) { eeconfig_flag_rgb_matrix(write_to_eeprom); dprintf("rgb matrix toggle [%s]: rgb_matrix_config.enable = %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.enable); } -void rgb_matrix_toggle_noeeprom(void) { rgb_matrix_toggle_eeprom_helper(false); } -void rgb_matrix_toggle(void) { rgb_matrix_toggle_eeprom_helper(true); } +void rgb_matrix_toggle_noeeprom(void) { + rgb_matrix_toggle_eeprom_helper(false); +} +void rgb_matrix_toggle(void) { + rgb_matrix_toggle_eeprom_helper(true); +} void rgb_matrix_enable(void) { rgb_matrix_enable_noeeprom(); @@ -529,7 +546,9 @@ void rgb_matrix_disable_noeeprom(void) { rgb_matrix_config.enable = 0; } -uint8_t rgb_matrix_is_enabled(void) { return rgb_matrix_config.enable; } +uint8_t rgb_matrix_is_enabled(void) { + return rgb_matrix_config.enable; +} void rgb_matrix_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) { if (!rgb_matrix_config.enable) { @@ -546,24 +565,38 @@ void rgb_matrix_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) { eeconfig_flag_rgb_matrix(write_to_eeprom); dprintf("rgb matrix mode [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.mode); } -void rgb_matrix_mode_noeeprom(uint8_t mode) { rgb_matrix_mode_eeprom_helper(mode, false); } -void rgb_matrix_mode(uint8_t mode) { rgb_matrix_mode_eeprom_helper(mode, true); } +void rgb_matrix_mode_noeeprom(uint8_t mode) { + rgb_matrix_mode_eeprom_helper(mode, false); +} +void rgb_matrix_mode(uint8_t mode) { + rgb_matrix_mode_eeprom_helper(mode, true); +} -uint8_t rgb_matrix_get_mode(void) { return rgb_matrix_config.mode; } +uint8_t rgb_matrix_get_mode(void) { + return rgb_matrix_config.mode; +} void rgb_matrix_step_helper(bool write_to_eeprom) { uint8_t mode = rgb_matrix_config.mode + 1; rgb_matrix_mode_eeprom_helper((mode < RGB_MATRIX_EFFECT_MAX) ? mode : 1, write_to_eeprom); } -void rgb_matrix_step_noeeprom(void) { rgb_matrix_step_helper(false); } -void rgb_matrix_step(void) { rgb_matrix_step_helper(true); } +void rgb_matrix_step_noeeprom(void) { + rgb_matrix_step_helper(false); +} +void rgb_matrix_step(void) { + rgb_matrix_step_helper(true); +} void rgb_matrix_step_reverse_helper(bool write_to_eeprom) { uint8_t mode = rgb_matrix_config.mode - 1; rgb_matrix_mode_eeprom_helper((mode < 1) ? RGB_MATRIX_EFFECT_MAX - 1 : mode, write_to_eeprom); } -void rgb_matrix_step_reverse_noeeprom(void) { rgb_matrix_step_reverse_helper(false); } -void rgb_matrix_step_reverse(void) { rgb_matrix_step_reverse_helper(true); } +void rgb_matrix_step_reverse_noeeprom(void) { + rgb_matrix_step_reverse_helper(false); +} +void rgb_matrix_step_reverse(void) { + rgb_matrix_step_reverse_helper(true); +} void rgb_matrix_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom) { if (!rgb_matrix_config.enable) { @@ -575,56 +608,126 @@ void rgb_matrix_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, boo eeconfig_flag_rgb_matrix(write_to_eeprom); dprintf("rgb matrix set hsv [%s]: %u,%u,%u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v); } -void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) { rgb_matrix_sethsv_eeprom_helper(hue, sat, val, false); } -void rgb_matrix_sethsv(uint16_t hue, uint8_t sat, uint8_t val) { rgb_matrix_sethsv_eeprom_helper(hue, sat, val, true); } +void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) { + rgb_matrix_sethsv_eeprom_helper(hue, sat, val, false); +} +void rgb_matrix_sethsv(uint16_t hue, uint8_t sat, uint8_t val) { + rgb_matrix_sethsv_eeprom_helper(hue, sat, val, true); +} -HSV rgb_matrix_get_hsv(void) { return rgb_matrix_config.hsv; } -uint8_t rgb_matrix_get_hue(void) { return rgb_matrix_config.hsv.h; } -uint8_t rgb_matrix_get_sat(void) { return rgb_matrix_config.hsv.s; } -uint8_t rgb_matrix_get_val(void) { return rgb_matrix_config.hsv.v; } +HSV rgb_matrix_get_hsv(void) { + return rgb_matrix_config.hsv; +} +uint8_t rgb_matrix_get_hue(void) { + return rgb_matrix_config.hsv.h; +} +uint8_t rgb_matrix_get_sat(void) { + return rgb_matrix_config.hsv.s; +} +uint8_t rgb_matrix_get_val(void) { + return rgb_matrix_config.hsv.v; +} -void rgb_matrix_increase_hue_helper(bool write_to_eeprom) { rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h + RGB_MATRIX_HUE_STEP, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v, write_to_eeprom); } -void rgb_matrix_increase_hue_noeeprom(void) { rgb_matrix_increase_hue_helper(false); } -void rgb_matrix_increase_hue(void) { rgb_matrix_increase_hue_helper(true); } +void rgb_matrix_increase_hue_helper(bool write_to_eeprom) { + rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h + RGB_MATRIX_HUE_STEP, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v, write_to_eeprom); +} +void rgb_matrix_increase_hue_noeeprom(void) { + rgb_matrix_increase_hue_helper(false); +} +void rgb_matrix_increase_hue(void) { + rgb_matrix_increase_hue_helper(true); +} -void rgb_matrix_decrease_hue_helper(bool write_to_eeprom) { rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h - RGB_MATRIX_HUE_STEP, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v, write_to_eeprom); } -void rgb_matrix_decrease_hue_noeeprom(void) { rgb_matrix_decrease_hue_helper(false); } -void rgb_matrix_decrease_hue(void) { rgb_matrix_decrease_hue_helper(true); } +void rgb_matrix_decrease_hue_helper(bool write_to_eeprom) { + rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h - RGB_MATRIX_HUE_STEP, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v, write_to_eeprom); +} +void rgb_matrix_decrease_hue_noeeprom(void) { + rgb_matrix_decrease_hue_helper(false); +} +void rgb_matrix_decrease_hue(void) { + rgb_matrix_decrease_hue_helper(true); +} -void rgb_matrix_increase_sat_helper(bool write_to_eeprom) { rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, qadd8(rgb_matrix_config.hsv.s, RGB_MATRIX_SAT_STEP), rgb_matrix_config.hsv.v, write_to_eeprom); } -void rgb_matrix_increase_sat_noeeprom(void) { rgb_matrix_increase_sat_helper(false); } -void rgb_matrix_increase_sat(void) { rgb_matrix_increase_sat_helper(true); } +void rgb_matrix_increase_sat_helper(bool write_to_eeprom) { + rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, qadd8(rgb_matrix_config.hsv.s, RGB_MATRIX_SAT_STEP), rgb_matrix_config.hsv.v, write_to_eeprom); +} +void rgb_matrix_increase_sat_noeeprom(void) { + rgb_matrix_increase_sat_helper(false); +} +void rgb_matrix_increase_sat(void) { + rgb_matrix_increase_sat_helper(true); +} -void rgb_matrix_decrease_sat_helper(bool write_to_eeprom) { rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, qsub8(rgb_matrix_config.hsv.s, RGB_MATRIX_SAT_STEP), rgb_matrix_config.hsv.v, write_to_eeprom); } -void rgb_matrix_decrease_sat_noeeprom(void) { rgb_matrix_decrease_sat_helper(false); } -void rgb_matrix_decrease_sat(void) { rgb_matrix_decrease_sat_helper(true); } +void rgb_matrix_decrease_sat_helper(bool write_to_eeprom) { + rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, qsub8(rgb_matrix_config.hsv.s, RGB_MATRIX_SAT_STEP), rgb_matrix_config.hsv.v, write_to_eeprom); +} +void rgb_matrix_decrease_sat_noeeprom(void) { + rgb_matrix_decrease_sat_helper(false); +} +void rgb_matrix_decrease_sat(void) { + rgb_matrix_decrease_sat_helper(true); +} -void rgb_matrix_increase_val_helper(bool write_to_eeprom) { rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, qadd8(rgb_matrix_config.hsv.v, RGB_MATRIX_VAL_STEP), write_to_eeprom); } -void rgb_matrix_increase_val_noeeprom(void) { rgb_matrix_increase_val_helper(false); } -void rgb_matrix_increase_val(void) { rgb_matrix_increase_val_helper(true); } +void rgb_matrix_increase_val_helper(bool write_to_eeprom) { + rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, qadd8(rgb_matrix_config.hsv.v, RGB_MATRIX_VAL_STEP), write_to_eeprom); +} +void rgb_matrix_increase_val_noeeprom(void) { + rgb_matrix_increase_val_helper(false); +} +void rgb_matrix_increase_val(void) { + rgb_matrix_increase_val_helper(true); +} -void rgb_matrix_decrease_val_helper(bool write_to_eeprom) { rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, qsub8(rgb_matrix_config.hsv.v, RGB_MATRIX_VAL_STEP), write_to_eeprom); } -void rgb_matrix_decrease_val_noeeprom(void) { rgb_matrix_decrease_val_helper(false); } -void rgb_matrix_decrease_val(void) { rgb_matrix_decrease_val_helper(true); } +void rgb_matrix_decrease_val_helper(bool write_to_eeprom) { + rgb_matrix_sethsv_eeprom_helper(rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, qsub8(rgb_matrix_config.hsv.v, RGB_MATRIX_VAL_STEP), write_to_eeprom); +} +void rgb_matrix_decrease_val_noeeprom(void) { + rgb_matrix_decrease_val_helper(false); +} +void rgb_matrix_decrease_val(void) { + rgb_matrix_decrease_val_helper(true); +} void rgb_matrix_set_speed_eeprom_helper(uint8_t speed, bool write_to_eeprom) { rgb_matrix_config.speed = speed; eeconfig_flag_rgb_matrix(write_to_eeprom); dprintf("rgb matrix set speed [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", rgb_matrix_config.speed); } -void rgb_matrix_set_speed_noeeprom(uint8_t speed) { rgb_matrix_set_speed_eeprom_helper(speed, false); } -void rgb_matrix_set_speed(uint8_t speed) { rgb_matrix_set_speed_eeprom_helper(speed, true); } +void rgb_matrix_set_speed_noeeprom(uint8_t speed) { + rgb_matrix_set_speed_eeprom_helper(speed, false); +} +void rgb_matrix_set_speed(uint8_t speed) { + rgb_matrix_set_speed_eeprom_helper(speed, true); +} -uint8_t rgb_matrix_get_speed(void) { return rgb_matrix_config.speed; } +uint8_t rgb_matrix_get_speed(void) { + return rgb_matrix_config.speed; +} -void rgb_matrix_increase_speed_helper(bool write_to_eeprom) { rgb_matrix_set_speed_eeprom_helper(qadd8(rgb_matrix_config.speed, RGB_MATRIX_SPD_STEP), write_to_eeprom); } -void rgb_matrix_increase_speed_noeeprom(void) { rgb_matrix_increase_speed_helper(false); } -void rgb_matrix_increase_speed(void) { rgb_matrix_increase_speed_helper(true); } +void rgb_matrix_increase_speed_helper(bool write_to_eeprom) { + rgb_matrix_set_speed_eeprom_helper(qadd8(rgb_matrix_config.speed, RGB_MATRIX_SPD_STEP), write_to_eeprom); +} +void rgb_matrix_increase_speed_noeeprom(void) { + rgb_matrix_increase_speed_helper(false); +} +void rgb_matrix_increase_speed(void) { + rgb_matrix_increase_speed_helper(true); +} -void rgb_matrix_decrease_speed_helper(bool write_to_eeprom) { rgb_matrix_set_speed_eeprom_helper(qsub8(rgb_matrix_config.speed, RGB_MATRIX_SPD_STEP), write_to_eeprom); } -void rgb_matrix_decrease_speed_noeeprom(void) { rgb_matrix_decrease_speed_helper(false); } -void rgb_matrix_decrease_speed(void) { rgb_matrix_decrease_speed_helper(true); } +void rgb_matrix_decrease_speed_helper(bool write_to_eeprom) { + rgb_matrix_set_speed_eeprom_helper(qsub8(rgb_matrix_config.speed, RGB_MATRIX_SPD_STEP), write_to_eeprom); +} +void rgb_matrix_decrease_speed_noeeprom(void) { + rgb_matrix_decrease_speed_helper(false); +} +void rgb_matrix_decrease_speed(void) { + rgb_matrix_decrease_speed_helper(true); +} -led_flags_t rgb_matrix_get_flags(void) { return rgb_matrix_config.flags; } +led_flags_t rgb_matrix_get_flags(void) { + return rgb_matrix_config.flags; +} -void rgb_matrix_set_flags(led_flags_t flags) { rgb_matrix_config.flags = flags; } +void rgb_matrix_set_flags(led_flags_t flags) { + rgb_matrix_config.flags = flags; +} diff --git a/quantum/rgb_matrix/rgb_matrix_types.h b/quantum/rgb_matrix/rgb_matrix_types.h index df575d6577..d0ac4e4466 100644 --- a/quantum/rgb_matrix/rgb_matrix_types.h +++ b/quantum/rgb_matrix/rgb_matrix_types.h @@ -37,7 +37,7 @@ // Last led hit #ifndef LED_HITS_TO_REMEMBER # define LED_HITS_TO_REMEMBER 8 -#endif // LED_HITS_TO_REMEMBER +#endif // LED_HITS_TO_REMEMBER #ifdef RGB_MATRIX_KEYREACTIVE_ENABLED typedef struct PACKED { @@ -47,7 +47,7 @@ typedef struct PACKED { uint8_t index[LED_HITS_TO_REMEMBER]; uint16_t tick[LED_HITS_TO_REMEMBER]; } last_hit_t; -#endif // RGB_MATRIX_KEYREACTIVE_ENABLED +#endif // RGB_MATRIX_KEYREACTIVE_ENABLED typedef enum rgb_task_states { STARTING, RENDERING, FLUSHING, SYNCING } rgb_task_states; @@ -88,7 +88,7 @@ typedef union { uint8_t enable : 2; uint8_t mode : 6; HSV hsv; - uint8_t speed; // EECONFIG needs to be increased to support this + uint8_t speed; // EECONFIG needs to be increased to support this led_flags_t flags; }; } rgb_config_t; diff --git a/quantum/rgblight/rgblight.c b/quantum/rgblight/rgblight.c index 148dae78f4..8f933a6e51 100644 --- a/quantum/rgblight/rgblight.c +++ b/quantum/rgblight/rgblight.c @@ -72,7 +72,7 @@ static uint8_t static_effect_table[] = { #define _RGBM_TMP_STATIC(sym, msym) RGBLIGHT_MODE_##msym, #define _RGBM_TMP_DYNAMIC(sym, msym) RGBLIGHT_MODE_##msym, static uint8_t mode_base_table[] = { - 0, // RGBLIGHT_MODE_zero + 0, // RGBLIGHT_MODE_zero #include "rgblight_modes.h" }; @@ -96,7 +96,9 @@ static uint8_t mode_base_table[] = { # define RGBLIGHT_DEFAULT_SPD 0 #endif -static inline int is_static_effect(uint8_t mode) { return memchr(static_effect_table, mode, sizeof(static_effect_table)) != NULL; } +static inline int is_static_effect(uint8_t mode) { + return memchr(static_effect_table, mode, sizeof(static_effect_table)) != NULL; +} #ifdef RGBLIGHT_LED_MAP const uint8_t led_map[] PROGMEM = RGBLIGHT_LED_MAP; @@ -143,7 +145,9 @@ void rgblight_set_effect_range(uint8_t start_pos, uint8_t num_leds) { rgblight_ranges.effect_num_leds = num_leds; } -__attribute__((weak)) RGB rgblight_hsv_to_rgb(HSV hsv) { return hsv_to_rgb(hsv); } +__attribute__((weak)) RGB rgblight_hsv_to_rgb(HSV hsv) { + return hsv_to_rgb(hsv); +} void sethsv_raw(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) { HSV hsv = {hue, sat, val}; @@ -151,7 +155,9 @@ void sethsv_raw(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) { setrgb(rgb.r, rgb.g, rgb.b, led1); } -void sethsv(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) { sethsv_raw(hue, sat, val > RGBLIGHT_LIMIT_VAL ? RGBLIGHT_LIMIT_VAL : val, led1); } +void sethsv(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) { + sethsv_raw(hue, sat, val > RGBLIGHT_LIMIT_VAL ? RGBLIGHT_LIMIT_VAL : val, led1); +} void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1) { led1->r = r; @@ -191,7 +197,9 @@ void eeconfig_update_rgblight(uint32_t val) { #endif } -void eeconfig_update_rgblight_current(void) { eeconfig_update_rgblight(rgblight_config.raw); } +void eeconfig_update_rgblight_current(void) { + eeconfig_update_rgblight(rgblight_config.raw); +} void eeconfig_update_rgblight_default(void) { rgblight_config.enable = 1; @@ -238,9 +246,9 @@ void rgblight_init(void) { } rgblight_check_config(); - eeconfig_debug_rgblight(); // display current eeprom values + eeconfig_debug_rgblight(); // display current eeprom values - rgblight_timer_init(); // setup the timer + rgblight_timer_init(); // setup the timer if (rgblight_config.enable) { rgblight_mode_noeeprom(rgblight_config.mode); @@ -254,13 +262,15 @@ void rgblight_reload_from_eeprom(void) { rgblight_config.raw = eeconfig_read_rgblight(); RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS; rgblight_check_config(); - eeconfig_debug_rgblight(); // display current eeprom values + eeconfig_debug_rgblight(); // display current eeprom values if (rgblight_config.enable) { rgblight_mode_noeeprom(rgblight_config.mode); } } -uint32_t rgblight_read_dword(void) { return rgblight_config.raw; } +uint32_t rgblight_read_dword(void) { + return rgblight_config.raw; +} void rgblight_update_dword(uint32_t dword) { RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS; @@ -296,8 +306,12 @@ void rgblight_step_helper(bool write_to_eeprom) { } rgblight_mode_eeprom_helper(mode, write_to_eeprom); } -void rgblight_step_noeeprom(void) { rgblight_step_helper(false); } -void rgblight_step(void) { rgblight_step_helper(true); } +void rgblight_step_noeeprom(void) { + rgblight_step_helper(false); +} +void rgblight_step(void) { + rgblight_step_helper(true); +} void rgblight_step_reverse_helper(bool write_to_eeprom) { uint8_t mode = 0; mode = rgblight_config.mode - 1; @@ -306,8 +320,12 @@ void rgblight_step_reverse_helper(bool write_to_eeprom) { } rgblight_mode_eeprom_helper(mode, write_to_eeprom); } -void rgblight_step_reverse_noeeprom(void) { rgblight_step_reverse_helper(false); } -void rgblight_step_reverse(void) { rgblight_step_reverse_helper(true); } +void rgblight_step_reverse_noeeprom(void) { + rgblight_step_reverse_helper(false); +} +void rgblight_step_reverse(void) { + rgblight_step_reverse_helper(true); +} uint8_t rgblight_get_mode(void) { if (!rgblight_config.enable) { @@ -346,9 +364,13 @@ void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) { rgblight_sethsv_noeeprom(rgblight_config.hue, rgblight_config.sat, rgblight_config.val); } -void rgblight_mode(uint8_t mode) { rgblight_mode_eeprom_helper(mode, true); } +void rgblight_mode(uint8_t mode) { + rgblight_mode_eeprom_helper(mode, true); +} -void rgblight_mode_noeeprom(uint8_t mode) { rgblight_mode_eeprom_helper(mode, false); } +void rgblight_mode_noeeprom(uint8_t mode) { + rgblight_mode_eeprom_helper(mode, false); +} void rgblight_toggle(void) { dprintf("rgblight toggle [EEPROM]: rgblight_config.enable = %u\n", !rgblight_config.enable); @@ -401,64 +423,98 @@ void rgblight_disable_noeeprom(void) { rgblight_set(); } -bool rgblight_is_enabled(void) { return rgblight_config.enable; } +bool rgblight_is_enabled(void) { + return rgblight_config.enable; +} void rgblight_increase_hue_helper(bool write_to_eeprom) { uint8_t hue = rgblight_config.hue + RGBLIGHT_HUE_STEP; rgblight_sethsv_eeprom_helper(hue, rgblight_config.sat, rgblight_config.val, write_to_eeprom); } -void rgblight_increase_hue_noeeprom(void) { rgblight_increase_hue_helper(false); } -void rgblight_increase_hue(void) { rgblight_increase_hue_helper(true); } +void rgblight_increase_hue_noeeprom(void) { + rgblight_increase_hue_helper(false); +} +void rgblight_increase_hue(void) { + rgblight_increase_hue_helper(true); +} void rgblight_decrease_hue_helper(bool write_to_eeprom) { uint8_t hue = rgblight_config.hue - RGBLIGHT_HUE_STEP; rgblight_sethsv_eeprom_helper(hue, rgblight_config.sat, rgblight_config.val, write_to_eeprom); } -void rgblight_decrease_hue_noeeprom(void) { rgblight_decrease_hue_helper(false); } -void rgblight_decrease_hue(void) { rgblight_decrease_hue_helper(true); } +void rgblight_decrease_hue_noeeprom(void) { + rgblight_decrease_hue_helper(false); +} +void rgblight_decrease_hue(void) { + rgblight_decrease_hue_helper(true); +} void rgblight_increase_sat_helper(bool write_to_eeprom) { uint8_t sat = qadd8(rgblight_config.sat, RGBLIGHT_SAT_STEP); rgblight_sethsv_eeprom_helper(rgblight_config.hue, sat, rgblight_config.val, write_to_eeprom); } -void rgblight_increase_sat_noeeprom(void) { rgblight_increase_sat_helper(false); } -void rgblight_increase_sat(void) { rgblight_increase_sat_helper(true); } +void rgblight_increase_sat_noeeprom(void) { + rgblight_increase_sat_helper(false); +} +void rgblight_increase_sat(void) { + rgblight_increase_sat_helper(true); +} void rgblight_decrease_sat_helper(bool write_to_eeprom) { uint8_t sat = qsub8(rgblight_config.sat, RGBLIGHT_SAT_STEP); rgblight_sethsv_eeprom_helper(rgblight_config.hue, sat, rgblight_config.val, write_to_eeprom); } -void rgblight_decrease_sat_noeeprom(void) { rgblight_decrease_sat_helper(false); } -void rgblight_decrease_sat(void) { rgblight_decrease_sat_helper(true); } +void rgblight_decrease_sat_noeeprom(void) { + rgblight_decrease_sat_helper(false); +} +void rgblight_decrease_sat(void) { + rgblight_decrease_sat_helper(true); +} void rgblight_increase_val_helper(bool write_to_eeprom) { uint8_t val = qadd8(rgblight_config.val, RGBLIGHT_VAL_STEP); rgblight_sethsv_eeprom_helper(rgblight_config.hue, rgblight_config.sat, val, write_to_eeprom); } -void rgblight_increase_val_noeeprom(void) { rgblight_increase_val_helper(false); } -void rgblight_increase_val(void) { rgblight_increase_val_helper(true); } +void rgblight_increase_val_noeeprom(void) { + rgblight_increase_val_helper(false); +} +void rgblight_increase_val(void) { + rgblight_increase_val_helper(true); +} void rgblight_decrease_val_helper(bool write_to_eeprom) { uint8_t val = qsub8(rgblight_config.val, RGBLIGHT_VAL_STEP); rgblight_sethsv_eeprom_helper(rgblight_config.hue, rgblight_config.sat, val, write_to_eeprom); } -void rgblight_decrease_val_noeeprom(void) { rgblight_decrease_val_helper(false); } -void rgblight_decrease_val(void) { rgblight_decrease_val_helper(true); } +void rgblight_decrease_val_noeeprom(void) { + rgblight_decrease_val_helper(false); +} +void rgblight_decrease_val(void) { + rgblight_decrease_val_helper(true); +} void rgblight_increase_speed_helper(bool write_to_eeprom) { if (rgblight_config.speed < 3) rgblight_config.speed++; // RGBLIGHT_SPLIT_SET_CHANGE_HSVS; // NEED? if (write_to_eeprom) { - eeconfig_update_rgblight(rgblight_config.raw); // EECONFIG needs to be increased to support this + eeconfig_update_rgblight(rgblight_config.raw); // EECONFIG needs to be increased to support this } } -void rgblight_increase_speed(void) { rgblight_increase_speed_helper(true); } -void rgblight_increase_speed_noeeprom(void) { rgblight_increase_speed_helper(false); } +void rgblight_increase_speed(void) { + rgblight_increase_speed_helper(true); +} +void rgblight_increase_speed_noeeprom(void) { + rgblight_increase_speed_helper(false); +} void rgblight_decrease_speed_helper(bool write_to_eeprom) { if (rgblight_config.speed > 0) rgblight_config.speed--; // RGBLIGHT_SPLIT_SET_CHANGE_HSVS; // NEED?? if (write_to_eeprom) { - eeconfig_update_rgblight(rgblight_config.raw); // EECONFIG needs to be increased to support this + eeconfig_update_rgblight(rgblight_config.raw); // EECONFIG needs to be increased to support this } } -void rgblight_decrease_speed(void) { rgblight_decrease_speed_helper(true); } -void rgblight_decrease_speed_noeeprom(void) { rgblight_decrease_speed_helper(false); } +void rgblight_decrease_speed(void) { + rgblight_decrease_speed_helper(true); +} +void rgblight_decrease_speed_noeeprom(void) { + rgblight_decrease_speed_helper(false); +} void rgblight_sethsv_noeeprom_old(uint8_t hue, uint8_t sat, uint8_t val) { if (rgblight_config.enable) { @@ -478,7 +534,7 @@ void rgblight_sethsv_eeprom_helper(uint8_t hue, uint8_t sat, uint8_t val, bool w rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b); } else { // all LEDs in same color - if (1 == 0) { // dummy + if (1 == 0) { // dummy } #ifdef RGBLIGHT_EFFECT_BREATHING else if (rgblight_status.base_mode == RGBLIGHT_MODE_BREATHING) { @@ -540,33 +596,51 @@ void rgblight_sethsv_eeprom_helper(uint8_t hue, uint8_t sat, uint8_t val, bool w } } -void rgblight_sethsv(uint8_t hue, uint8_t sat, uint8_t val) { rgblight_sethsv_eeprom_helper(hue, sat, val, true); } +void rgblight_sethsv(uint8_t hue, uint8_t sat, uint8_t val) { + rgblight_sethsv_eeprom_helper(hue, sat, val, true); +} -void rgblight_sethsv_noeeprom(uint8_t hue, uint8_t sat, uint8_t val) { rgblight_sethsv_eeprom_helper(hue, sat, val, false); } +void rgblight_sethsv_noeeprom(uint8_t hue, uint8_t sat, uint8_t val) { + rgblight_sethsv_eeprom_helper(hue, sat, val, false); +} -uint8_t rgblight_get_speed(void) { return rgblight_config.speed; } +uint8_t rgblight_get_speed(void) { + return rgblight_config.speed; +} void rgblight_set_speed_eeprom_helper(uint8_t speed, bool write_to_eeprom) { rgblight_config.speed = speed; if (write_to_eeprom) { - eeconfig_update_rgblight(rgblight_config.raw); // EECONFIG needs to be increased to support this + eeconfig_update_rgblight(rgblight_config.raw); // EECONFIG needs to be increased to support this dprintf("rgblight set speed [EEPROM]: %u\n", rgblight_config.speed); } else { dprintf("rgblight set speed [NOEEPROM]: %u\n", rgblight_config.speed); } } -void rgblight_set_speed(uint8_t speed) { rgblight_set_speed_eeprom_helper(speed, true); } +void rgblight_set_speed(uint8_t speed) { + rgblight_set_speed_eeprom_helper(speed, true); +} -void rgblight_set_speed_noeeprom(uint8_t speed) { rgblight_set_speed_eeprom_helper(speed, false); } +void rgblight_set_speed_noeeprom(uint8_t speed) { + rgblight_set_speed_eeprom_helper(speed, false); +} -uint8_t rgblight_get_hue(void) { return rgblight_config.hue; } +uint8_t rgblight_get_hue(void) { + return rgblight_config.hue; +} -uint8_t rgblight_get_sat(void) { return rgblight_config.sat; } +uint8_t rgblight_get_sat(void) { + return rgblight_config.sat; +} -uint8_t rgblight_get_val(void) { return rgblight_config.val; } +uint8_t rgblight_get_val(void) { + return rgblight_config.val; +} -HSV rgblight_get_hsv(void) { return (HSV){rgblight_config.hue, rgblight_config.sat, rgblight_config.val}; } +HSV rgblight_get_hsv(void) { + return (HSV){rgblight_config.hue, rgblight_config.sat, rgblight_config.val}; +} void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) { if (!rgblight_config.enable) { @@ -648,14 +722,22 @@ void rgblight_sethsv_range(uint8_t hue, uint8_t sat, uint8_t val, uint8_t start, } #ifndef RGBLIGHT_SPLIT -void rgblight_setrgb_master(uint8_t r, uint8_t g, uint8_t b) { rgblight_setrgb_range(r, g, b, 0, (uint8_t)RGBLED_NUM / 2); } +void rgblight_setrgb_master(uint8_t r, uint8_t g, uint8_t b) { + rgblight_setrgb_range(r, g, b, 0, (uint8_t)RGBLED_NUM / 2); +} -void rgblight_setrgb_slave(uint8_t r, uint8_t g, uint8_t b) { rgblight_setrgb_range(r, g, b, (uint8_t)RGBLED_NUM / 2, (uint8_t)RGBLED_NUM); } +void rgblight_setrgb_slave(uint8_t r, uint8_t g, uint8_t b) { + rgblight_setrgb_range(r, g, b, (uint8_t)RGBLED_NUM / 2, (uint8_t)RGBLED_NUM); +} -void rgblight_sethsv_master(uint8_t hue, uint8_t sat, uint8_t val) { rgblight_sethsv_range(hue, sat, val, 0, (uint8_t)RGBLED_NUM / 2); } +void rgblight_sethsv_master(uint8_t hue, uint8_t sat, uint8_t val) { + rgblight_sethsv_range(hue, sat, val, 0, (uint8_t)RGBLED_NUM / 2); +} -void rgblight_sethsv_slave(uint8_t hue, uint8_t sat, uint8_t val) { rgblight_sethsv_range(hue, sat, val, (uint8_t)RGBLED_NUM / 2, (uint8_t)RGBLED_NUM); } -#endif // ifndef RGBLIGHT_SPLIT +void rgblight_sethsv_slave(uint8_t hue, uint8_t sat, uint8_t val) { + rgblight_sethsv_range(hue, sat, val, (uint8_t)RGBLED_NUM / 2, (uint8_t)RGBLED_NUM); +} +#endif // ifndef RGBLIGHT_SPLIT #ifdef RGBLIGHT_LAYERS void rgblight_set_layer_state(uint8_t layer, bool enabled) { @@ -693,18 +775,18 @@ static void rgblight_layers_write(void) { // For each layer for (const rgblight_segment_t *const *layer_ptr = rgblight_layers; i < RGBLIGHT_MAX_LAYERS; layer_ptr++, i++) { if (!rgblight_get_layer_state(i)) { - continue; // Layer is disabled + continue; // Layer is disabled } const rgblight_segment_t *segment_ptr = pgm_read_ptr(layer_ptr); if (segment_ptr == NULL) { - break; // No more layers + break; // No more layers } // For each segment while (1) { rgblight_segment_t segment; memcpy_P(&segment, segment_ptr, sizeof(rgblight_segment_t)); if (segment.index == RGBLIGHT_END_SEGMENT_INDEX) { - break; // No more segments + break; // No more segments } // Write segment.count LEDs LED_TYPE *const limit = &led[MIN(segment.index + segment.count, RGBLED_NUM)]; @@ -726,7 +808,9 @@ static uint16_t _repeat_timer; static uint8_t _times_remaining; static uint16_t _dur; -void rgblight_blink_layer(uint8_t layer, uint16_t duration_ms) { rgblight_blink_layer_repeat(layer, duration_ms, 1); } +void rgblight_blink_layer(uint8_t layer, uint16_t duration_ms) { + rgblight_blink_layer_repeat(layer, duration_ms, 1); +} void rgblight_blink_layer_repeat(uint8_t layer, uint16_t duration_ms, uint8_t times) { _times_remaining = times * 2; @@ -796,7 +880,9 @@ void rgblight_wakeup(void) { #endif -__attribute__((weak)) void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) { ws2812_setleds(start_led, num_leds); } +__attribute__((weak)) void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) { + ws2812_setleds(start_led, num_leds); +} #ifndef RGBLIGHT_CUSTOM_DRIVER @@ -848,9 +934,13 @@ void rgblight_set(void) { #ifdef RGBLIGHT_SPLIT /* for split keyboard master side */ -uint8_t rgblight_get_change_flags(void) { return rgblight_status.change_flags; } +uint8_t rgblight_get_change_flags(void) { + return rgblight_status.change_flags; +} -void rgblight_clear_change_flags(void) { rgblight_status.change_flags = 0; } +void rgblight_clear_change_flags(void) { + rgblight_status.change_flags = 0; +} void rgblight_get_syncinfo(rgblight_syncinfo_t *syncinfo) { syncinfo->config = rgblight_config; @@ -866,7 +956,7 @@ void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom) { # endif if (syncinfo->status.change_flags & RGBLIGHT_STATUS_CHANGE_MODE) { if (syncinfo->config.enable) { - rgblight_config.enable = 1; // == rgblight_enable_noeeprom(); + rgblight_config.enable = 1; // == rgblight_enable_noeeprom(); rgblight_mode_eeprom_helper(syncinfo->config.mode, write_to_eeprom); } else { rgblight_disable_noeeprom(); @@ -945,12 +1035,12 @@ static void rgblight_effect_dummy(animation_status_t *anim) { void rgblight_task(void) { if (rgblight_status.timer_enabled) { effect_func_t effect_func = rgblight_effect_dummy; - uint16_t interval_time = 2000; // dummy interval + uint16_t interval_time = 2000; // dummy interval uint8_t delta = rgblight_config.mode - rgblight_status.base_mode; animation_status.delta = delta; // static light mode, do nothing here - if (1 == 0) { // dummy + if (1 == 0) { // dummy } # ifdef RGBLIGHT_EFFECT_BREATHING else if (rgblight_status.base_mode == RGBLIGHT_MODE_BREATHING) { @@ -1016,7 +1106,7 @@ void rgblight_task(void) { if (animation_status.restart) { animation_status.restart = false; animation_status.last_timer = sync_timer_read(); - animation_status.pos16 = 0; // restart signal to local each effect + animation_status.pos16 = 0; // restart signal to local each effect } uint16_t now = sync_timer_read(); if (timer_expired(now, animation_status.last_timer)) { @@ -1055,7 +1145,7 @@ void rgblight_task(void) { # ifndef RGBLIGHT_EFFECT_BREATHE_CENTER # ifndef RGBLIGHT_BREATHE_TABLE_SIZE -# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256 or 128 or 64 +# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256 or 128 or 64 # endif # include <rgblight_breathe_table.h> # endif @@ -1131,7 +1221,7 @@ void rgblight_effect_snake(animation_status_t *anim) { } # if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) - if (anim->pos == 0) { // restart signal + if (anim->pos == 0) { // restart signal if (increment == 1) { pos = rgblight_ranges.effect_num_leds - 1; } else { @@ -1194,7 +1284,7 @@ void rgblight_effect_knight(animation_status_t *anim) { uint8_t i, cur; # if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) - if (anim->pos == 0) { // restart signal + if (anim->pos == 0) { // restart signal anim->pos = 1; low_bound = 0; high_bound = RGBLIGHT_EFFECT_KNIGHT_LENGTH - 1; @@ -1347,8 +1437,12 @@ void rgblight_effect_twinkle(animation_status_t *anim) { const uint8_t bottom = breathe_calc(0); const uint8_t top = breathe_calc(127); - uint8_t frac(uint8_t n, uint8_t d) { return (uint16_t)255 * n / d; } - uint8_t scale(uint16_t v, uint8_t scale) { return (v * scale) >> 8; } + uint8_t frac(uint8_t n, uint8_t d) { + return (uint16_t)255 * n / d; + } + uint8_t scale(uint16_t v, uint8_t scale) { + return (v * scale) >> 8; + } for (uint8_t i = 0; i < rgblight_ranges.effect_num_leds; i++) { TwinkleState *t = &(led_twinkle_state[i]); diff --git a/quantum/rgblight/rgblight.h b/quantum/rgblight/rgblight.h index 5b90b8f49e..7076dc41ac 100644 --- a/quantum/rgblight/rgblight.h +++ b/quantum/rgblight/rgblight.h @@ -119,7 +119,7 @@ enum RGBLIGHT_EFFECT_MODE { // sample: #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 #ifndef RGBLIGHT_EFFECT_BREATHE_MAX -# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0-255 +# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0-255 #endif #ifndef RGBLIGHT_EFFECT_SNAKE_LENGTH @@ -177,8 +177,8 @@ enum RGBLIGHT_EFFECT_MODE { #ifdef RGBLIGHT_LAYERS typedef struct { - uint8_t index; // The first LED to light - uint8_t count; // The number of LEDs to light + uint8_t index; // The first LED to light + uint8_t count; // The number of LEDs to light uint8_t hue; uint8_t sat; uint8_t val; @@ -241,7 +241,7 @@ typedef union { uint8_t hue : 8; uint8_t sat : 8; uint8_t val : 8; - uint8_t speed : 8; // EECONFIG needs to be increased to support this + uint8_t speed : 8; // EECONFIG needs to be increased to support this }; } rgblight_config_t; @@ -271,7 +271,7 @@ extern rgblight_ranges_t rgblight_ranges; /* === Utility Functions ===*/ void sethsv(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1); -void sethsv_raw(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1); // without RGBLIGHT_LIMIT_VAL check +void sethsv_raw(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1); // without RGBLIGHT_LIMIT_VAL check void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1); /* === Low level Functions === */ diff --git a/quantum/ring_buffer.h b/quantum/ring_buffer.h index 284745ca8e..85419de11b 100644 --- a/quantum/ring_buffer.h +++ b/quantum/ring_buffer.h @@ -36,9 +36,13 @@ static inline uint8_t rbuf_dequeue(void) { } static inline bool rbuf_has_data(void) { bool has_data; - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { has_data = (rbuf_head != rbuf_tail); } + ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { + has_data = (rbuf_head != rbuf_tail); + } return has_data; } static inline void rbuf_clear(void) { - ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { rbuf_head = rbuf_tail = 0; } + ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { + rbuf_head = rbuf_tail = 0; + } } diff --git a/quantum/send_string.c b/quantum/send_string.c index 1a7f7a1315..0de12ba12d 100644 --- a/quantum/send_string.c +++ b/quantum/send_string.c @@ -142,9 +142,13 @@ __attribute__((weak)) const uint8_t ascii_to_keycode_lut[128] PROGMEM = { // Note: we bit-pack in "reverse" order to optimize loading #define PGM_LOADBIT(mem, pos) ((pgm_read_byte(&((mem)[(pos) / 8])) >> ((pos) % 8)) & 0x01) -void send_string(const char *str) { send_string_with_delay(str, 0); } +void send_string(const char *str) { + send_string_with_delay(str, 0); +} -void send_string_P(const char *str) { send_string_with_delay_P(str, 0); } +void send_string_P(const char *str) { + send_string_with_delay_P(str, 0); +} void send_string_with_delay(const char *str, uint8_t interval) { while (1) { @@ -173,7 +177,8 @@ void send_string_with_delay(const char *str, uint8_t interval) { ms += keycode - '0'; keycode = *(++str); } - while (ms--) wait_ms(1); + while (ms--) + wait_ms(1); } } else { send_char(ascii_code); @@ -182,7 +187,8 @@ void send_string_with_delay(const char *str, uint8_t interval) { // interval { uint8_t ms = interval; - while (ms--) wait_ms(1); + while (ms--) + wait_ms(1); } } } @@ -214,7 +220,8 @@ void send_string_with_delay_P(const char *str, uint8_t interval) { ms += keycode - '0'; keycode = pgm_read_byte(++str); } - while (ms--) wait_ms(1); + while (ms--) + wait_ms(1); } } else { send_char(ascii_code); @@ -223,14 +230,15 @@ void send_string_with_delay_P(const char *str, uint8_t interval) { // interval { uint8_t ms = interval; - while (ms--) wait_ms(1); + while (ms--) + wait_ms(1); } } } void send_char(char ascii_code) { #if defined(AUDIO_ENABLE) && defined(SENDSTRING_BELL) - if (ascii_code == '\a') { // BEL + if (ascii_code == '\a') { // BEL PLAY_SONG(bell_song); return; } diff --git a/quantum/sequencer/sequencer.c b/quantum/sequencer/sequencer.c index 18a83661ec..2e92f7b3eb 100644 --- a/quantum/sequencer/sequencer.c +++ b/quantum/sequencer/sequencer.c @@ -25,16 +25,18 @@ #endif sequencer_config_t sequencer_config = { - false, // enabled - {false}, // steps - {0}, // track notes - 60, // tempo - SQ_RES_4, // resolution + false, // enabled + {false}, // steps + {0}, // track notes + 60, // tempo + SQ_RES_4, // resolution }; sequencer_state_t sequencer_internal_state = {0, 0, 0, 0, SEQUENCER_PHASE_ATTACK}; -bool is_sequencer_on(void) { return sequencer_config.enabled; } +bool is_sequencer_on(void) { + return sequencer_config.enabled; +} void sequencer_on(void) { dprintln("sequencer on"); @@ -65,7 +67,9 @@ void sequencer_set_track_notes(const uint16_t track_notes[SEQUENCER_TRACKS]) { } } -bool is_sequencer_track_active(uint8_t track) { return (sequencer_internal_state.active_tracks >> track) & true; } +bool is_sequencer_track_active(uint8_t track) { + return (sequencer_internal_state.active_tracks >> track) & true; +} void sequencer_set_track_activation(uint8_t track, bool value) { if (value) { @@ -76,7 +80,9 @@ void sequencer_set_track_activation(uint8_t track, bool value) { dprintf("sequencer: track %d is %s\n", track, value ? "active" : "inactive"); } -void sequencer_toggle_track_activation(uint8_t track) { sequencer_set_track_activation(track, !is_sequencer_track_active(track)); } +void sequencer_toggle_track_activation(uint8_t track) { + sequencer_set_track_activation(track, !is_sequencer_track_active(track)); +} void sequencer_toggle_single_active_track(uint8_t track) { if (is_sequencer_track_active(track)) { @@ -86,9 +92,13 @@ void sequencer_toggle_single_active_track(uint8_t track) { } } -bool is_sequencer_step_on(uint8_t step) { return step < SEQUENCER_STEPS && (sequencer_config.steps[step] & sequencer_internal_state.active_tracks) > 0; } +bool is_sequencer_step_on(uint8_t step) { + return step < SEQUENCER_STEPS && (sequencer_config.steps[step] & sequencer_internal_state.active_tracks) > 0; +} -bool is_sequencer_step_on_for_track(uint8_t step, uint8_t track) { return step < SEQUENCER_STEPS && (sequencer_config.steps[step] >> track) & true; } +bool is_sequencer_step_on_for_track(uint8_t step, uint8_t track) { + return step < SEQUENCER_STEPS && (sequencer_config.steps[step] >> track) & true; +} void sequencer_set_step(uint8_t step, bool value) { if (step < SEQUENCER_STEPS) { @@ -122,7 +132,9 @@ void sequencer_set_all_steps(bool value) { dprintf("sequencer: all steps are %s\n", value ? "on" : "off"); } -uint8_t sequencer_get_tempo(void) { return sequencer_config.tempo; } +uint8_t sequencer_get_tempo(void) { + return sequencer_config.tempo; +} void sequencer_set_tempo(uint8_t tempo) { if (tempo > 0) { @@ -142,9 +154,13 @@ void sequencer_increase_tempo(void) { } } -void sequencer_decrease_tempo(void) { sequencer_set_tempo(sequencer_config.tempo - 1); } +void sequencer_decrease_tempo(void) { + sequencer_set_tempo(sequencer_config.tempo - 1); +} -sequencer_resolution_t sequencer_get_resolution(void) { return sequencer_config.resolution; } +sequencer_resolution_t sequencer_get_resolution(void) { + return sequencer_config.resolution; +} void sequencer_set_resolution(sequencer_resolution_t resolution) { if (resolution >= 0 && resolution < SEQUENCER_RESOLUTIONS) { @@ -155,11 +171,17 @@ void sequencer_set_resolution(sequencer_resolution_t resolution) { } } -void sequencer_increase_resolution(void) { sequencer_set_resolution(sequencer_config.resolution + 1); } +void sequencer_increase_resolution(void) { + sequencer_set_resolution(sequencer_config.resolution + 1); +} -void sequencer_decrease_resolution(void) { sequencer_set_resolution(sequencer_config.resolution - 1); } +void sequencer_decrease_resolution(void) { + sequencer_set_resolution(sequencer_config.resolution - 1); +} -uint8_t sequencer_get_current_step(void) { return sequencer_internal_state.current_step; } +uint8_t sequencer_get_current_step(void) { + return sequencer_internal_state.current_step; +} void sequencer_phase_attack(void) { dprintf("sequencer: step %d\n", sequencer_internal_state.current_step); @@ -229,9 +251,13 @@ void sequencer_task(void) { } } -uint16_t sequencer_get_beat_duration(void) { return get_beat_duration(sequencer_config.tempo); } +uint16_t sequencer_get_beat_duration(void) { + return get_beat_duration(sequencer_config.tempo); +} -uint16_t sequencer_get_step_duration(void) { return get_step_duration(sequencer_config.tempo, sequencer_config.resolution); } +uint16_t sequencer_get_step_duration(void) { + return get_step_duration(sequencer_config.tempo, sequencer_config.resolution); +} uint16_t get_beat_duration(uint8_t tempo) { // Don’t crash in the unlikely case where the given tempo is 0 diff --git a/quantum/sequencer/sequencer.h b/quantum/sequencer/sequencer.h index 4017ae764e..a8ea16eece 100644 --- a/quantum/sequencer/sequencer.h +++ b/quantum/sequencer/sequencer.h @@ -48,7 +48,7 @@ typedef struct { bool enabled; uint8_t steps[SEQUENCER_STEPS]; uint16_t track_notes[SEQUENCER_TRACKS]; - uint8_t tempo; // Is a maximum tempo of 255 reasonable? + uint8_t tempo; // Is a maximum tempo of 255 reasonable? sequencer_resolution_t resolution; } sequencer_config_t; @@ -57,9 +57,9 @@ typedef struct { * We use a "phase" state machine to delay some of the events. */ typedef enum sequencer_phase_t { - SEQUENCER_PHASE_ATTACK, // t=0ms, send the MIDI note on signal - SEQUENCER_PHASE_RELEASE, // t=SEQUENCER_PHASE_RELEASE_TIMEOUT ms, send the MIDI note off signal - SEQUENCER_PHASE_PAUSE // t=step duration ms, loop + SEQUENCER_PHASE_ATTACK, // t=0ms, send the MIDI note on signal + SEQUENCER_PHASE_RELEASE, // t=SEQUENCER_PHASE_RELEASE_TIMEOUT ms, send the MIDI note off signal + SEQUENCER_PHASE_PAUSE // t=step duration ms, loop } sequencer_phase_t; typedef struct { diff --git a/quantum/sequencer/tests/midi_mock.c b/quantum/sequencer/tests/midi_mock.c index 236e16f9d7..5bd945d615 100644 --- a/quantum/sequencer/tests/midi_mock.c +++ b/quantum/sequencer/tests/midi_mock.c @@ -19,8 +19,14 @@ uint16_t last_noteon = 0; uint16_t last_noteoff = 0; -uint16_t midi_compute_note(uint16_t keycode) { return keycode; } +uint16_t midi_compute_note(uint16_t keycode) { + return keycode; +} -void process_midi_basic_noteon(uint16_t note) { last_noteon = note; } +void process_midi_basic_noteon(uint16_t note) { + last_noteon = note; +} -void process_midi_basic_noteoff(uint16_t note) { last_noteoff = note; } +void process_midi_basic_noteoff(uint16_t note) { + last_noteoff = note; +} diff --git a/quantum/sequencer/tests/sequencer_tests.cpp b/quantum/sequencer/tests/sequencer_tests.cpp index 290605a52a..05e58e4111 100644 --- a/quantum/sequencer/tests/sequencer_tests.cpp +++ b/quantum/sequencer/tests/sequencer_tests.cpp @@ -78,7 +78,9 @@ class SequencerTest : public ::testing::Test { sequencer_state_t state_copy; }; -TEST_F(SequencerTest, TestOffByDefault) { EXPECT_EQ(is_sequencer_on(), false); } +TEST_F(SequencerTest, TestOffByDefault) { + EXPECT_EQ(is_sequencer_on(), false); +} TEST_F(SequencerTest, TestOn) { sequencer_config.enabled = false; diff --git a/quantum/split_common/post_config.h b/quantum/split_common/post_config.h index a4c0a1956b..8f79beb6ed 100644 --- a/quantum/split_common/post_config.h +++ b/quantum/split_common/post_config.h @@ -5,6 +5,6 @@ # endif # ifndef F_SCL -# define F_SCL 100000UL // SCL frequency +# define F_SCL 100000UL // SCL frequency # endif #endif diff --git a/quantum/split_common/split_util.c b/quantum/split_common/split_util.c index 35f0a9d181..7d50adf758 100644 --- a/quantum/split_common/split_util.c +++ b/quantum/split_common/split_util.c @@ -43,14 +43,14 @@ // Set to 0 to disable the disconnection check altogether. #ifndef SPLIT_MAX_CONNECTION_ERRORS # define SPLIT_MAX_CONNECTION_ERRORS 10 -#endif // SPLIT_MAX_CONNECTION_ERRORS +#endif // SPLIT_MAX_CONNECTION_ERRORS // How long (in milliseconds) to block all connection attempts after the communication has been flagged as disconnected. // One communication attempt will be allowed everytime this amount of time has passed since the last attempt. If that attempt succeeds, the communication is seen as working again. // Set to 0 to disable communication throttling while disconnected #ifndef SPLIT_CONNECTION_CHECK_TIMEOUT # define SPLIT_CONNECTION_CHECK_TIMEOUT 500 -#endif // SPLIT_CONNECTION_CHECK_TIMEOUT +#endif // SPLIT_CONNECTION_CHECK_TIMEOUT static uint8_t connection_errors = 0; @@ -68,7 +68,9 @@ static bool usbIsActive(void) { return false; } #else -static inline bool usbIsActive(void) { return usb_vbus_state(); } +static inline bool usbIsActive(void) { + return usb_vbus_state(); +} #endif #ifdef SPLIT_HAND_MATRIX_GRID @@ -83,7 +85,7 @@ static uint8_t peek_matrix_intersection(pin_t out_pin, pin_t in_pin) { uint8_t pin_state = readPin(in_pin); // Set out_pin to a setting that is less susceptible to noise. setPinInputHigh(out_pin); - matrix_io_delay(); // Wait for the pull-up to go HIGH. + matrix_io_delay(); // Wait for the pull-up to go HIGH. return pin_state; } #endif @@ -158,7 +160,9 @@ void split_post_init(void) { } } -bool is_transport_connected(void) { return connection_errors < SPLIT_MAX_CONNECTION_ERRORS; } +bool is_transport_connected(void) { + return connection_errors < SPLIT_MAX_CONNECTION_ERRORS; +} bool transport_master_if_connected(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { #if SPLIT_MAX_CONNECTION_ERRORS > 0 && SPLIT_CONNECTION_CHECK_TIMEOUT > 0 @@ -169,7 +173,7 @@ bool transport_master_if_connected(matrix_row_t master_matrix[], matrix_row_t sl if (is_disconnected && timer_elapsed(connection_check_timer) < SPLIT_CONNECTION_CHECK_TIMEOUT) { return false; } -#endif // SPLIT_MAX_CONNECTION_ERRORS > 0 && SPLIT_CONNECTION_CHECK_TIMEOUT > 0 +#endif // SPLIT_MAX_CONNECTION_ERRORS > 0 && SPLIT_CONNECTION_CHECK_TIMEOUT > 0 __attribute__((unused)) bool okay = transport_master(master_matrix, slave_matrix); #if SPLIT_MAX_CONNECTION_ERRORS > 0 @@ -186,10 +190,10 @@ bool transport_master_if_connected(matrix_row_t master_matrix[], matrix_row_t sl return connected; } else if (is_disconnected) { dprintln("Target connected"); -# endif // SPLIT_CONNECTION_CHECK_TIMEOUT > 0 +# endif // SPLIT_CONNECTION_CHECK_TIMEOUT > 0 } connection_errors = 0; -#endif // SPLIT_MAX_CONNECTION_ERRORS > 0 +#endif // SPLIT_MAX_CONNECTION_ERRORS > 0 return true; } diff --git a/quantum/split_common/transaction_id_define.h b/quantum/split_common/transaction_id_define.h index aa71c3621e..761a8884f4 100644 --- a/quantum/split_common/transaction_id_define.h +++ b/quantum/split_common/transaction_id_define.h @@ -19,87 +19,87 @@ enum serial_transaction_id { #ifdef USE_I2C I2C_EXECUTE_CALLBACK, -#endif // USE_I2C +#endif // USE_I2C GET_SLAVE_MATRIX_CHECKSUM, GET_SLAVE_MATRIX_DATA, #ifdef SPLIT_TRANSPORT_MIRROR PUT_MASTER_MATRIX, -#endif // SPLIT_TRANSPORT_MIRROR +#endif // SPLIT_TRANSPORT_MIRROR #ifdef ENCODER_ENABLE GET_ENCODERS_CHECKSUM, GET_ENCODERS_DATA, -#endif // ENCODER_ENABLE +#endif // ENCODER_ENABLE #ifndef DISABLE_SYNC_TIMER PUT_SYNC_TIMER, -#endif // DISABLE_SYNC_TIMER +#endif // DISABLE_SYNC_TIMER #if !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) PUT_LAYER_STATE, PUT_DEFAULT_LAYER_STATE, -#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) +#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) #ifdef SPLIT_LED_STATE_ENABLE PUT_LED_STATE, -#endif // SPLIT_LED_STATE_ENABLE +#endif // SPLIT_LED_STATE_ENABLE #ifdef SPLIT_MODS_ENABLE PUT_MODS, -#endif // SPLIT_MODS_ENABLE +#endif // SPLIT_MODS_ENABLE #ifdef BACKLIGHT_ENABLE PUT_BACKLIGHT, -#endif // BACKLIGHT_ENABLE +#endif // BACKLIGHT_ENABLE #if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) PUT_RGBLIGHT, -#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) +#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) #if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) PUT_LED_MATRIX, -#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) +#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) PUT_RGB_MATRIX, -#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) +#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) #if defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) PUT_WPM, -#endif // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) +#endif // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) #if defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) PUT_OLED, -#endif // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) +#endif // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) #if defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) PUT_ST7565, -#endif // defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) +#endif // defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) #if defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) GET_POINTING_CHECKSUM, GET_POINTING_DATA, PUT_POINTING_CPI, -#endif // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) +#endif // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) #if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) PUT_RPC_INFO, PUT_RPC_REQ_DATA, EXECUTE_RPC, GET_RPC_RESP_DATA, -#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) +#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) // keyboard-specific #ifdef SPLIT_TRANSACTION_IDS_KB SPLIT_TRANSACTION_IDS_KB, -#endif // SPLIT_TRANSACTION_IDS_KB +#endif // SPLIT_TRANSACTION_IDS_KB // user/keymap-specific #ifdef SPLIT_TRANSACTION_IDS_USER SPLIT_TRANSACTION_IDS_USER, -#endif // SPLIT_TRANSACTION_IDS_USER +#endif // SPLIT_TRANSACTION_IDS_USER NUM_TOTAL_TRANSACTIONS }; diff --git a/quantum/split_common/transactions.c b/quantum/split_common/transactions.c index 4b059a2b8a..cffbccaeee 100644 --- a/quantum/split_common/transactions.c +++ b/quantum/split_common/transactions.c @@ -30,7 +30,7 @@ #ifndef FORCED_SYNC_THROTTLE_MS # define FORCED_SYNC_THROTTLE_MS 100 -#endif // FORCED_SYNC_THROTTLE_MS +#endif // FORCED_SYNC_THROTTLE_MS #define sizeof_member(type, member) sizeof(((type *)NULL)->member) @@ -49,7 +49,7 @@ // Forward-declare the RPC callback handlers void slave_rpc_info_callback(uint8_t initiator2target_buffer_size, const void *initiator2target_buffer, uint8_t target2initiator_buffer_size, void *target2initiator_buffer); void slave_rpc_exec_callback(uint8_t initiator2target_buffer_size, const void *initiator2target_buffer, uint8_t target2initiator_buffer_size, void *target2initiator_buffer); -#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) +#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) //////////////////////////////////////////////////// // Helpers @@ -63,7 +63,9 @@ static bool transaction_handler_master(matrix_row_t master_matrix[], matrix_row_ } } bool this_okay = true; - ATOMIC_BLOCK_FORCEON { this_okay = handler(master_matrix, slave_matrix); }; + ATOMIC_BLOCK_FORCEON { + this_okay = handler(master_matrix, slave_matrix); + }; if (this_okay) return true; } dprintf("Failed to execute %s\n", prefix); @@ -75,9 +77,11 @@ static bool transaction_handler_master(matrix_row_t master_matrix[], matrix_row_ if (!transaction_handler_master(master_matrix, slave_matrix, #prefix, &prefix##_handlers_master)) return false; \ } while (0) -#define TRANSACTION_HANDLER_SLAVE(prefix) \ - do { \ - ATOMIC_BLOCK_FORCEON { prefix##_handlers_slave(master_matrix, slave_matrix); }; \ +#define TRANSACTION_HANDLER_SLAVE(prefix) \ + do { \ + ATOMIC_BLOCK_FORCEON { \ + prefix##_handlers_slave(master_matrix, slave_matrix); \ + }; \ } while (0) inline static bool read_if_checksum_mismatch(int8_t trans_id_checksum, int8_t trans_id_retrieve, uint32_t *last_update, void *destination, const void *equiv_shmem, size_t length) { @@ -116,8 +120,8 @@ inline static bool send_if_data_mismatch(int8_t trans_id, uint32_t *last_update, static bool slave_matrix_handlers_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { static uint32_t last_update = 0; - static matrix_row_t last_matrix[(MATRIX_ROWS) / 2] = {0}; // last successfully-read matrix, so we can replicate if there are checksum errors - matrix_row_t temp_matrix[(MATRIX_ROWS) / 2]; // holding area while we test whether or not checksum is correct + static matrix_row_t last_matrix[(MATRIX_ROWS) / 2] = {0}; // last successfully-read matrix, so we can replicate if there are checksum errors + matrix_row_t temp_matrix[(MATRIX_ROWS) / 2]; // holding area while we test whether or not checksum is correct bool okay = read_if_checksum_mismatch(GET_SLAVE_MATRIX_CHECKSUM, GET_SLAVE_MATRIX_DATA, &last_update, temp_matrix, split_shmem->smatrix.matrix, sizeof(split_shmem->smatrix.matrix)); if (okay) { @@ -161,13 +165,13 @@ static void master_matrix_handlers_slave(matrix_row_t master_matrix[], matrix_ro # define TRANSACTIONS_MASTER_MATRIX_SLAVE() TRANSACTION_HANDLER_SLAVE(master_matrix) # define TRANSACTIONS_MASTER_MATRIX_REGISTRATIONS [PUT_MASTER_MATRIX] = trans_initiator2target_initializer(mmatrix.matrix), -#else // SPLIT_TRANSPORT_MIRROR +#else // SPLIT_TRANSPORT_MIRROR # define TRANSACTIONS_MASTER_MATRIX_MASTER() # define TRANSACTIONS_MASTER_MATRIX_SLAVE() # define TRANSACTIONS_MASTER_MATRIX_REGISTRATIONS -#endif // SPLIT_TRANSPORT_MIRROR +#endif // SPLIT_TRANSPORT_MIRROR //////////////////////////////////////////////////// // Encoders @@ -200,13 +204,13 @@ static void encoder_handlers_slave(matrix_row_t master_matrix[], matrix_row_t sl [GET_ENCODERS_DATA] = trans_target2initiator_initializer(encoders.state), // clang-format on -#else // ENCODER_ENABLE +#else // ENCODER_ENABLE # define TRANSACTIONS_ENCODERS_MASTER() # define TRANSACTIONS_ENCODERS_SLAVE() # define TRANSACTIONS_ENCODERS_REGISTRATIONS -#endif // ENCODER_ENABLE +#endif // ENCODER_ENABLE //////////////////////////////////////////////////// // Sync timer @@ -239,13 +243,13 @@ static void sync_timer_handlers_slave(matrix_row_t master_matrix[], matrix_row_t # define TRANSACTIONS_SYNC_TIMER_SLAVE() TRANSACTION_HANDLER_SLAVE(sync_timer) # define TRANSACTIONS_SYNC_TIMER_REGISTRATIONS [PUT_SYNC_TIMER] = trans_initiator2target_initializer(sync_timer), -#else // DISABLE_SYNC_TIMER +#else // DISABLE_SYNC_TIMER # define TRANSACTIONS_SYNC_TIMER_MASTER() # define TRANSACTIONS_SYNC_TIMER_SLAVE() # define TRANSACTIONS_SYNC_TIMER_REGISTRATIONS -#endif // DISABLE_SYNC_TIMER +#endif // DISABLE_SYNC_TIMER //////////////////////////////////////////////////// // Layer state @@ -276,13 +280,13 @@ static void layer_state_handlers_slave(matrix_row_t master_matrix[], matrix_row_ [PUT_DEFAULT_LAYER_STATE] = trans_initiator2target_initializer(layers.default_layer_state), // clang-format on -#else // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) +#else // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) # define TRANSACTIONS_LAYER_STATE_MASTER() # define TRANSACTIONS_LAYER_STATE_SLAVE() # define TRANSACTIONS_LAYER_STATE_REGISTRATIONS -#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) +#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) //////////////////////////////////////////////////// // LED state @@ -304,13 +308,13 @@ static void led_state_handlers_slave(matrix_row_t master_matrix[], matrix_row_t # define TRANSACTIONS_LED_STATE_SLAVE() TRANSACTION_HANDLER_SLAVE(led_state) # define TRANSACTIONS_LED_STATE_REGISTRATIONS [PUT_LED_STATE] = trans_initiator2target_initializer(led_state), -#else // SPLIT_LED_STATE_ENABLE +#else // SPLIT_LED_STATE_ENABLE # define TRANSACTIONS_LED_STATE_MASTER() # define TRANSACTIONS_LED_STATE_SLAVE() # define TRANSACTIONS_LED_STATE_REGISTRATIONS -#endif // SPLIT_LED_STATE_ENABLE +#endif // SPLIT_LED_STATE_ENABLE //////////////////////////////////////////////////// // Mods @@ -336,7 +340,7 @@ static bool mods_handlers_master(matrix_row_t master_matrix[], matrix_row_t slav if (!mods_need_sync && new_mods.oneshot_mods != split_shmem->mods.oneshot_mods) { mods_need_sync = true; } -# endif // NO_ACTION_ONESHOT +# endif // NO_ACTION_ONESHOT bool okay = true; if (mods_need_sync) { @@ -361,13 +365,13 @@ static void mods_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave # define TRANSACTIONS_MODS_SLAVE() TRANSACTION_HANDLER_SLAVE(mods) # define TRANSACTIONS_MODS_REGISTRATIONS [PUT_MODS] = trans_initiator2target_initializer(mods), -#else // SPLIT_MODS_ENABLE +#else // SPLIT_MODS_ENABLE # define TRANSACTIONS_MODS_MASTER() # define TRANSACTIONS_MODS_SLAVE() # define TRANSACTIONS_MODS_REGISTRATIONS -#endif // SPLIT_MODS_ENABLE +#endif // SPLIT_MODS_ENABLE //////////////////////////////////////////////////// // Backlight @@ -380,19 +384,21 @@ static bool backlight_handlers_master(matrix_row_t master_matrix[], matrix_row_t return send_if_condition(PUT_BACKLIGHT, &last_update, (level != split_shmem->backlight_level), &level, sizeof(level)); } -static void backlight_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { backlight_set(split_shmem->backlight_level); } +static void backlight_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + backlight_set(split_shmem->backlight_level); +} # define TRANSACTIONS_BACKLIGHT_MASTER() TRANSACTION_HANDLER_MASTER(backlight) # define TRANSACTIONS_BACKLIGHT_SLAVE() TRANSACTION_HANDLER_SLAVE(backlight) # define TRANSACTIONS_BACKLIGHT_REGISTRATIONS [PUT_BACKLIGHT] = trans_initiator2target_initializer(backlight_level), -#else // BACKLIGHT_ENABLE +#else // BACKLIGHT_ENABLE # define TRANSACTIONS_BACKLIGHT_MASTER() # define TRANSACTIONS_BACKLIGHT_SLAVE() # define TRANSACTIONS_BACKLIGHT_REGISTRATIONS -#endif // BACKLIGHT_ENABLE +#endif // BACKLIGHT_ENABLE //////////////////////////////////////////////////// // RGBLIGHT @@ -423,13 +429,13 @@ static void rgblight_handlers_slave(matrix_row_t master_matrix[], matrix_row_t s # define TRANSACTIONS_RGBLIGHT_SLAVE() TRANSACTION_HANDLER_SLAVE(rgblight) # define TRANSACTIONS_RGBLIGHT_REGISTRATIONS [PUT_RGBLIGHT] = trans_initiator2target_initializer(rgblight_sync), -#else // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) +#else // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) # define TRANSACTIONS_RGBLIGHT_MASTER() # define TRANSACTIONS_RGBLIGHT_SLAVE() # define TRANSACTIONS_RGBLIGHT_REGISTRATIONS -#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) +#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) //////////////////////////////////////////////////// // LED Matrix @@ -453,13 +459,13 @@ static void led_matrix_handlers_slave(matrix_row_t master_matrix[], matrix_row_t # define TRANSACTIONS_LED_MATRIX_SLAVE() TRANSACTION_HANDLER_SLAVE(led_matrix) # define TRANSACTIONS_LED_MATRIX_REGISTRATIONS [PUT_LED_MATRIX] = trans_initiator2target_initializer(led_matrix_sync), -#else // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) +#else // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) # define TRANSACTIONS_LED_MATRIX_MASTER() # define TRANSACTIONS_LED_MATRIX_SLAVE() # define TRANSACTIONS_LED_MATRIX_REGISTRATIONS -#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) +#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) //////////////////////////////////////////////////// // RGB Matrix @@ -483,13 +489,13 @@ static void rgb_matrix_handlers_slave(matrix_row_t master_matrix[], matrix_row_t # define TRANSACTIONS_RGB_MATRIX_SLAVE() TRANSACTION_HANDLER_SLAVE(rgb_matrix) # define TRANSACTIONS_RGB_MATRIX_REGISTRATIONS [PUT_RGB_MATRIX] = trans_initiator2target_initializer(rgb_matrix_sync), -#else // defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) +#else // defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) # define TRANSACTIONS_RGB_MATRIX_MASTER() # define TRANSACTIONS_RGB_MATRIX_SLAVE() # define TRANSACTIONS_RGB_MATRIX_REGISTRATIONS -#endif // defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) +#endif // defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) //////////////////////////////////////////////////// // WPM @@ -502,19 +508,21 @@ static bool wpm_handlers_master(matrix_row_t master_matrix[], matrix_row_t slave return send_if_condition(PUT_WPM, &last_update, (current_wpm != split_shmem->current_wpm), ¤t_wpm, sizeof(current_wpm)); } -static void wpm_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { set_current_wpm(split_shmem->current_wpm); } +static void wpm_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + set_current_wpm(split_shmem->current_wpm); +} # define TRANSACTIONS_WPM_MASTER() TRANSACTION_HANDLER_MASTER(wpm) # define TRANSACTIONS_WPM_SLAVE() TRANSACTION_HANDLER_SLAVE(wpm) # define TRANSACTIONS_WPM_REGISTRATIONS [PUT_WPM] = trans_initiator2target_initializer(current_wpm), -#else // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) +#else // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) # define TRANSACTIONS_WPM_MASTER() # define TRANSACTIONS_WPM_SLAVE() # define TRANSACTIONS_WPM_REGISTRATIONS -#endif // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) +#endif // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) //////////////////////////////////////////////////// // OLED @@ -539,13 +547,13 @@ static void oled_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave # define TRANSACTIONS_OLED_SLAVE() TRANSACTION_HANDLER_SLAVE(oled) # define TRANSACTIONS_OLED_REGISTRATIONS [PUT_OLED] = trans_initiator2target_initializer(current_oled_state), -#else // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) +#else // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) # define TRANSACTIONS_OLED_MASTER() # define TRANSACTIONS_OLED_SLAVE() # define TRANSACTIONS_OLED_REGISTRATIONS -#endif // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) +#endif // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) //////////////////////////////////////////////////// // ST7565 @@ -570,13 +578,13 @@ static void st7565_handlers_slave(matrix_row_t master_matrix[], matrix_row_t sla # define TRANSACTIONS_ST7565_SLAVE() TRANSACTION_HANDLER_SLAVE(st7565) # define TRANSACTIONS_ST7565_REGISTRATIONS [PUT_ST7565] = trans_initiator2target_initializer(current_st7565_state), -#else // defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) +#else // defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) # define TRANSACTIONS_ST7565_MASTER() # define TRANSACTIONS_ST7565_SLAVE() # define TRANSACTIONS_ST7565_REGISTRATIONS -#endif // defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) +#endif // defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) //////////////////////////////////////////////////// // POINTING @@ -631,7 +639,7 @@ static void pointing_handlers_slave(matrix_row_t master_matrix[], matrix_row_t s } last_exec = timer_read32(); # endif - temp_cpi = !pointing_device_driver.get_cpi ? 0 : pointing_device_driver.get_cpi(); // check for NULL + temp_cpi = !pointing_device_driver.get_cpi ? 0 : pointing_device_driver.get_cpi(); // check for NULL if (split_shmem->pointing.cpi && memcmp(&split_shmem->pointing.cpi, &temp_cpi, sizeof(temp_cpi)) != 0) { if (pointing_device_driver.set_cpi) { pointing_device_driver.set_cpi(split_shmem->pointing.cpi); @@ -648,13 +656,13 @@ static void pointing_handlers_slave(matrix_row_t master_matrix[], matrix_row_t s # define TRANSACTIONS_POINTING_SLAVE() TRANSACTION_HANDLER_SLAVE(pointing) # define TRANSACTIONS_POINTING_REGISTRATIONS [GET_POINTING_CHECKSUM] = trans_target2initiator_initializer(pointing.checksum), [GET_POINTING_DATA] = trans_target2initiator_initializer(pointing.report), [PUT_POINTING_CPI] = trans_initiator2target_initializer(pointing.cpi), -#else // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) +#else // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) # define TRANSACTIONS_POINTING_MASTER() # define TRANSACTIONS_POINTING_SLAVE() # define TRANSACTIONS_POINTING_REGISTRATIONS -#endif // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) +#endif // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) //////////////////////////////////////////////////// @@ -664,7 +672,7 @@ split_transaction_desc_t split_transaction_table[NUM_TOTAL_TRANSACTIONS] = { #ifdef USE_I2C [I2C_EXECUTE_CALLBACK] = trans_initiator2target_initializer(transaction_id), -#endif // USE_I2C +#endif // USE_I2C // clang-format off TRANSACTIONS_SLAVE_MATRIX_REGISTRATIONS @@ -689,7 +697,7 @@ split_transaction_desc_t split_transaction_table[NUM_TOTAL_TRANSACTIONS] = { [PUT_RPC_REQ_DATA] = trans_initiator2target_initializer(rpc_m2s_buffer), [EXECUTE_RPC] = trans_initiator2target_initializer_cb(rpc_info.transaction_id, slave_rpc_exec_callback), [GET_RPC_RESP_DATA] = trans_target2initiator_initializer(rpc_s2m_buffer), -#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) +#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) }; bool transactions_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { @@ -800,4 +808,4 @@ void slave_rpc_exec_callback(uint8_t initiator2target_buffer_size, const void *i } } -#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) +#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c index 060ba8a927..aade3c98d7 100644 --- a/quantum/split_common/transport.c +++ b/quantum/split_common/transport.c @@ -26,7 +26,7 @@ # ifndef SLAVE_I2C_TIMEOUT # define SLAVE_I2C_TIMEOUT 100 -# endif // SLAVE_I2C_TIMEOUT +# endif // SLAVE_I2C_TIMEOUT # ifndef SLAVE_I2C_ADDRESS # define SLAVE_I2C_ADDRESS 0x32 @@ -40,8 +40,12 @@ _Static_assert(sizeof(split_shared_memory_t) <= I2C_SLAVE_REG_COUNT, "split_shar split_shared_memory_t *const split_shmem = (split_shared_memory_t *)i2c_slave_reg; -void transport_master_init(void) { i2c_init(); } -void transport_slave_init(void) { i2c_slave_init(SLAVE_I2C_ADDRESS); } +void transport_master_init(void) { + i2c_init(); +} +void transport_slave_init(void) { + i2c_slave_init(SLAVE_I2C_ADDRESS); +} i2c_status_t transport_trigger_callback(int8_t id) { // If there's no callback, indicate that we were successful @@ -82,15 +86,19 @@ bool transport_execute_transaction(int8_t id, const void *initiator2target_buf, return true; } -#else // USE_I2C +#else // USE_I2C # include "serial.h" static split_shared_memory_t shared_memory; split_shared_memory_t *const split_shmem = &shared_memory; -void transport_master_init(void) { soft_serial_initiator_init(); } -void transport_slave_init(void) { soft_serial_target_init(); } +void transport_master_init(void) { + soft_serial_initiator_init(); +} +void transport_slave_init(void) { + soft_serial_target_init(); +} bool transport_execute_transaction(int8_t id, const void *initiator2target_buf, uint16_t initiator2target_length, void *target2initiator_buf, uint16_t target2initiator_length) { split_transaction_desc_t *trans = &split_transaction_table[id]; @@ -111,8 +119,12 @@ bool transport_execute_transaction(int8_t id, const void *initiator2target_buf, return true; } -#endif // USE_I2C +#endif // USE_I2C -bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { return transactions_master(master_matrix, slave_matrix); } +bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + return transactions_master(master_matrix, slave_matrix); +} -void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { transactions_slave(master_matrix, slave_matrix); } +void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { + transactions_slave(master_matrix, slave_matrix); +} diff --git a/quantum/split_common/transport.h b/quantum/split_common/transport.h index 31b804908b..26bd136728 100644 --- a/quantum/split_common/transport.h +++ b/quantum/split_common/transport.h @@ -25,11 +25,11 @@ #ifndef RPC_M2S_BUFFER_SIZE # define RPC_M2S_BUFFER_SIZE 32 -#endif // RPC_M2S_BUFFER_SIZE +#endif // RPC_M2S_BUFFER_SIZE #ifndef RPC_S2M_BUFFER_SIZE # define RPC_S2M_BUFFER_SIZE 32 -#endif // RPC_S2M_BUFFER_SIZE +#endif // RPC_S2M_BUFFER_SIZE void transport_master_init(void); void transport_slave_init(void); @@ -43,15 +43,15 @@ bool transport_execute_transaction(int8_t id, const void *initiator2target_buf, #ifdef ENCODER_ENABLE # include "encoder.h" # define NUMBER_OF_ENCODERS (sizeof((pin_t[])ENCODERS_PAD_A) / sizeof(pin_t)) -#endif // ENCODER_ENABLE +#endif // ENCODER_ENABLE #ifdef BACKLIGHT_ENABLE # include "backlight.h" -#endif // BACKLIGHT_ENABLE +#endif // BACKLIGHT_ENABLE #ifdef RGBLIGHT_ENABLE # include "rgblight.h" -#endif // RGBLIGHT_ENABLE +#endif // RGBLIGHT_ENABLE typedef struct _split_slave_matrix_sync_t { uint8_t checksum; @@ -62,21 +62,21 @@ typedef struct _split_slave_matrix_sync_t { typedef struct _split_master_matrix_sync_t { matrix_row_t matrix[(MATRIX_ROWS) / 2]; } split_master_matrix_sync_t; -#endif // SPLIT_TRANSPORT_MIRROR +#endif // SPLIT_TRANSPORT_MIRROR #ifdef ENCODER_ENABLE typedef struct _split_slave_encoder_sync_t { uint8_t checksum; uint8_t state[NUMBER_OF_ENCODERS]; } split_slave_encoder_sync_t; -#endif // ENCODER_ENABLE +#endif // ENCODER_ENABLE #if !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) typedef struct _split_layers_sync_t { layer_state_t layer_state; layer_state_t default_layer_state; } split_layers_sync_t; -#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) +#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) #if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) # include "led_matrix.h" @@ -85,7 +85,7 @@ typedef struct _led_matrix_sync_t { led_eeconfig_t led_matrix; bool led_suspend_state; } led_matrix_sync_t; -#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) +#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) # include "rgb_matrix.h" @@ -94,7 +94,7 @@ typedef struct _rgb_matrix_sync_t { rgb_config_t rgb_matrix; bool rgb_suspend_state; } rgb_matrix_sync_t; -#endif // defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) +#endif // defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) #ifdef SPLIT_MODS_ENABLE typedef struct _split_mods_sync_t { @@ -102,9 +102,9 @@ typedef struct _split_mods_sync_t { uint8_t weak_mods; # ifndef NO_ACTION_ONESHOT uint8_t oneshot_mods; -# endif // NO_ACTION_ONESHOT +# endif // NO_ACTION_ONESHOT } split_mods_sync_t; -#endif // SPLIT_MODS_ENABLE +#endif // SPLIT_MODS_ENABLE #if defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) # include "pointing_device.h" @@ -113,7 +113,7 @@ typedef struct _split_slave_pointing_sync_t { report_mouse_t report; uint16_t cpi; } split_slave_pointing_sync_t; -#endif // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) +#endif // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) #if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) typedef struct _rpc_sync_info_t { @@ -121,76 +121,76 @@ typedef struct _rpc_sync_info_t { uint8_t m2s_length; uint8_t s2m_length; } rpc_sync_info_t; -#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) +#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) typedef struct _split_shared_memory_t { #ifdef USE_I2C int8_t transaction_id; -#endif // USE_I2C +#endif // USE_I2C split_slave_matrix_sync_t smatrix; #ifdef SPLIT_TRANSPORT_MIRROR split_master_matrix_sync_t mmatrix; -#endif // SPLIT_TRANSPORT_MIRROR +#endif // SPLIT_TRANSPORT_MIRROR #ifdef ENCODER_ENABLE split_slave_encoder_sync_t encoders; -#endif // ENCODER_ENABLE +#endif // ENCODER_ENABLE #ifndef DISABLE_SYNC_TIMER uint32_t sync_timer; -#endif // DISABLE_SYNC_TIMER +#endif // DISABLE_SYNC_TIMER #if !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) split_layers_sync_t layers; -#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) +#endif // !defined(NO_ACTION_LAYER) && defined(SPLIT_LAYER_STATE_ENABLE) #ifdef SPLIT_LED_STATE_ENABLE uint8_t led_state; -#endif // SPLIT_LED_STATE_ENABLE +#endif // SPLIT_LED_STATE_ENABLE #ifdef SPLIT_MODS_ENABLE split_mods_sync_t mods; -#endif // SPLIT_MODS_ENABLE +#endif // SPLIT_MODS_ENABLE #ifdef BACKLIGHT_ENABLE uint8_t backlight_level; -#endif // BACKLIGHT_ENABLE +#endif // BACKLIGHT_ENABLE #if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) rgblight_syncinfo_t rgblight_sync; -#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) +#endif // defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) #if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) led_matrix_sync_t led_matrix_sync; -#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) +#endif // defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT) #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) rgb_matrix_sync_t rgb_matrix_sync; -#endif // defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) +#endif // defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) #if defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) uint8_t current_wpm; -#endif // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) +#endif // defined(WPM_ENABLE) && defined(SPLIT_WPM_ENABLE) #if defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) uint8_t current_oled_state; -#endif // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) +#endif // defined(OLED_ENABLE) && defined(SPLIT_OLED_ENABLE) #if defined(ST7565_ENABLE) && defined(SPLIT_ST7565_ENABLE) uint8_t current_st7565_state; -#endif // ST7565_ENABLE(OLED_ENABLE) && defined(SPLIT_ST7565_ENABLE) +#endif // ST7565_ENABLE(OLED_ENABLE) && defined(SPLIT_ST7565_ENABLE) #if defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) split_slave_pointing_sync_t pointing; -#endif // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) +#endif // defined(POINTING_DEVICE_ENABLE) && defined(SPLIT_POINTING_ENABLE) #if defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) rpc_sync_info_t rpc_info; uint8_t rpc_m2s_buffer[RPC_M2S_BUFFER_SIZE]; uint8_t rpc_s2m_buffer[RPC_S2M_BUFFER_SIZE]; -#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) +#endif // defined(SPLIT_TRANSACTION_IDS_KB) || defined(SPLIT_TRANSACTION_IDS_USER) } split_shared_memory_t; extern split_shared_memory_t *const split_shmem; diff --git a/quantum/sync_timer.c b/quantum/sync_timer.c index de24b463b6..217891233f 100644 --- a/quantum/sync_timer.c +++ b/quantum/sync_timer.c @@ -29,7 +29,9 @@ SOFTWARE. #if defined(SPLIT_KEYBOARD) && !defined(DISABLE_SYNC_TIMER) volatile int32_t sync_timer_ms; -void sync_timer_init(void) { sync_timer_ms = 0; } +void sync_timer_init(void) { + sync_timer_ms = 0; +} void sync_timer_update(uint32_t time) { if (is_keyboard_master()) return; diff --git a/quantum/velocikey.c b/quantum/velocikey.c index 6b7f82d950..58e14215bb 100644 --- a/quantum/velocikey.c +++ b/quantum/velocikey.c @@ -13,7 +13,9 @@ #define TYPING_SPEED_MAX_VALUE 200 uint8_t typing_speed = 0; -bool velocikey_enabled(void) { return eeprom_read_byte(EECONFIG_VELOCIKEY) == 1; } +bool velocikey_enabled(void) { + return eeprom_read_byte(EECONFIG_VELOCIKEY) == 1; +} void velocikey_toggle(void) { if (velocikey_enabled()) @@ -39,4 +41,6 @@ void velocikey_decelerate(void) { } } -uint8_t velocikey_match_speed(uint8_t minValue, uint8_t maxValue) { return MAX(minValue, maxValue - (maxValue - minValue) * ((float)typing_speed / TYPING_SPEED_MAX_VALUE)); } +uint8_t velocikey_match_speed(uint8_t minValue, uint8_t maxValue) { + return MAX(minValue, maxValue - (maxValue - minValue) * ((float)typing_speed / TYPING_SPEED_MAX_VALUE)); +} diff --git a/quantum/via.c b/quantum/via.c index a3bd82d9b3..05ab799cbb 100644 --- a/quantum/via.c +++ b/quantum/via.c @@ -45,7 +45,7 @@ #include "raw_hid.h" #include "dynamic_keymap.h" #include "eeprom.h" -#include "version.h" // for QMK_BUILDDATE used in EEPROM magic +#include "version.h" // for QMK_BUILDDATE used in EEPROM magic #include "via_ensure_keycode.h" // Forward declare some helpers. @@ -62,7 +62,7 @@ void via_qmk_rgblight_get_value(uint8_t *data); // Can be called in an overriding via_init_kb() to test if keyboard level code usage of // EEPROM is invalid and use/save defaults. bool via_eeprom_is_valid(void) { - char * p = QMK_BUILDDATE; // e.g. "2019-11-05-11:29:54" + char * p = QMK_BUILDDATE; // e.g. "2019-11-05-11:29:54" uint8_t magic0 = ((p[2] & 0x0F) << 4) | (p[3] & 0x0F); uint8_t magic1 = ((p[5] & 0x0F) << 4) | (p[6] & 0x0F); uint8_t magic2 = ((p[8] & 0x0F) << 4) | (p[9] & 0x0F); @@ -73,7 +73,7 @@ bool via_eeprom_is_valid(void) { // Sets VIA/keyboard level usage of EEPROM to valid/invalid // Keyboard level code (eg. via_init_kb()) should not call this void via_eeprom_set_valid(bool valid) { - char * p = QMK_BUILDDATE; // e.g. "2019-11-05-11:29:54" + char * p = QMK_BUILDDATE; // e.g. "2019-11-05-11:29:54" uint8_t magic0 = ((p[2] & 0x0F) << 4) | (p[3] & 0x0F); uint8_t magic1 = ((p[5] & 0x0F) << 4) | (p[6] & 0x0F); uint8_t magic2 = ((p[8] & 0x0F) << 4) | (p[9] & 0x0F); @@ -347,13 +347,13 @@ void raw_hid_receive(uint8_t *data, uint8_t length) { } case id_dynamic_keymap_macro_get_buffer: { uint16_t offset = (command_data[0] << 8) | command_data[1]; - uint16_t size = command_data[2]; // size <= 28 + uint16_t size = command_data[2]; // size <= 28 dynamic_keymap_macro_get_buffer(offset, size, &command_data[3]); break; } case id_dynamic_keymap_macro_set_buffer: { uint16_t offset = (command_data[0] << 8) | command_data[1]; - uint16_t size = command_data[2]; // size <= 28 + uint16_t size = command_data[2]; // size <= 28 dynamic_keymap_macro_set_buffer(offset, size, &command_data[3]); break; } @@ -367,13 +367,13 @@ void raw_hid_receive(uint8_t *data, uint8_t length) { } case id_dynamic_keymap_get_buffer: { uint16_t offset = (command_data[0] << 8) | command_data[1]; - uint16_t size = command_data[2]; // size <= 28 + uint16_t size = command_data[2]; // size <= 28 dynamic_keymap_get_buffer(offset, size, &command_data[3]); break; } case id_dynamic_keymap_set_buffer: { uint16_t offset = (command_data[0] << 8) | command_data[1]; - uint16_t size = command_data[2]; // size <= 28 + uint16_t size = command_data[2]; // size <= 28 dynamic_keymap_set_buffer(offset, size, &command_data[3]); break; } @@ -438,7 +438,7 @@ void via_qmk_backlight_set_value(uint8_t *data) { } } -#endif // #if defined(VIA_QMK_BACKLIGHT_ENABLE) +#endif // #if defined(VIA_QMK_BACKLIGHT_ENABLE) #if defined(VIA_QMK_RGBLIGHT_ENABLE) @@ -494,4 +494,4 @@ void via_qmk_rgblight_set_value(uint8_t *data) { } } -#endif // #if defined(VIA_QMK_RGBLIGHT_ENABLE) +#endif // #if defined(VIA_QMK_RGBLIGHT_ENABLE) diff --git a/quantum/via.h b/quantum/via.h index 5d16917dfa..ac29a58902 100644 --- a/quantum/via.h +++ b/quantum/via.h @@ -16,7 +16,7 @@ #pragma once -#include "eeconfig.h" // for EECONFIG_SIZE +#include "eeconfig.h" // for EECONFIG_SIZE // Keyboard level code can change where VIA stores the magic. // The magic is the build date YYMMDD encoded as BCD in 3 bytes, @@ -59,7 +59,7 @@ #define VIA_PROTOCOL_VERSION 0x0009 enum via_command_id { - id_get_protocol_version = 0x01, // always 0x01 + id_get_protocol_version = 0x01, // always 0x01 id_get_keyboard_value = 0x02, id_set_keyboard_value = 0x03, id_dynamic_keymap_get_keycode = 0x04, @@ -82,7 +82,7 @@ enum via_command_id { }; enum via_keyboard_value_id { - id_uptime = 0x01, // + id_uptime = 0x01, // id_layout_options = 0x02, id_switch_matrix_state = 0x03 }; diff --git a/quantum/wpm.c b/quantum/wpm.c index 62d4128b8e..b2e6fe0430 100644 --- a/quantum/wpm.c +++ b/quantum/wpm.c @@ -55,12 +55,20 @@ static uint8_t prev_wpm = 0; static uint8_t next_wpm = 0; #endif -void set_current_wpm(uint8_t new_wpm) { current_wpm = new_wpm; } -uint8_t get_current_wpm(void) { return current_wpm; } +void set_current_wpm(uint8_t new_wpm) { + current_wpm = new_wpm; +} +uint8_t get_current_wpm(void) { + return current_wpm; +} -bool wpm_keycode(uint16_t keycode) { return wpm_keycode_kb(keycode); } +bool wpm_keycode(uint16_t keycode) { + return wpm_keycode_kb(keycode); +} -__attribute__((weak)) bool wpm_keycode_kb(uint16_t keycode) { return wpm_keycode_user(keycode); } +__attribute__((weak)) bool wpm_keycode_kb(uint16_t keycode) { + return wpm_keycode_user(keycode); +} __attribute__((weak)) bool wpm_keycode_user(uint16_t keycode) { if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) || (keycode >= QK_MODS && keycode <= QK_MODS_MAX)) { @@ -122,7 +130,7 @@ void decay_wpm(void) { uint32_t duration = (((periods)*PERIOD_DURATION) + elapsed); int32_t wpm_now = (60000 * presses) / (duration * WPM_ESTIMATED_WORD_SIZE); - if (wpm_now < 0) // set some reasonable WPM measurement limits + if (wpm_now < 0) // set some reasonable WPM measurement limits wpm_now = 0; if (wpm_now > 240) wpm_now = 240; @@ -133,7 +141,7 @@ void decay_wpm(void) { elapsed = 0; wpm_timer = timer_read32(); } - if (presses < 2) // don't guess high WPM based on a single keypress. + if (presses < 2) // don't guess high WPM based on a single keypress. wpm_now = 0; #if defined(WPM_LAUNCH_CONTROL) @@ -150,7 +158,7 @@ void decay_wpm(void) { wpm_now = 0; period_presses[0] = 0; } -#endif // WPM_LAUNCH_CONTROL +#endif // WPM_LAUNCH_CONTROL #if defined(WPM_UNFILTERED) current_wpm = wpm_now; |