Merge remote-tracking branch 'upstream/develop' into xap
This commit is contained in:
		
						commit
						c9ec8a1309
					
				
					 1525 changed files with 26368 additions and 6063 deletions
				
			
		| 
						 | 
				
			
			@ -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.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			@ -124,7 +132,7 @@ bool process_tapping(keyrecord_t *keyp) {
 | 
			
		|||
#    if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)
 | 
			
		||||
            || (
 | 
			
		||||
#        ifdef RETRO_TAPPING_PER_KEY
 | 
			
		||||
                get_retro_tapping(tapping_keycode, keyp) &&
 | 
			
		||||
                get_retro_tapping(tapping_keycode, &tapping_key) &&
 | 
			
		||||
#        endif
 | 
			
		||||
                (RETRO_SHIFT + 0) != 0 && TIMER_DIFF_16(event.time, tapping_key.event.time) < (RETRO_SHIFT + 0)
 | 
			
		||||
            )
 | 
			
		||||
| 
						 | 
				
			
			@ -158,7 +166,7 @@ bool process_tapping(keyrecord_t *keyp) {
 | 
			
		|||
                        (
 | 
			
		||||
                            (
 | 
			
		||||
#        ifdef TAPPING_TERM_PER_KEY
 | 
			
		||||
                                get_tapping_term(tapping_keycode, keyp)
 | 
			
		||||
                                get_tapping_term(tapping_keycode, &tapping_key)
 | 
			
		||||
#        else
 | 
			
		||||
                                g_tapping_term
 | 
			
		||||
#        endif
 | 
			
		||||
| 
						 | 
				
			
			@ -166,7 +174,7 @@ bool process_tapping(keyrecord_t *keyp) {
 | 
			
		|||
                            )
 | 
			
		||||
 | 
			
		||||
#        ifdef PERMISSIVE_HOLD_PER_KEY
 | 
			
		||||
                            || get_permissive_hold(tapping_keycode, keyp)
 | 
			
		||||
                            || get_permissive_hold(tapping_keycode, &tapping_key)
 | 
			
		||||
#        elif defined(PERMISSIVE_HOLD)
 | 
			
		||||
                            || true
 | 
			
		||||
#        endif
 | 
			
		||||
| 
						 | 
				
			
			@ -177,7 +185,7 @@ bool process_tapping(keyrecord_t *keyp) {
 | 
			
		|||
#        if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)
 | 
			
		||||
                    || (
 | 
			
		||||
#            ifdef RETRO_TAPPING_PER_KEY
 | 
			
		||||
                        get_retro_tapping(tapping_keycode, keyp) &&
 | 
			
		||||
                        get_retro_tapping(tapping_keycode, &tapping_key) &&
 | 
			
		||||
#            endif
 | 
			
		||||
                        (
 | 
			
		||||
                            // Rolled over the two keys.
 | 
			
		||||
| 
						 | 
				
			
			@ -188,7 +196,7 @@ bool process_tapping(keyrecord_t *keyp) {
 | 
			
		|||
                                    || (
 | 
			
		||||
                                        IS_LT(tapping_keycode)
 | 
			
		||||
#                ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY
 | 
			
		||||
                                        && get_hold_on_other_key_press(tapping_keycode, keyp)
 | 
			
		||||
                                        && get_hold_on_other_key_press(tapping_keycode, &tapping_key)
 | 
			
		||||
#                endif
 | 
			
		||||
                                    )
 | 
			
		||||
#            endif
 | 
			
		||||
| 
						 | 
				
			
			@ -196,7 +204,7 @@ bool process_tapping(keyrecord_t *keyp) {
 | 
			
		|||
                                    || (
 | 
			
		||||
                                        IS_MT(tapping_keycode)
 | 
			
		||||
#                ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY
 | 
			
		||||
                                        && !get_ignore_mod_tap_interrupt(tapping_keycode, keyp)
 | 
			
		||||
                                        && !get_ignore_mod_tap_interrupt(tapping_keycode, &tapping_key)
 | 
			
		||||
#                endif
 | 
			
		||||
                                    )
 | 
			
		||||
#            endif
 | 
			
		||||
| 
						 | 
				
			
			@ -252,7 +260,7 @@ bool process_tapping(keyrecord_t *keyp) {
 | 
			
		|||
                        tapping_key.tap.interrupted = true;
 | 
			
		||||
#    if defined(HOLD_ON_OTHER_KEY_PRESS) || defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY)
 | 
			
		||||
#        if defined(HOLD_ON_OTHER_KEY_PRESS_PER_KEY)
 | 
			
		||||
                        if (get_hold_on_other_key_press(tapping_keycode, keyp))
 | 
			
		||||
                        if (get_hold_on_other_key_press(tapping_keycode, &tapping_key))
 | 
			
		||||
#        endif
 | 
			
		||||
                        {
 | 
			
		||||
                            debug("Tapping: End. No tap. Interfered by pressed key\n");
 | 
			
		||||
| 
						 | 
				
			
			@ -360,7 +368,7 @@ bool process_tapping(keyrecord_t *keyp) {
 | 
			
		|||
#    if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)
 | 
			
		||||
            || (
 | 
			
		||||
#        ifdef RETRO_TAPPING_PER_KEY
 | 
			
		||||
                get_retro_tapping(tapping_keycode, keyp) &&
 | 
			
		||||
                get_retro_tapping(tapping_keycode, &tapping_key) &&
 | 
			
		||||
#        endif
 | 
			
		||||
                (RETRO_SHIFT + 0) != 0 && TIMER_DIFF_16(event.time, tapping_key.event.time) < (RETRO_SHIFT + 0)
 | 
			
		||||
            )
 | 
			
		||||
| 
						 | 
				
			
			@ -373,7 +381,7 @@ bool process_tapping(keyrecord_t *keyp) {
 | 
			
		|||
#    if !defined(TAPPING_FORCE_HOLD) || defined(TAPPING_FORCE_HOLD_PER_KEY)
 | 
			
		||||
                    if (
 | 
			
		||||
#        ifdef TAPPING_FORCE_HOLD_PER_KEY
 | 
			
		||||
                        !get_tapping_force_hold(tapping_keycode, keyp) &&
 | 
			
		||||
                        !get_tapping_force_hold(tapping_keycode, &tapping_key) &&
 | 
			
		||||
#        endif
 | 
			
		||||
                        !tapping_key.tap.interrupted && tapping_key.tap.count > 0) {
 | 
			
		||||
                        // sequential tap.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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())
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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++;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);                                     \
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,6 +27,8 @@
 | 
			
		|||
 | 
			
		||||
#ifdef IS31FL3731
 | 
			
		||||
#    include "is31fl3731-simple.h"
 | 
			
		||||
#elif defined(IS31FLCOMMON)
 | 
			
		||||
#    include "is31flcommon.h"
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef IS31FL3733
 | 
			
		||||
#    include "is31fl3733-simple.h"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,7 +25,7 @@
 | 
			
		|||
 * in their own files.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined(IS31FL3731) || defined(IS31FL3733)
 | 
			
		||||
#if defined(IS31FL3731) || defined(IS31FL3733) || defined(IS31FLCOMMON)
 | 
			
		||||
#    include "i2c_master.h"
 | 
			
		||||
 | 
			
		||||
static void init(void) {
 | 
			
		||||
| 
						 | 
				
			
			@ -66,6 +66,18 @@ static void init(void) {
 | 
			
		|||
#                endif
 | 
			
		||||
#            endif
 | 
			
		||||
#        endif
 | 
			
		||||
 | 
			
		||||
#    elif defined(IS31FLCOMMON)
 | 
			
		||||
    IS31FL_common_init(DRIVER_ADDR_1, ISSI_SSR_1);
 | 
			
		||||
#        if defined(LED_DRIVER_ADDR_2)
 | 
			
		||||
    IS31FL_common_init(DRIVER_ADDR_2, ISSI_SSR_2);
 | 
			
		||||
#            if defined(LED_DRIVER_ADDR_3)
 | 
			
		||||
    IS31FL_common_init(DRIVER_ADDR_3, ISSI_SSR_3);
 | 
			
		||||
#                if defined(LED_DRIVER_ADDR_4)
 | 
			
		||||
    IS31FL_common_init(DRIVER_ADDR_4, ISSI_SSR_4);
 | 
			
		||||
#                endif
 | 
			
		||||
#            endif
 | 
			
		||||
#        endif
 | 
			
		||||
#    endif
 | 
			
		||||
 | 
			
		||||
    for (int index = 0; index < DRIVER_LED_TOTAL; index++) {
 | 
			
		||||
| 
						 | 
				
			
			@ -73,6 +85,8 @@ static void init(void) {
 | 
			
		|||
        IS31FL3731_set_led_control_register(index, true);
 | 
			
		||||
#    elif defined(IS31FL3733)
 | 
			
		||||
        IS31FL3733_set_led_control_register(index, true);
 | 
			
		||||
#    elif defined(IS31FLCOMMON)
 | 
			
		||||
        IS31FL_simple_set_scaling_buffer(index, true);
 | 
			
		||||
#    endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -100,6 +114,21 @@ static void init(void) {
 | 
			
		|||
#                endif
 | 
			
		||||
#            endif
 | 
			
		||||
#        endif
 | 
			
		||||
 | 
			
		||||
#    elif defined(IS31FLCOMMON)
 | 
			
		||||
#        ifdef ISSI_MANUAL_SCALING
 | 
			
		||||
    IS31FL_set_manual_scaling_buffer();
 | 
			
		||||
#        endif
 | 
			
		||||
    IS31FL_common_update_scaling_register(DRIVER_ADDR_1, 0);
 | 
			
		||||
#        if defined(LED_DRIVER_ADDR_2)
 | 
			
		||||
    IS31FL_common_update_scaling_register(DRIVER_ADDR_2, 1);
 | 
			
		||||
#            if defined(LED_DRIVER_ADDR_3)
 | 
			
		||||
    IS31FL_common_update_scaling_register(DRIVER_ADDR_3, 2);
 | 
			
		||||
#                if defined(LED_DRIVER_ADDR_4)
 | 
			
		||||
    IS31FL_common_update_scaling_register(DRIVER_ADDR_4, 3);
 | 
			
		||||
#                endif
 | 
			
		||||
#            endif
 | 
			
		||||
#        endif
 | 
			
		||||
#    endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -144,5 +173,26 @@ const led_matrix_driver_t led_matrix_driver = {
 | 
			
		|||
    .set_value = IS31FL3733_set_value,
 | 
			
		||||
    .set_value_all = IS31FL3733_set_value_all,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#    elif defined(IS31FLCOMMON)
 | 
			
		||||
static void flush(void) {
 | 
			
		||||
    IS31FL_common_update_pwm_register(DRIVER_ADDR_1, 0);
 | 
			
		||||
#        if defined(LED_DRIVER_ADDR_2)
 | 
			
		||||
    IS31FL_common_update_pwm_register(DRIVER_ADDR_2, 1);
 | 
			
		||||
#            if defined(LED_DRIVER_ADDR_3)
 | 
			
		||||
    IS31FL_common_update_pwm_register(DRIVER_ADDR_3, 2);
 | 
			
		||||
#                if defined(LED_DRIVER_ADDR_4)
 | 
			
		||||
    IS31FL_common_update_pwm_register(DRIVER_ADDR_4, 3);
 | 
			
		||||
#                endif
 | 
			
		||||
#            endif
 | 
			
		||||
#        endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const led_matrix_driver_t led_matrix_driver = {
 | 
			
		||||
    .init = init,
 | 
			
		||||
    .flush = flush,
 | 
			
		||||
    .set_value = IS31FL_simple_set_brightness,
 | 
			
		||||
    .set_value_all = IS31FL_simple_set_brigntness_all,
 | 
			
		||||
};
 | 
			
		||||
#    endif
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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      //
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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();
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -47,19 +47,19 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef DIRECT_PINS
 | 
			
		||||
static SPLIT_MUTABLE pin_t direct_pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS;
 | 
			
		||||
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[MATRIX_ROWS] = MATRIX_ROW_PINS;
 | 
			
		||||
#    endif  // MATRIX_ROW_PINS
 | 
			
		||||
static SPLIT_MUTABLE_ROW pin_t row_pins[ROWS_PER_HAND] = 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
 | 
			
		||||
static SPLIT_MUTABLE_COL pin_t col_pins[MATRIX_COLS]   = 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
 | 
			
		||||
| 
						 | 
				
			
			@ -78,8 +78,17 @@ static inline void setPinOutput_writeLow(pin_t pin) {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void setPinOutput_writeHigh(pin_t pin) {
 | 
			
		||||
    ATOMIC_BLOCK_FORCEON {
 | 
			
		||||
        setPinOutput(pin);
 | 
			
		||||
        writePinHigh(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) {
 | 
			
		||||
| 
						 | 
				
			
			@ -95,7 +104,7 @@ static inline uint8_t readMatrixPin(pin_t pin) {
 | 
			
		|||
#ifdef DIRECT_PINS
 | 
			
		||||
 | 
			
		||||
__attribute__((weak)) void matrix_init_pins(void) {
 | 
			
		||||
    for (int row = 0; row < MATRIX_ROWS; row++) {
 | 
			
		||||
    for (int row = 0; row < ROWS_PER_HAND; row++) {
 | 
			
		||||
        for (int col = 0; col < MATRIX_COLS; col++) {
 | 
			
		||||
            pin_t pin = direct_pins[row][col];
 | 
			
		||||
            if (pin != NO_PIN) {
 | 
			
		||||
| 
						 | 
				
			
			@ -137,7 +146,11 @@ static bool select_row(uint8_t row) {
 | 
			
		|||
static void unselect_row(uint8_t row) {
 | 
			
		||||
    pin_t pin = row_pins[row];
 | 
			
		||||
    if (pin != NO_PIN) {
 | 
			
		||||
#            ifdef MATRIX_UNSELECT_DRIVE_HIGH
 | 
			
		||||
        setPinOutput_writeHigh(pin);
 | 
			
		||||
#            else
 | 
			
		||||
        setPinInputHigh_atomic(pin);
 | 
			
		||||
#            endif
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -160,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();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -176,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;
 | 
			
		||||
| 
						 | 
				
			
			@ -196,7 +209,11 @@ static bool select_col(uint8_t col) {
 | 
			
		|||
static void unselect_col(uint8_t col) {
 | 
			
		||||
    pin_t pin = col_pins[col];
 | 
			
		||||
    if (pin != NO_PIN) {
 | 
			
		||||
#            ifdef MATRIX_UNSELECT_DRIVE_HIGH
 | 
			
		||||
        setPinOutput_writeHigh(pin);
 | 
			
		||||
#            else
 | 
			
		||||
        setPinInputHigh_atomic(pin);
 | 
			
		||||
#            endif
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -219,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();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -239,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
 | 
			
		||||
| 
						 | 
				
			
			@ -255,16 +272,16 @@ void matrix_init(void) {
 | 
			
		|||
    // Set pinout for right half if pinout for that half is defined
 | 
			
		||||
    if (!isLeftHand) {
 | 
			
		||||
#    ifdef DIRECT_PINS_RIGHT
 | 
			
		||||
        const pin_t direct_pins_right[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS_RIGHT;
 | 
			
		||||
        for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
 | 
			
		||||
        const pin_t direct_pins_right[ROWS_PER_HAND][MATRIX_COLS] = DIRECT_PINS_RIGHT;
 | 
			
		||||
        for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
 | 
			
		||||
            for (uint8_t j = 0; j < MATRIX_COLS; j++) {
 | 
			
		||||
                direct_pins[i][j] = direct_pins_right[i][j];
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
#    endif
 | 
			
		||||
#    ifdef MATRIX_ROW_PINS_RIGHT
 | 
			
		||||
        const pin_t row_pins_right[MATRIX_ROWS] = MATRIX_ROW_PINS_RIGHT;
 | 
			
		||||
        for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
 | 
			
		||||
        const pin_t row_pins_right[ROWS_PER_HAND] = MATRIX_ROW_PINS_RIGHT;
 | 
			
		||||
        for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
 | 
			
		||||
            row_pins[i] = row_pins_right[i];
 | 
			
		||||
        }
 | 
			
		||||
#    endif
 | 
			
		||||
| 
						 | 
				
			
			@ -296,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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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));
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -101,7 +101,7 @@ const pointing_device_driver_t pointing_device_driver = {
 | 
			
		|||
#        ifdef TAPPING_TERM_PER_KEY
 | 
			
		||||
#            include "action.h"
 | 
			
		||||
#            include "action_tapping.h"
 | 
			
		||||
#            define CIRQUE_PINNACLE_TAPPING_TERM get_tapping_term(KC_BTN1, NULL)
 | 
			
		||||
#            define CIRQUE_PINNACLE_TAPPING_TERM get_tapping_term(KC_BTN1, &(keyrecord_t){})
 | 
			
		||||
#        else
 | 
			
		||||
#            ifdef TAPPING_TERM
 | 
			
		||||
#                define CIRQUE_PINNACLE_TAPPING_TERM TAPPING_TERM
 | 
			
		||||
| 
						 | 
				
			
			@ -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 = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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() {}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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.
 | 
			
		||||
| 
						 | 
				
			
			@ -82,7 +90,7 @@ void dynamic_macro_play(keyrecord_t *macro_buffer, keyrecord_t *macro_end, int8_
 | 
			
		|||
 | 
			
		||||
    clear_keyboard();
 | 
			
		||||
 | 
			
		||||
    layer_state = saved_layer_state;
 | 
			
		||||
    layer_state_set(saved_layer_state);
 | 
			
		||||
 | 
			
		||||
    dynamic_macro_play_user(direction);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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++;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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[]) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			@ -173,7 +175,7 @@ void tap_dance_task() {
 | 
			
		|||
            tap_user_defined = action->custom_tapping_term;
 | 
			
		||||
        } else {
 | 
			
		||||
#ifdef TAPPING_TERM_PER_KEY
 | 
			
		||||
            tap_user_defined = get_tapping_term(action->state.keycode, NULL);
 | 
			
		||||
            tap_user_defined = get_tapping_term(action->state.keycode, &(keyrecord_t){});
 | 
			
		||||
#else
 | 
			
		||||
            tap_user_defined = TAPPING_TERM;
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			@ -381,17 +398,6 @@ __attribute__((weak)) void startup_user() {}
 | 
			
		|||
 | 
			
		||||
__attribute__((weak)) void shutdown_user() {}
 | 
			
		||||
 | 
			
		||||
/** \brief Run keyboard level Power down
 | 
			
		||||
 *
 | 
			
		||||
 * FIXME: needs doc
 | 
			
		||||
 */
 | 
			
		||||
__attribute__((weak)) void suspend_power_down_user(void) {}
 | 
			
		||||
/** \brief Run keyboard level Power down
 | 
			
		||||
 *
 | 
			
		||||
 * FIXME: needs doc
 | 
			
		||||
 */
 | 
			
		||||
__attribute__((weak)) void suspend_power_down_kb(void) { suspend_power_down_user(); }
 | 
			
		||||
 | 
			
		||||
void suspend_power_down_quantum(void) {
 | 
			
		||||
#ifndef NO_SUSPEND_POWER_DOWN
 | 
			
		||||
// Turn off backlight
 | 
			
		||||
| 
						 | 
				
			
			@ -439,18 +445,6 @@ void suspend_power_down_quantum(void) {
 | 
			
		|||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** \brief run user level code immediately after wakeup
 | 
			
		||||
 *
 | 
			
		||||
 * FIXME: needs doc
 | 
			
		||||
 */
 | 
			
		||||
__attribute__((weak)) void suspend_wakeup_init_user(void) {}
 | 
			
		||||
 | 
			
		||||
/** \brief run keyboard level code immediately after wakeup
 | 
			
		||||
 *
 | 
			
		||||
 * FIXME: needs doc
 | 
			
		||||
 */
 | 
			
		||||
__attribute__((weak)) void suspend_wakeup_init_kb(void) { suspend_wakeup_init_user(); }
 | 
			
		||||
 | 
			
		||||
__attribute__((weak)) void suspend_wakeup_init_quantum(void) {
 | 
			
		||||
// Turn on backlight
 | 
			
		||||
#ifdef BACKLIGHT_ENABLE
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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_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_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_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_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_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_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_ALLOFF, // 5CB1
 | 
			
		||||
 | 
			
		||||
    MI_SUS,   // 5CB2
 | 
			
		||||
    MI_PORT,  // 5CB3
 | 
			
		||||
    MI_SOST,  // 5CB4
 | 
			
		||||
    MI_SOFT,  // 5CB5
 | 
			
		||||
    MI_LEG,   // 5CB6
 | 
			
		||||
    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_MOD,   // 5CB7
 | 
			
		||||
    MI_MODSD, // 5CB8
 | 
			
		||||
    MI_MODSU, // 5CB9
 | 
			
		||||
 | 
			
		||||
    MI_BENDD,  // 5CBA
 | 
			
		||||
    MI_BENDU,  // 5CBB
 | 
			
		||||
    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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
Some files were not shown because too many files have changed in this diff Show more
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue