diff options
Diffstat (limited to 'users')
54 files changed, 300 insertions, 241 deletions
diff --git a/users/333fred/333fred.c b/users/333fred/333fred.c index 99f4e01685..ea7b904403 100644 --- a/users/333fred/333fred.c +++ b/users/333fred/333fred.c @@ -115,7 +115,7 @@ void tap_dance_process_keycode(uint16_t keycode) { } __attribute__ ((weak)) -void layer_state_set_rgb(uint32_t state) {} +void layer_state_set_rgb(layer_state_t state) {} layer_state_t layer_state_set_user(layer_state_t state) { layer_state_set_rgb(state); diff --git a/users/333fred/rgb.c b/users/333fred/rgb.c index d287143302..ae21702030 100644 --- a/users/333fred/rgb.c +++ b/users/333fred/rgb.c @@ -23,8 +23,8 @@ #include "quantum.h" #include "333fred.h" -void layer_state_set_rgb(uint32_t state) { - switch (biton32(state)) { +void layer_state_set_rgb(layer_state_t state) { + switch (get_highest_layer(state)) { case BASE: // purple rgblight_sethsv_noeeprom(210, 255, 20); diff --git a/users/bbaserdem/bbaserdem.c b/users/bbaserdem/bbaserdem.c index 08346c3d64..e0e204c302 100644 --- a/users/bbaserdem/bbaserdem.c +++ b/users/bbaserdem/bbaserdem.c @@ -146,7 +146,7 @@ __attribute__ ((weak)) void keyboard_post_init_user(void) { transaction_register_rpc( RPC_ID_CONFIG_SYNC, userspace_config_sync ); transaction_register_rpc(RPC_ID_RUNTIME_SYNC, userspace_runtime_sync); // Load default config values - if (is_keyboard_master()) { + if (is_keyboard_master()) { // If we are main; load from eeconfig userspace_config.raw = eeconfig_read_user(); // And update the transport variable @@ -321,7 +321,7 @@ void led_set_user(uint8_t usb_led) { /*-----------------*\ |*-----SUSPEND-----*| \*-----------------*/ -/* Suspend stuff here, mostly for the rgb lighting. +/* Suspend stuff here, mostly for the rgb lighting. */ __attribute__ ((weak)) void suspend_power_down_keymap (void) { } void suspend_power_down_user(void) { @@ -340,6 +340,21 @@ void suspend_wakeup_init_user(void) { # endif // RGB_MATRIX_ENABLE } +<<<<<<< HEAD + state = layer_state_set_keymap (state); +#ifdef RGBLIGHT_ENABLE + // Change RGB lighting depending on the last layer activated + rgblight_change( get_highest_layer(state) ); +#endif + return state; +||||||| f439fe6055 + state = layer_state_set_keymap (state); +#ifdef RGBLIGHT_ENABLE + // Change RGB lighting depending on the last layer activated + rgblight_change( biton32(state) ); +#endif + return state; +======= /*------------------*\ |*-----SHUTDOWN-----*| \*------------------*/ @@ -357,4 +372,5 @@ void shutdown_user(void) { # endif // RGB_MATRIX_ENABLE // Keymap hooks shutdown_keymap(); +>>>>>>> upstream/master } diff --git a/users/bcat/rules.mk b/users/bcat/rules.mk index 1ad2ee0aa8..090f7474eb 100644 --- a/users/bcat/rules.mk +++ b/users/bcat/rules.mk @@ -47,7 +47,6 @@ endif COMMAND_ENABLE = no CONSOLE_ENABLE = no MOUSEKEY_ENABLE = no -TERMINAL_ENABLE = no # Disable unwanted hardware options on all keyboards. (Some keyboards turn # these features on by default even though they aren't actually required.) diff --git a/users/billypython/billypython.c b/users/billypython/billypython.c index 180b478d7a..f165d2e260 100644 --- a/users/billypython/billypython.c +++ b/users/billypython/billypython.c @@ -23,7 +23,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } __attribute__((weak)) -uint32_t layer_state_set_keymap(uint32_t state) { +layer_state_t layer_state_set_keymap(layer_state_t state) { return state; } diff --git a/users/billypython/billypython.h b/users/billypython/billypython.h index 4a444e9787..cdf5121f2f 100644 --- a/users/billypython/billypython.h +++ b/users/billypython/billypython.h @@ -31,4 +31,4 @@ enum layers_user { }; bool process_record_keymap(uint16_t keycode, keyrecord_t *record); -uint32_t layer_state_set_keymap(uint32_t state); +layer_state_t layer_state_set_keymap(layer_state_t state); diff --git a/users/curry/config.h b/users/curry/config.h index 3301ebe533..0c96293bd5 100644 --- a/users/curry/config.h +++ b/users/curry/config.h @@ -65,10 +65,6 @@ # define ONESHOT_TIMEOUT 3000 #endif // !ONESHOT_TIMEOUT -#if !defined(QMK_KEYS_PER_SCAN) -# define QMK_KEYS_PER_SCAN 4 -#endif // !QMK_KEYS_PER_SCAN - #define IGNORE_MOD_TAP_INTERRUPT #undef PERMISSIVE_HOLD diff --git a/users/dhertz/dhertz.c b/users/dhertz/dhertz.c index 163b1cb644..1a2b6e38f1 100644 --- a/users/dhertz/dhertz.c +++ b/users/dhertz/dhertz.c @@ -18,7 +18,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } __attribute__ ((weak)) -uint32_t layer_state_set_keymap (uint32_t state) { +layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } __attribute__ ((weak)) @@ -107,4 +107,3 @@ layer_state_t layer_state_set_user (layer_state_t state) { void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); } - diff --git a/users/doogle999/doogle999.c b/users/doogle999/doogle999.c index 320de7cff8..c9ee125741 100644 --- a/users/doogle999/doogle999.c +++ b/users/doogle999/doogle999.c @@ -382,7 +382,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) static char text[CALC_BUFFER_SIZE + 1]; // Used to store input and then output when ready to print static char backspaceText[CALC_BUFFER_SIZE + 1]; // Pretty dumb waste of memory because only backspace characters, used with send_string to backspace and remove input - if((biton32(layer_state) == CALC_LAYER && CALC_FORCE_NUM_LOCK_INSIDE_CALC) || (biton32(layer_state) != CALC_LAYER && CALC_FORCE_NUM_LOCK_OUTSIDE_CALC)) + if((get_highest_layer(layer_state) == CALC_LAYER && CALC_FORCE_NUM_LOCK_INSIDE_CALC) || (get_highest_layer(layer_state) != CALC_LAYER && CALC_FORCE_NUM_LOCK_OUTSIDE_CALC)) { bool numpadKeyPressed = record->event.pressed && !(get_mods() & MODS_SHIFT_MASK) && @@ -397,7 +397,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) } } - if(biton32(layer_state) != CALC_LAYER) { return true; } + if(get_highest_layer(layer_state) != CALC_LAYER) { return true; } int action = process_input(keycode, get_mods(), record->event); switch(action) @@ -457,4 +457,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) send_string(characterToSend); } return false; -}
\ No newline at end of file +} diff --git a/users/drashna/post_config.h b/users/drashna/post_config.h index 2d5e6438d6..85c028076e 100644 --- a/users/drashna/post_config.h +++ b/users/drashna/post_config.h @@ -37,10 +37,6 @@ # define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_REST_MODE #endif -#ifndef QMK_KEYS_PER_SCAN -# define QMK_KEYS_PER_SCAN 8 -#endif - #ifdef MOUSEKEY_ENABLE // mouse movement config # ifdef MK_3_SPEED diff --git a/users/edvorakjp/edvorakjp.c b/users/edvorakjp/edvorakjp.c index c44d8bb440..c95b03d981 100644 --- a/users/edvorakjp/edvorakjp.c +++ b/users/edvorakjp/edvorakjp.c @@ -12,7 +12,7 @@ layer_state_t layer_state_set_user(layer_state_t state) { return layer_state_set_keymap(state); } -__attribute__((weak)) uint32_t layer_state_set_keymap(uint32_t state) { return state; } +__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; } bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user_result = process_record_keymap(keycode, record) && process_record_edvorakjp_swap_scln(keycode, record) && process_record_edvorakjp_config(keycode, record) && process_record_layer(keycode, record) && process_record_ime(keycode, record); diff --git a/users/edvorakjp/edvorakjp.h b/users/edvorakjp/edvorakjp.h index 93cd9851b7..a878f71ca8 100644 --- a/users/edvorakjp/edvorakjp.h +++ b/users/edvorakjp/edvorakjp.h @@ -68,7 +68,7 @@ enum tap_dance_code { void matrix_init_user(void); void matrix_init_keymap(void); layer_state_t layer_state_set_user(layer_state_t state); -uint32_t layer_state_set_keymap(uint32_t state); +layer_state_t layer_state_set_keymap(layer_state_t state); bool process_record_user(uint16_t keycode, keyrecord_t *record); bool process_record_keymap(uint16_t keycode, keyrecord_t *record); diff --git a/users/edvorakjp/edvorakjp_tap_dance.c b/users/edvorakjp/edvorakjp_tap_dance.c index cee10de693..69fcbac1ca 100644 --- a/users/edvorakjp/edvorakjp_tap_dance.c +++ b/users/edvorakjp/edvorakjp_tap_dance.c @@ -64,6 +64,15 @@ void td_raise_reset(qk_tap_dance_state_t *state, void *user_data) { } qk_tap_dance_action_t tap_dance_actions[] = { - [TD_EDVORAKJP_LOWER] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, td_lower_finished, td_lower_reset, 150), - [TD_EDVORAKJP_RAISE] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, td_raise_finished, td_raise_reset, 150), + [TD_EDVORAKJP_LOWER] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, td_lower_finished, td_lower_reset), + [TD_EDVORAKJP_RAISE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, td_raise_finished, td_raise_reset), }; + +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QK_TAP_DANCE ... QK_TAP_DANCE_MAX: + return 150; + default: + return TAPPING_TERM; + } +} diff --git a/users/ericgebhart/ericgebhart.c b/users/ericgebhart/ericgebhart.c index 2a34110ae2..a071fb8c2e 100755 --- a/users/ericgebhart/ericgebhart.c +++ b/users/ericgebhart/ericgebhart.c @@ -40,7 +40,7 @@ __attribute__ ((weak)) void matrix_scan_keymap(void) {} __attribute__ ((weak)) -uint32_t layer_state_set_keymap (uint32_t state) { +layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } diff --git a/users/ericgebhart/tap_dances.c b/users/ericgebhart/tap_dances.c index 9f344986aa..8f9503a261 100755 --- a/users/ericgebhart/tap_dances.c +++ b/users/ericgebhart/tap_dances.c @@ -47,7 +47,7 @@ void tap_dance_mouse_btns (qk_tap_dance_state_t *state, void *user_data) { // counting on all the qwerty layers to be less than dvorak_on_bepo int on_qwerty(){ - uint8_t deflayer = (biton32(default_layer_state)); + uint8_t deflayer = (get_highest_layer(default_layer_state)); return (deflayer < _DVORAK_BP); } @@ -58,7 +58,7 @@ static void switch_default_layer(uint8_t layer) { // so the keyboard remembers which layer it's in after power disconnect. /* - uint32_t default_layer_state_set_kb(uint32_t state) { + layer_state_t default_layer_state_set_kb(layer_state_t state) { eeconfig_update_default_layer(state); return state; } diff --git a/users/gourdo1/gourdo1.c b/users/gourdo1/gourdo1.c index 9062a452ff..51f774061e 100644 --- a/users/gourdo1/gourdo1.c +++ b/users/gourdo1/gourdo1.c @@ -413,7 +413,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t * record) { } else unregister_code16(keycode); break; - // Double Zero + // Double Zero case KC_00: if (record -> event.pressed) { // when keycode KC_00 is pressed diff --git a/users/hvp/config.h b/users/hvp/config.h index 68dd8b4828..b7d0443bbc 100644 --- a/users/hvp/config.h +++ b/users/hvp/config.h @@ -15,4 +15,5 @@ */ #pragma once -#define LONG_TAPPING_TERM 1000
\ No newline at end of file +#define LONG_TAPPING_TERM 1000 +#define PERMISSIVE_HOLD diff --git a/users/ishtob/config.h b/users/ishtob/config.h index 6c07d2f2fd..695077528c 100755 --- a/users/ishtob/config.h +++ b/users/ishtob/config.h @@ -16,7 +16,6 @@ //#define LEADER_TIMEOUT 300 //#define BACKLIGHT_BREATHING //#define PERMISSIVE_HOLD -// #define QMK_KEYS_PER_SCAN 4 //audio clicky //#define AUDIO_CLICKY diff --git a/users/issmirnov/config.h b/users/issmirnov/config.h index 664ebfe8a3..5fe78f7a53 100644 --- a/users/issmirnov/config.h +++ b/users/issmirnov/config.h @@ -1,8 +1,5 @@ #pragma once -// Allows sending more than one key per scan. Useful for chords. -#define QMK_KEYS_PER_SCAN 4 - // how long before a tap becomes a hold #undef TAPPING_TERM #define TAPPING_TERM 100 diff --git a/users/kuchosauronad0/config.h b/users/kuchosauronad0/config.h index 58542dc184..8502031f02 100644 --- a/users/kuchosauronad0/config.h +++ b/users/kuchosauronad0/config.h @@ -41,10 +41,6 @@ # define ONESHOT_TIMEOUT 3000 #endif// !ONESHOT_TIMEOUT -#ifndef QMK_KEYS_PER_SCAN -# define QMK_KEYS_PER_SCAN 4 -#endif // !QMK_KEYS_PER_SCAN - #if defined(LEADER_ENABLE) # define LEADER_PER_KEY_TIMING # define LEADER_TIMEOUT 250 diff --git a/users/kuchosauronad0/kuchosauronad0.c b/users/kuchosauronad0/kuchosauronad0.c index a8f17b08ee..820d84daad 100644 --- a/users/kuchosauronad0/kuchosauronad0.c +++ b/users/kuchosauronad0/kuchosauronad0.c @@ -117,7 +117,7 @@ void matrix_scan_user(void){ } __attribute__ ((weak)) -uint32_t layer_state_set_keymap (uint32_t state) { +layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } @@ -133,12 +133,12 @@ layer_state_t layer_state_set_user(layer_state_t state) { __attribute__ ((weak)) -uint32_t default_layer_state_set_keymap (uint32_t state) { +layer_state_t default_layer_state_set_keymap (layer_state_t state) { return state; } // Runs state check and changes underglow color and animation -uint32_t default_layer_state_set_user(uint32_t state) { +layer_state_t default_layer_state_set_user(layer_state_t state) { state = default_layer_state_set_keymap(state); #if 0 #ifdef RGBLIGHT_ENABLE diff --git a/users/kuchosauronad0/kuchosauronad0.h b/users/kuchosauronad0/kuchosauronad0.h index da996457c6..5cbd517d67 100644 --- a/users/kuchosauronad0/kuchosauronad0.h +++ b/users/kuchosauronad0/kuchosauronad0.h @@ -65,8 +65,8 @@ void shutdown_keymap(void); void suspend_power_down_keymap(void); void suspend_wakeup_init_keymap(void); void matrix_scan_keymap(void); -uint32_t layer_state_set_keymap (uint32_t state); -uint32_t default_layer_state_set_keymap (uint32_t state); +layer_state_t layer_state_set_keymap (layer_state_t state); +layer_state_t default_layer_state_set_keymap (layer_state_t state); void led_set_keymap(uint8_t usb_led); void eeconfig_init_keymap(void); diff --git a/users/kuchosauronad0/rgblight_user.c b/users/kuchosauronad0/rgblight_user.c index 63e412c557..feea0c412f 100644 --- a/users/kuchosauronad0/rgblight_user.c +++ b/users/kuchosauronad0/rgblight_user.c @@ -84,7 +84,7 @@ void matrix_scan_rgb(void) { layer_state_t layer_state_set_rgb(layer_state_t state) { # ifdef RGBLIGHT_ENABLE if (userspace_config.rgb_layer_change) { - switch (biton32(state)) { // _RAISE, _LOWER and _ADJUST use a custom color and the breathing effect + switch (get_highest_layer(state)) { // _RAISE, _LOWER and _ADJUST use a custom color and the breathing effect case _RAISE: rgblight_sethsv_noeeprom_green(); rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); @@ -98,7 +98,7 @@ layer_state_t layer_state_set_rgb(layer_state_t state) { rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 2); break; default: // Use a solid color for normal layers - switch (biton32(default_layer_state)) { + switch (get_highest_layer(default_layer_state)) { case _QWERTY: rgblight_sethsv_noeeprom_magenta(); break; @@ -118,7 +118,7 @@ layer_state_t layer_state_set_rgb(layer_state_t state) { rgblight_sethsv_noeeprom_white(); break; } - biton32(state) == _MODS ? rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING) : rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); // if _MODS layer is on, then breath to denote it + get_highest_layer(state) == _MODS ? rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING) : rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); // if _MODS layer is on, then breath to denote it break; } } @@ -135,7 +135,7 @@ void matrix_scan_indicator(void) { #endif // !INDICATOR_LIGHTS void rgblight_fade_helper(bool direction){ - // true: increase val = fade in + // true: increase val = fade in // false: decrease val = fade out for (uint8_t index = 0; index < RGBLIGHT_VAL_STEP ; index++) { direction ? rgblight_increase_val() : rgblight_decrease_val(); @@ -147,10 +147,10 @@ void fadeflash_leds(uint8_t hue, uint8_t sat, uint8_t val){ // fade out, set new hue and saturation, fade in, fade out, set old color, fade in // this is used in leader.c // TODO: come up with a better name maybe - rgblight_fade_helper(false); - rgblight_sethsv_noeeprom(hue, sat, 0); - rgblight_fade_helper(true); - rgblight_fade_helper(false); - rgblight_sethsv_noeeprom(base_hue, base_sat, 0); - rgblight_fade_helper(true); + rgblight_fade_helper(false); + rgblight_sethsv_noeeprom(hue, sat, 0); + rgblight_fade_helper(true); + rgblight_fade_helper(false); + rgblight_sethsv_noeeprom(base_hue, base_sat, 0); + rgblight_fade_helper(true); } diff --git a/users/kuchosauronad0/template.c b/users/kuchosauronad0/template.c index 475e45d391..76cc572be3 100644 --- a/users/kuchosauronad0/template.c +++ b/users/kuchosauronad0/template.c @@ -63,11 +63,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { __attribute__ ((weak)) -uint32_t layer_state_set_keymap (uint32_t state) { +layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } -uint32_t layer_state_set_user (uint32_t state) { +layer_state_t layer_state_set_user (layer_state_t state) { return layer_state_set_keymap (state); } diff --git a/users/manna-harbour_miryoku/post_rules.mk b/users/manna-harbour_miryoku/post_rules.mk index c5b4b7d28e..8fece85e66 100644 --- a/users/manna-harbour_miryoku/post_rules.mk +++ b/users/manna-harbour_miryoku/post_rules.mk @@ -1,8 +1,6 @@ # Copyright 2019 Manna Harbour # https://github.com/manna-harbour/miryoku -SRC += manna-harbour_miryoku.c # keymaps - # alternative layouts: # alphas diff --git a/users/manna-harbour_miryoku/rules.mk b/users/manna-harbour_miryoku/rules.mk index 879c7fc43e..ea226c4a3d 100644 --- a/users/manna-harbour_miryoku/rules.mk +++ b/users/manna-harbour_miryoku/rules.mk @@ -5,7 +5,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control AUTO_SHIFT_ENABLE = yes # Auto Shift -SRC += manna-harbour_miryoku.c # keymaps +INTROSPECTION_KEYMAP_C = manna-harbour_miryoku.c # keymaps include users/manna-harbour_miryoku/custom_rules.mk diff --git a/users/miles2go/config.h b/users/miles2go/config.h index a704df4b55..2a1d6504d6 100644 --- a/users/miles2go/config.h +++ b/users/miles2go/config.h @@ -6,10 +6,6 @@ #define RGBLIGHT_EFFECT_BREATHING #endif // RGBLIGHT_ENABLE -#ifndef QMK_KEYS_PER_SCAN -#define QMK_KEYS_PER_SCAN 4 -#endif // !QMK_KEYS_PER_SCAN - #undef FORCE_NKRO #ifndef TAPPING_TOGGLE diff --git a/users/mnil/config.h b/users/mnil/config.h index 3547785ff7..b471b9a818 100644 --- a/users/mnil/config.h +++ b/users/mnil/config.h @@ -19,3 +19,4 @@ #define MK_3_SPEED #define MK_MOMENTARY_ACCEL #define PERMISSIVE_HOLD +#define TAPPING_TERM 250 diff --git a/users/mnil/mnil.c b/users/mnil/mnil.c index d5bd0ef0bb..00da6086ef 100644 --- a/users/mnil/mnil.c +++ b/users/mnil/mnil.c @@ -140,7 +140,7 @@ void aa_reset(qk_tap_dance_state_t *state, void *user_data) { // clang-format off qk_tap_dance_action_t tap_dance_actions[] = { - [AAE] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, ae_finished, ae_reset, 250), - [OAA] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, aa_finished, aa_reset, 250) + [AAE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ae_finished, ae_reset), + [OAA] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, aa_finished, aa_reset) }; // clang-format on diff --git a/users/mtdjr/mtdjr.c b/users/mtdjr/mtdjr.c index 9c6c26bc86..cd67bf3b5f 100644 --- a/users/mtdjr/mtdjr.c +++ b/users/mtdjr/mtdjr.c @@ -137,7 +137,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { }; layer_state_t layer_state_set_user(layer_state_t state) { - switch (biton32(state)) { + switch (get_highest_layer(state)) { case _RAISE: #ifdef RGBLIGHT_ENABLE rgblight_sethsv_noeeprom (240, 255, 255); diff --git a/users/ninjonas/config.h b/users/ninjonas/config.h index 025dbb541a..565e40e841 100644 --- a/users/ninjonas/config.h +++ b/users/ninjonas/config.h @@ -2,6 +2,7 @@ #undef TAPPING_TERM #define TAPPING_TERM 200 #endif +#define TAPPING_TERM_PER_KEY // Mouse Settings: Smoothing out mouse movement on keypress #ifndef MOUSEKEY_INTERVAL @@ -18,4 +19,4 @@ #undef COMBO_TERM #define COMBO_COUNT 5 #define COMBO_TERM 60 -#endif
\ No newline at end of file +#endif diff --git a/users/ninjonas/oled.c b/users/ninjonas/oled.c index 55eaf88ccb..73cd50fb8c 100644 --- a/users/ninjonas/oled.c +++ b/users/ninjonas/oled.c @@ -23,7 +23,7 @@ bool process_record_oled(uint16_t keycode, keyrecord_t *record) { void render_layout_state(void) { oled_write_P(PSTR("Layout: "), false); - switch (biton32(default_layer_state)) { + switch (get_highest_layer(default_layer_state)) { case _COLEMAK: oled_write_P(PSTR("Colemak"), false); break; @@ -93,7 +93,7 @@ static void render_logo(void) { bool oled_task_user(void) { if (timer_elapsed32(oled_timer) > 15000) { oled_off(); - return; + return false; } #ifndef SPLIT_KEYBOARD else { oled_on(); } diff --git a/users/ninjonas/tap_dances.c b/users/ninjonas/tap_dances.c index 63e4d3ba47..3e4cec9133 100644 --- a/users/ninjonas/tap_dances.c +++ b/users/ninjonas/tap_dances.c @@ -107,6 +107,16 @@ qk_tap_dance_action_t tap_dance_actions[] = { [TD_GUI_GUISPC] = ACTION_TAP_DANCE_DOUBLE(KC_LGUI, LGUI(KC_SPC)), // Advanced Tap Dances - [TD_COPY_PASTE_APP] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, copy_paste_app_finished, copy_paste_app_reset, 300), - [TD_Y_NUMPAD] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, y_numpad_finished, y_numpad_reset, 300), -};
\ No newline at end of file + [TD_COPY_PASTE_APP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, copy_paste_app_finished, copy_paste_app_reset), + [TD_Y_NUMPAD] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, y_numpad_finished, y_numpad_reset), +}; + +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case TD(TD_COPY_PASTE_APP): + case TD(TD_Y_NUMPAD): + return 300; + default: + return TAPPING_TERM; + } +} diff --git a/users/pvinis/pvinis.c b/users/pvinis/pvinis.c index 71f9210aec..96b01bb461 100644 --- a/users/pvinis/pvinis.c +++ b/users/pvinis/pvinis.c @@ -95,4 +95,4 @@ void keyboard_post_init_user(void) { // Default functions. __attribute__((weak)) void keyboard_post_init_user_keymap(void) {} -__attribute__((weak)) uint32_t layer_state_set_user_keymap(uint32_t state) { return state; } +__attribute__((weak)) layer_state_t layer_state_set_user_keymap(layer_state_t state) { return state; } diff --git a/users/pvinis/pvinis.h b/users/pvinis/pvinis.h index c50033a440..5a11a6cb6f 100644 --- a/users/pvinis/pvinis.h +++ b/users/pvinis/pvinis.h @@ -169,4 +169,4 @@ enum { // Extra stuff that might be needed. void keyboard_post_init_user_keymap(void); -uint32_t layer_state_set_user_keymap(uint32_t state); +layer_state_t layer_state_set_user_keymap(layer_state_t state); diff --git a/users/romus/romus.c b/users/romus/romus.c index f707bb8843..a41a6df578 100644 --- a/users/romus/romus.c +++ b/users/romus/romus.c @@ -59,7 +59,7 @@ __attribute__ ((weak)) void matrix_scan_keymap(void) { } __attribute__ ((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } -__attribute__ ((weak)) uint32_t layer_state_set_keymap (uint32_t state) { +__attribute__ ((weak)) layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } __attribute__ ((weak)) void led_set_keymap(uint8_t usb_led) { } @@ -551,7 +551,7 @@ layer_state_t layer_state_set_user(layer_state_t state) { state = layer_state_set_keymap (state); #ifdef RGBLIGHT_ENABLE // Change RGB lighting depending on the last layer activated - rgblight_change( biton32(state) ); + rgblight_change( get_highest_layer(state) ); #endif return state; } diff --git a/users/sigma/sigma.c b/users/sigma/sigma.c index 527925a63f..8470060a53 100644 --- a/users/sigma/sigma.c +++ b/users/sigma/sigma.c @@ -49,12 +49,12 @@ bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { __attribute__ ((weak)) -uint32_t layer_state_set_keymap (uint32_t state) { +layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } __attribute__ ((weak)) -uint32_t default_layer_state_set_keymap (uint32_t state) { +layer_state_t default_layer_state_set_keymap (layer_state_t state) { return state; } diff --git a/users/spidey3/config.h b/users/spidey3/config.h index f5f5e07f0f..49409ed85d 100644 --- a/users/spidey3/config.h +++ b/users/spidey3/config.h @@ -1,22 +1,41 @@ +// Copyright 2022 Joshua Diamond josh@windowoffire.com (@spidey3) +// SPDX-License-Identifier: GPL-2.0-or-later + #pragma once #define LED_DISABLE_WHEN_USB_SUSPENDED #define RGB_DISABLE_WHEN_USB_SUSPENDED -#define RGBLIGHT_LAYERS -#define RGBLIGHT_MAX_LAYERS 17 -#define RGBLIGHT_LAYER_BLINK -#define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF -#define RGBLIGHT_STARTUP_ANIMATION - -#undef RGBLIGHT_ANIMATIONS -#define RGBLIGHT_EFFECT_BREATHING -#define RGBLIGHT_EFFECT_RAINBOW_MOOD -#define RGBLIGHT_EFFECT_RAINBOW_SWIRL -#define RGBLIGHT_EFFECT_SNAKE -#define RGBLIGHT_EFFECT_KNIGHT -#define RGBLIGHT_EFFECT_STATIC_GRADIENT -#define RGBLIGHT_EFFECT_ALTERNATING -#define RGBLIGHT_EFFECT_TWINKLE + +#ifdef RGBLIGHT_ENABLE + +# define RGBLIGHT_LAYERS +# define RGBLIGHT_MAX_LAYERS 17 +# define RGBLIGHT_LAYER_BLINK +# define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF +# define RGBLIGHT_STARTUP_ANIMATION + +# undef RGBLIGHT_ANIMATIONS +# define RGBLIGHT_EFFECT_BREATHING +# define RGBLIGHT_EFFECT_RAINBOW_MOOD +# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +# define RGBLIGHT_EFFECT_SNAKE +# define RGBLIGHT_EFFECT_KNIGHT +# define RGBLIGHT_EFFECT_STATIC_GRADIENT +# define RGBLIGHT_EFFECT_TWINKLE + +# define RGBLIGHT_DEFAULT_HUE 213 +# define RGBLIGHT_DEFAULT_SAT UINT8_MAX +# define RGBLIGHT_DEFAULT_VAL RGBLIGHT_LIMIT_VAL / 2 + +# if defined(RGBLIGHT_EFFECT_TWINKLE) +# define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_TWINKLE +# elif defined(RGBLIGHT_EFFECT_RAINBOW_MOOD) +# define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_RAINBOW_MOOD +# else +# define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_LIGHT +# endif + +#endif #define UNICODE_SELECTED_MODES UC_MAC, UC_LNX, UC_WINC @@ -24,3 +43,9 @@ #undef MANUFACTURER #define MANUFACTURER Window of Fire + +// Some keyboards enable BACKLIGHT_CAPS_LOCK without checking if backlight is enabled. +// Undef as appropriate to avoid compiler warnings in that case. +#ifndef BACKLIGHT_ENABLE +#undef BACKLIGHT_CAPS_LOCK +#endif diff --git a/users/spidey3/init.c b/users/spidey3/init.c index 8db41a5f4c..bd6ea5cac9 100644 --- a/users/spidey3/init.c +++ b/users/spidey3/init.c @@ -1,3 +1,6 @@ +// Copyright 2022 Joshua Diamond josh@windowoffire.com (@spidey3) +// SPDX-License-Identifier: GPL-2.0-or-later + #include "spidey3.h" void keyboard_post_init_user(void) { @@ -7,15 +10,10 @@ void keyboard_post_init_user(void) { } void eeconfig_init_user(void) { - print("eeconfig_init_user\n"); set_single_persistent_default_layer(_BASE); #ifdef UNICODEMAP_ENABLE eeconfig_init_user_unicode(); #endif - -#ifdef RGBLIGHT_ENABLE - eeconfig_init_user_rgb(); -#endif } #ifdef RGBLIGHT_ENABLE diff --git a/users/spidey3/layer_rgb.c b/users/spidey3/layer_rgb.c index 37e59579cf..671205362f 100644 --- a/users/spidey3/layer_rgb.c +++ b/users/spidey3/layer_rgb.c @@ -1,3 +1,6 @@ +// Copyright 2022 Joshua Diamond josh@windowoffire.com (@spidey3) +// SPDX-License-Identifier: GPL-2.0-or-later + #include QMK_KEYBOARD_H #include "spidey3.h" @@ -13,21 +16,15 @@ bool rgb_saved = 0; extern bool spi_gflock; extern uint16_t spi_replace_mode; -void spidey_glow(void) { +static void set_rgb_default(void) { rgblight_enable(); - rgblight_sethsv(213, 255, 128); - if ((RGBLIGHT_MODE_TWINKLE <= rgblight_get_mode()) && (rgblight_get_mode() < RGBLIGHT_MODE_TWINKLE_end)) { - rgblight_step(); - } else { - rgblight_mode(RGBLIGHT_MODE_TWINKLE); - } + rgblight_sethsv(RGBLIGHT_DEFAULT_HUE, RGBLIGHT_DEFAULT_SAT, RGBLIGHT_DEFAULT_VAL); + rgblight_mode(RGBLIGHT_DEFAULT_MODE); #ifdef VELOCIKEY_ENABLE if (velocikey_enabled()) velocikey_toggle(); #endif } -void eeconfig_init_user_rgb(void) { spidey_glow(); } - // clang-format off // Convenience macros @@ -101,7 +98,6 @@ const rgblight_segment_t *const PROGMEM _rgb_layers[] = { const uint8_t PROGMEM _n_rgb_layers = sizeof(_rgb_layers) / sizeof(_rgb_layers[0]) - 1; void clear_rgb_layers() { - dprint("clear_rgb_layers()\n"); for (uint8_t i = 0; i < _n_rgb_layers; i++) { rgblight_set_layer_state(i, false); } @@ -110,7 +106,6 @@ void clear_rgb_layers() { void do_rgb_layers(layer_state_t state, uint8_t start, uint8_t end) { for (uint8_t i = start; i < end; i++) { bool is_on = layer_state_cmp(state, i); - dprintf("layer[%u]=rl[%u]=%u\n", i, LAYER_OFFSET + i, is_on); rgblight_set_layer_state(LAYER_OFFSET + i, is_on); } } @@ -119,7 +114,6 @@ void do_rgb_unicode(void) { uint8_t uc_mode = get_unicode_input_mode(); for (uint8_t i = 0; i < UC__COUNT; i++) { bool is_on = i == uc_mode; - dprintf("unicode[%u]=rl[%u]=%u\n", i, UNICODE_OFFSET + i, is_on); rgblight_set_layer_state(UNICODE_OFFSET + i, is_on); } } @@ -138,7 +132,7 @@ int8_t change_sat = 0; int8_t change_val = 0; // timer to control color change speed -uint16_t change_timer = 0; +uint16_t change_timer = 0; const uint16_t change_tick = 15; extern rgblight_config_t rgblight_config; @@ -146,14 +140,15 @@ extern rgblight_status_t rgblight_status; #if defined(RGBLIGHT_STARTUP_ANIMATION) -#define STARTUP_ANIMATION_SATURATION 200 -#define STARTUP_ANIMATION_VALUE 255 -#define STARTUP_ANIMATION_FADE_STEP 5 -#define STARTUP_ANIMATION_CYCLE_STEP 2 -#define STARTUP_ANIMATION_RAMP_TO_STEPS 70 -#define STARTUP_ANIMATION_STEP_TIME 10 -#define STARTUP_ANIMATION_INITIAL_DELAY 0 // milliseconds, must be < 255 * STEP_TIME +# define STARTUP_ANIMATION_SATURATION 200 +# define STARTUP_ANIMATION_VALUE 255 +# define STARTUP_ANIMATION_FADE_STEP 5 +# define STARTUP_ANIMATION_CYCLE_STEP 2 +# define STARTUP_ANIMATION_RAMP_TO_STEPS 70 +# define STARTUP_ANIMATION_STEP_TIME 10 +# define STARTUP_ANIMATION_INITIAL_DELAY 0 // milliseconds, must be < 255 * STEP_TIME +// clang-format off typedef enum { DISABLED, WAITING, @@ -167,18 +162,18 @@ typedef enum { CLEAN_UP, DONE } startup_animation_state_t; +// clang-format on -static rgblight_config_t old_config; -static uint8_t old_base_mode; +static rgblight_config_t old_config; +static uint8_t old_base_mode; static startup_animation_state_t startup_animation_state = DISABLED; -static uint16_t rgblight_startup_loop_timer; +static uint16_t rgblight_startup_loop_timer; void startup_animation_init(void) { old_config.raw = rgblight_config.raw; old_base_mode = rgblight_status.base_mode; - if (!old_config.enable) - rgblight_enable_noeeprom(); + if (!old_config.enable) rgblight_enable_noeeprom(); } #endif @@ -202,9 +197,9 @@ void matrix_scan_user_rgb(void) { switch (startup_animation_state) { case WAITING: -#ifdef STARTUP_ANIMATION_DEBUG +# ifdef STARTUP_ANIMATION_DEBUG dprintf("sua WAITING counter=%u\n", counter); -#endif +# endif if (counter < STARTUP_ANIMATION_INITIAL_DELAY / STARTUP_ANIMATION_STEP_TIME) { counter++; } else { @@ -213,83 +208,87 @@ void matrix_scan_user_rgb(void) { break; case RESTART: +# ifdef STARTUP_ANIMATION_DEBUG dprintln("sua RESTART"); +# endif startup_animation_init(); case START: +# ifdef STARTUP_ANIMATION_DEBUG dprintln("sua START"); +# endif startup_animation_state = FADE_OLD; - counter = old_config.val; + counter = old_config.val; // No break! Just roll into FADE_OLD in the same iteration... case FADE_OLD: -#ifdef STARTUP_ANIMATION_DEBUG +# ifdef STARTUP_ANIMATION_DEBUG dprintf("sua FADE_OLD counter=%u\n", counter); -#endif +# endif if (counter >= STARTUP_ANIMATION_FADE_STEP) { rgblight_sethsv_noeeprom(old_config.hue, old_config.sat, counter); counter -= STARTUP_ANIMATION_FADE_STEP; } else { - counter = 0; + counter = 0; startup_animation_state = FADE_IN; rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); } break; case FADE_IN: -#ifdef STARTUP_ANIMATION_DEBUG +# ifdef STARTUP_ANIMATION_DEBUG dprintf("sua FADE_IN counter=%u\n", counter); -#endif +# endif if (counter < STARTUP_ANIMATION_VALUE) { rgblight_sethsv_noeeprom(old_config.hue, STARTUP_ANIMATION_SATURATION, counter); counter += STARTUP_ANIMATION_FADE_STEP; } else { - counter = 255; + counter = 255; startup_animation_state = CYCLE; } break; case CYCLE: -#ifdef STARTUP_ANIMATION_DEBUG +# ifdef STARTUP_ANIMATION_DEBUG dprintf("sua CYCLE counter=%u\n", counter); -#endif +# endif if (counter >= STARTUP_ANIMATION_CYCLE_STEP) { rgblight_sethsv_noeeprom((counter + old_config.hue) % 255, STARTUP_ANIMATION_SATURATION, STARTUP_ANIMATION_VALUE); counter -= STARTUP_ANIMATION_CYCLE_STEP; } else { if ( -#ifdef RGBLIGHT_EFFECT_BREATHING +# ifdef RGBLIGHT_EFFECT_BREATHING (old_base_mode == RGBLIGHT_MODE_BREATHING) || -#endif -#ifdef RGBLIGHT_EFFECT_SNAKE +# endif +# ifdef RGBLIGHT_EFFECT_SNAKE (old_base_mode == RGBLIGHT_MODE_SNAKE) || -#endif -#ifdef RGBLIGHT_EFFECT_KNIGHT +# endif +# ifdef RGBLIGHT_EFFECT_KNIGHT (old_base_mode == RGBLIGHT_MODE_KNIGHT) || -#endif -#ifdef RGBLIGHT_EFFECT_TWINKLE +# endif +# ifdef RGBLIGHT_EFFECT_TWINKLE (old_base_mode == RGBLIGHT_MODE_TWINKLE) || -#endif +# endif !old_config.enable) { - counter = STARTUP_ANIMATION_VALUE; + counter = STARTUP_ANIMATION_VALUE; startup_animation_state = RAMP_DOWN; } else if ( -#ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT +# ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT (old_base_mode == RGBLIGHT_MODE_STATIC_GRADIENT) || -#endif -#ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD +# endif +# ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD (old_base_mode == RGBLIGHT_MODE_RAINBOW_MOOD) || -#endif -#ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL +# endif +# ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL (old_base_mode == RGBLIGHT_MODE_RAINBOW_SWIRL) || -#endif -#ifdef RGBLIGHT_EFFECT_RAINBOW_CHRISTMAS +# endif +# ifdef RGBLIGHT_EFFECT_RAINBOW_CHRISTMAS (old_base_mode == RGBLIGHT_MODE_CHRISTMAS) || -#endif -#ifdef RGBLIGHT_EFFECT_RAINBOW_RGB_TEST_ +# endif +# ifdef RGBLIGHT_EFFECT_RAINBOW_RGB_TEST (old_base_mode == RGBLIGHT_MODE_RGB_TEST) || -#endif +# endif (old_base_mode == RGBLIGHT_MODE_STATIC_LIGHT)) { - counter = 0; + counter = 0; startup_animation_state = RAMP_TO; } else { startup_animation_state = CLEAN_UP; @@ -298,9 +297,9 @@ void matrix_scan_user_rgb(void) { break; case RAMP_DOWN: -#ifdef STARTUP_ANIMATION_DEBUG +# ifdef STARTUP_ANIMATION_DEBUG dprintf("sua RAMP_DOWN counter=%u\n", counter); -#endif +# endif if (counter >= STARTUP_ANIMATION_FADE_STEP) { rgblight_sethsv_noeeprom(old_config.hue, STARTUP_ANIMATION_SATURATION, counter); counter -= STARTUP_ANIMATION_FADE_STEP; @@ -309,28 +308,30 @@ void matrix_scan_user_rgb(void) { } break; - case RAMP_TO: - { -#ifdef STARTUP_ANIMATION_DEBUG - dprintf("sua RAMP_TO s=%u, v=%u, counter=%u\n", old_config.sat, old_config.val, counter); -#endif - uint8_t steps = STARTUP_ANIMATION_RAMP_TO_STEPS; - if (counter < steps) { - uint8_t s = STARTUP_ANIMATION_SATURATION + counter * (((float)old_config.sat - STARTUP_ANIMATION_SATURATION) / (float)steps); - uint8_t v = STARTUP_ANIMATION_VALUE + counter * (((float)old_config.val - STARTUP_ANIMATION_VALUE) / (float)steps); - rgblight_sethsv_noeeprom(old_config.hue, s, v); - counter++; - } else { - startup_animation_state = CLEAN_UP; - } + case RAMP_TO: { +# ifdef STARTUP_ANIMATION_DEBUG + dprintf("sua RAMP_TO s=%u, v=%u, counter=%u\n", old_config.sat, old_config.val, counter); +# endif + uint8_t steps = STARTUP_ANIMATION_RAMP_TO_STEPS; + if (counter < steps) { + uint8_t s = STARTUP_ANIMATION_SATURATION + counter * (((float)old_config.sat - STARTUP_ANIMATION_SATURATION) / (float)steps); + uint8_t v = STARTUP_ANIMATION_VALUE + counter * (((float)old_config.val - STARTUP_ANIMATION_VALUE) / (float)steps); + rgblight_sethsv_noeeprom(old_config.hue, s, v); + counter++; + } else { + startup_animation_state = CLEAN_UP; } - break; + } break; case CLEAN_UP: +# ifdef STARTUP_ANIMATION_DEBUG dprintln("sua CLEAN_UP"); +# endif rgblight_reload_from_eeprom(); startup_animation_state = DONE; +# ifdef STARTUP_ANIMATION_DEBUG dprintln("sua DONE"); +# endif break; default: @@ -344,8 +345,8 @@ void matrix_scan_user_rgb(void) { if (timer_elapsed(change_timer) > change_tick) { HSV hsv = rgblight_get_hsv(); hsv.h += change_hue; - hsv.s = change_sat > 0 ? qadd8(hsv.s, (uint8_t) change_sat) : qsub8(hsv.s, (uint8_t) -change_sat); - hsv.v = change_val > 0 ? qadd8(hsv.v, (uint8_t) change_val) : qsub8(hsv.v, (uint8_t) -change_val); + hsv.s = change_sat > 0 ? qadd8(hsv.s, (uint8_t)change_sat) : qsub8(hsv.s, (uint8_t)-change_sat); + hsv.v = change_val > 0 ? qadd8(hsv.v, (uint8_t)change_val) : qsub8(hsv.v, (uint8_t)-change_val); rgblight_sethsv_noeeprom(hsv.h, hsv.s, hsv.v); change_timer = timer_read(); } @@ -372,8 +373,6 @@ layer_state_t layer_state_set_user_rgb(layer_state_t state) { } bool led_update_user_rgb(led_t led_state) { - dprintf("num=%u, cap=%u, scl=%u, cmp=%u, kan=%u\n", led_state.num_lock, led_state.caps_lock, led_state.scroll_lock, led_state.compose, led_state.kana); - rgblight_set_layer_state(LOCK_OFFSET + USB_LED_NUM_LOCK, led_state.num_lock); rgblight_set_layer_state(LOCK_OFFSET + USB_LED_CAPS_LOCK, led_state.caps_lock); rgblight_set_layer_state(LOCK_OFFSET + USB_LED_SCROLL_LOCK, led_state.scroll_lock); @@ -385,7 +384,6 @@ void rgb_layer_ack_yn(bool yn) { rgb_layer_ack(yn ? ACK_YES : ACK_NO); } void rgb_layer_ack(layer_ack_t n) { uint8_t layer = ACK_OFFSET + n; - dprintf("rgb_layer_ack(%u) ==> %u\n", n, layer); rgblight_blink_layer(layer, RGB_LAYER_ACK_DURATION); } @@ -395,11 +393,9 @@ extern rgblight_config_t rgblight_config; bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { switch (keycode) { - case SPI_GLO: - spidey_glow(); - return false; - // clang-format off + case SPI_GLO: set_rgb_default(); return false; + case RGB_HUI: change_timer = timer_read(); change_hue = 1; return false; case RGB_HUD: change_timer = timer_read(); change_hue = -1; return false; case RGB_SAI: change_timer = timer_read(); change_sat = 1; return false; diff --git a/users/spidey3/spidey3.c b/users/spidey3/spidey3.c index df73c903d0..e993f4828e 100644 --- a/users/spidey3/spidey3.c +++ b/users/spidey3/spidey3.c @@ -1,3 +1,6 @@ +// Copyright 2022 Joshua Diamond josh@windowoffire.com (@spidey3) +// SPDX-License-Identifier: GPL-2.0-or-later + #include QMK_KEYBOARD_H #include "spidey3.h" @@ -18,7 +21,7 @@ static uint32_t matrix_timer = 0; # endif void report_version(void) { - uprintln(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE); + uprintln(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION " - " QMK_BUILDDATE); reported_version = true; } #endif @@ -51,8 +54,41 @@ void matrix_scan_user(void) { #endif } -bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, uint32_t baseAlphaLower, uint32_t baseAlphaUpper, uint32_t zeroGlyph, uint32_t baseNumberOne, uint32_t spaceGlyph, uint8_t temp_mod, uint8_t temp_osm) { +static uint32_t math_glyph_exceptions(const uint16_t keycode, const bool shifted) { + if (shifted) { + switch (keycode) { + // clang-format off + case KC_C: return 0x2102; + case KC_H: return 0x210D; + case KC_N: return 0x2115; + case KC_P: return 0x2119; + case KC_Q: return 0x211A; + case KC_R: return 0x211D; + case KC_Z: return 0x2124; + // clang-format on + } + } + return 0; +} + +bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, uint32_t baseAlphaLower, uint32_t baseAlphaUpper, uint32_t zeroGlyph, uint32_t baseNumberOne, uint32_t spaceGlyph, uint32_t (*exceptions)(const uint16_t keycode, const bool shifted), uint8_t temp_mod, uint8_t temp_osm) { + void _register(uint32_t codepoint) { + unicode_input_start(); + register_hex32(codepoint); + unicode_input_finish(); + } + if ((((temp_mod | temp_osm) & (MOD_MASK_CTRL | MOD_MASK_ALT | MOD_MASK_GUI))) == 0) { + bool shifted = ((temp_mod | temp_osm) & MOD_MASK_SHIFT); + if (exceptions) { + uint32_t res = exceptions(keycode, shifted); + if (res) { + if (record->event.pressed) { + _register(res); + } + return false; + } + } switch (keycode) { case KC_A ... KC_Z: if (record->event.pressed) { @@ -61,39 +97,30 @@ bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, uin clear_oneshot_mods(); #endif - unicode_input_start(); - uint32_t base = ((temp_mod | temp_osm) & MOD_MASK_SHIFT) ? baseAlphaUpper : baseAlphaLower; - register_hex32(base + (keycode - KC_A)); - unicode_input_finish(); - + uint32_t base = shifted ? baseAlphaUpper : baseAlphaLower; + _register(base + (keycode - KC_A)); set_mods(temp_mod); } return false; case KC_0: - if ((temp_mod | temp_osm) & MOD_MASK_SHIFT) { // skip shifted numbers, so that we can still use symbols etc. + if (shifted) { // skip shifted numbers, so that we can still use symbols etc. return true; } if (record->event.pressed) { - unicode_input_start(); - register_hex32(zeroGlyph); - unicode_input_finish(); + _register(zeroGlyph); } return false; case KC_1 ... KC_9: - if ((temp_mod | temp_osm) & MOD_MASK_SHIFT) { // skip shifted numbers, so that we can still use symbols etc. + if (shifted) { // skip shifted numbers, so that we can still use symbols etc. return true; } if (record->event.pressed) { - unicode_input_start(); - register_hex32(baseNumberOne + (keycode - KC_1)); - unicode_input_finish(); + _register(baseNumberOne + (keycode - KC_1)); } return false; case KC_SPACE: if (record->event.pressed) { - unicode_input_start(); - register_hex32(spaceGlyph); // em space - unicode_input_finish(); + _register(spaceGlyph); // em space } return false; } @@ -163,7 +190,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { debug_keyboard = 0; debug_matrix = 0; } - uprintf("DEBUG: enable=%u, keyboard=%u, matrix=%u\n", debug_enable, debug_keyboard, debug_matrix); + uprintf("DEBUG: enable=%u, kb=%u, matrix=%u\n", debug_enable, debug_keyboard, debug_matrix); eeconfig_update_debug(debug_config.raw); return false; #endif @@ -181,14 +208,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #endif // clang-format on - case SPI_NORMAL ... SPI_FRAKTR: + case SPI_NORMAL ... SPI_MATH: spi_replace_mode = (spi_replace_mode == keycode) ? SPI_NORMAL : keycode; - dprintf("spi_replace_mode = %u\n", spi_replace_mode); break; case SPI_GFLOCK: spi_gflock = !spi_gflock; - dprintf("spi_gflock = %u\n", spi_gflock); break; case SPI_KP_00: @@ -279,19 +304,23 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case KC_SPACE: switch (spi_replace_mode) { case SPI_WIDE: - return process_record_glyph_replacement(keycode, record, 0xFF41, 0xFF21, 0xFF10, 0xFF11, 0x2003, mods, osm); + return process_record_glyph_replacement(keycode, record, 0xFF41, 0xFF21, 0xFF10, 0xFF11, 0x2003, NULL, mods, osm); case SPI_SCRIPT: - return process_record_glyph_replacement(keycode, record, 0x1D4EA, 0x1D4D0, 0x1D7CE, 0x1D7CF, 0x2002, mods, osm); + return process_record_glyph_replacement(keycode, record, 0x1D4EA, 0x1D4D0, 0x1D7CE, 0x1D7CF, 0x2002, NULL, mods, osm); case SPI_BLOCKS: - return process_record_glyph_replacement(keycode, record, 0x1F170, 0x1F170, '0', '1', 0x2002, mods, osm); + return process_record_glyph_replacement(keycode, record, 0x1F170, 0x1F170, '0', '1', 0x2002, NULL, mods, osm); case SPI_CIRCLE: - return process_record_glyph_replacement(keycode, record, 0x1F150, 0x1F150, '0', '1', 0x2002, mods, osm); + return process_record_glyph_replacement(keycode, record, 0x1F150, 0x1F150, '0', '1', 0x2002, NULL, mods, osm); case SPI_SQUARE: - return process_record_glyph_replacement(keycode, record, 0x1F130, 0x1F130, '0', '1', 0x2002, mods, osm); + return process_record_glyph_replacement(keycode, record, 0x1F130, 0x1F130, '0', '1', 0x2002, NULL, mods, osm); case SPI_PARENS: - return process_record_glyph_replacement(keycode, record, 0x1F110, 0x1F110, '0', '1', 0x2002, mods, osm); + return process_record_glyph_replacement(keycode, record, 0x1F110, 0x1F110, '0', '1', 0x2002, NULL, mods, osm); case SPI_FRAKTR: - return process_record_glyph_replacement(keycode, record, 0x1D586, 0x1D56C, '0', '1', 0x2002, mods, osm); + return process_record_glyph_replacement(keycode, record, 0x1D586, 0x1D56C, '0', '1', 0x2002, NULL, mods, osm); + case SPI_BOLD: + return process_record_glyph_replacement(keycode, record, 0x1D41A, 0x1D400, '0', '1', 0x2002, NULL, mods, osm); + case SPI_MATH: + return process_record_glyph_replacement(keycode, record, 0x1D552, 0x1D538, '0', '1', 0x2002, &math_glyph_exceptions, mods, osm); } break; @@ -304,9 +333,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { if ((mods | osm) & MOD_MASK_SHIFT) { del_mods(MOD_MASK_SHIFT); -#ifndef NO_ACTION_ONESHOT +# ifndef NO_ACTION_ONESHOT clear_oneshot_mods(); -#endif +# endif register_code(KC_DEL); delkey_registered = true; set_mods(mods); diff --git a/users/spidey3/spidey3.h b/users/spidey3/spidey3.h index d018e5defb..e96ab7a145 100644 --- a/users/spidey3/spidey3.h +++ b/users/spidey3/spidey3.h @@ -1,3 +1,6 @@ +// Copyright 2022 Joshua Diamond josh@windowoffire.com (@spidey3) +// SPDX-License-Identifier: GPL-2.0-or-later + #pragma once #include QMK_KEYBOARD_H @@ -10,16 +13,16 @@ enum userspace_layers { _BASE = 0, _NUMPAD, _FN, + _GLYPH, }; enum custom_keycodes { - SPI_GLO = SAFE_RANGE, - SPI_LNX, // Mode: Linux - SPI_OSX, // Mode: Mac - SPI_WIN, // Mode: Windows - CH_CPNL, // AL Control Panel - CH_ASST, // AL Context-aware Desktop Assistant - CH_SUSP, // Suspend + SPI_LNX = SAFE_RANGE, // Mode: Linux + SPI_OSX, // Mode: Mac + SPI_WIN, // Mode: Windows + CH_CPNL, // AL Control Panel + CH_ASST, // AL Context-aware Desktop Assistant + CH_SUSP, // Suspend SPI_NORMAL, SPI_WIDE, @@ -29,8 +32,11 @@ enum custom_keycodes { SPI_SQUARE, SPI_PARENS, SPI_FRAKTR, + SPI_BOLD, + SPI_MATH, SPI_GFLOCK, SPI_KP_00, + SPI_GLO, }; #ifdef RGBLIGHT_ENABLE @@ -50,7 +56,6 @@ typedef enum layer_ack { # define RGB_LAYER_ACK_DURATION 500 -void eeconfig_init_user_rgb(void); void matrix_init_user_rgb(void); void matrix_scan_user_rgb(void); void keyboard_post_init_user_rgb(void); diff --git a/users/spidey3/unicode.c b/users/spidey3/unicode.c index 39a990674c..5292b0809b 100644 --- a/users/spidey3/unicode.c +++ b/users/spidey3/unicode.c @@ -1,3 +1,6 @@ +// Copyright 2022 Joshua Diamond josh@windowoffire.com (@spidey3) +// SPDX-License-Identifier: GPL-2.0-or-later + #include "unicode.h" diff --git a/users/spidey3/unicode.h b/users/spidey3/unicode.h index 6182669fb0..ee8e00056c 100644 --- a/users/spidey3/unicode.h +++ b/users/spidey3/unicode.h @@ -1,3 +1,6 @@ +// Copyright 2022 Joshua Diamond josh@windowoffire.com (@spidey3) +// SPDX-License-Identifier: GPL-2.0-or-later + #pragma once #include QMK_KEYBOARD_H diff --git a/users/stanrc85/layer_rgb.c b/users/stanrc85/layer_rgb.c index 6d57198f3b..ad30c2ee65 100644 --- a/users/stanrc85/layer_rgb.c +++ b/users/stanrc85/layer_rgb.c @@ -5,7 +5,7 @@ void matrix_init_user(void) { }; layer_state_t layer_state_set_user(layer_state_t state) { - switch (biton32(state)) { + switch (get_highest_layer(state)) { case 0: rgblight_setrgb (0xFF, 0x00, 0x00); break; diff --git a/users/talljoe/config.h b/users/talljoe/config.h index 8a5fd50cb7..dcdbbd89f4 100644 --- a/users/talljoe/config.h +++ b/users/talljoe/config.h @@ -19,9 +19,5 @@ #define RESET_LAYER 15 -#define BOOTMAGIC_KEY_SALT KC_ESC -#define BOOTMAGIC_KEY_SKIP KC_I -#define BOOTMAGIC_KEY_EEPROM_CLEAR KC_E - #define COMBO_COUNT 2 #define COMBO_TERM 250 diff --git a/users/talljoe/talljoe.c b/users/talljoe/talljoe.c index 517f712ec8..6655170d4a 100644 --- a/users/talljoe/talljoe.c +++ b/users/talljoe/talljoe.c @@ -138,7 +138,7 @@ void matrix_init_user(void) { } } -uint32_t default_layer_state_set_kb(uint32_t state) { +layer_state_t default_layer_state_set_kb(layer_state_t state) { // persist changes to default layers eeconfig_update_default_layer(state); return state; diff --git a/users/tominabox1/config.h b/users/tominabox1/config.h index 4a2433eb0b..f853e18605 100644 --- a/users/tominabox1/config.h +++ b/users/tominabox1/config.h @@ -3,8 +3,6 @@ // Tapping term settings #define TAPPING_TERM_PER_KEY #define TAP_HOLD_CAPS_DELAY 350 -#define BOOTMAGIC_KEY_SALT KC_BSPACE -#define BOOTMAGIC_KEY_EEPROM_CLEAR KC_Q // OLED settings #define OLED_FONT_H "users/tominabox1/doug.c" diff --git a/users/tominabox1/tominabox1.c b/users/tominabox1/tominabox1.c index 7322ead0dc..b4ec224d07 100644 --- a/users/tominabox1/tominabox1.c +++ b/users/tominabox1/tominabox1.c @@ -128,7 +128,7 @@ layer_state_t layer_state_set_keymap (layer_state_t state) { layer_state_t layer_state_set_user(layer_state_t state) { state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); - switch (biton32(state)) { + switch (get_highest_layer(state)) { case _LOWER: break; case _RAISE: @@ -231,7 +231,7 @@ void render_status_main(void) { // Host Keyboard Layer Status oled_write_P(PSTR("Layer: "), false); - switch (biton32(layer_state)) { + switch (get_highest_layer(layer_state)) { case _BASE: oled_write_P(PSTR("Colemak\n"), false); break; diff --git a/users/turbomech/backupturbomech.c b/users/turbomech/backupturbomech.c index aaea05df96..3671d27ab4 100644 --- a/users/turbomech/backupturbomech.c +++ b/users/turbomech/backupturbomech.c @@ -31,7 +31,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } __attribute__ ((weak)) -uint32_t layer_state_set_keymap (uint32_t state) { +layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } __attribute__ ((weak)) @@ -300,7 +300,7 @@ layer_state_t layer_state_set_user(layer_state_t state) { #ifdef RGBLIGHT_ENABLE uint8_t default_layer = eeconfig_read_default_layer(); if (rgb_layer_change) { - switch (biton32(state)) { + switch (get_highest_layer(state)) { case _FUNCTION: rgblight_set_blue; rgblight_mode(1); @@ -377,7 +377,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } __attribute__ ((weak)) -uint32_t layer_state_set_keymap (uint32_t state) { +layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } __attribute__ ((weak)) diff --git a/users/xulkal/custom_oled.c b/users/xulkal/custom_oled.c index 7fe8040927..fd03033ad6 100644 --- a/users/xulkal/custom_oled.c +++ b/users/xulkal/custom_oled.c @@ -37,7 +37,7 @@ static void render_icon(void) static void render_layer(void) { - uint8_t layer = layer_state ? biton(layer_state) : biton32(default_layer_state); + uint8_t layer = layer_state ? get_highest_layer(layer_state) : get_highest_layer(default_layer_state); #ifdef OLED_90ROTATION oled_write_P(PSTR("Layer"), false); #else diff --git a/users/yet-another-developer/config.h b/users/yet-another-developer/config.h index d46d487fe3..6d1bf83f0b 100644 --- a/users/yet-another-developer/config.h +++ b/users/yet-another-developer/config.h @@ -11,10 +11,6 @@ #define ONESHOT_TIMEOUT 2000 #endif // !ONESHOT_TIMEOUT -#ifndef QMK_KEYS_PER_SCAN - #define QMK_KEYS_PER_SCAN 4 -#endif // !QMK_KEYS_PER_SCAN - #if defined(LEADER_ENABLE) #define LEADER_PER_KEY_TIMING #define LEADER_TIMEOUT 250 diff --git a/users/zer09/config.h b/users/zer09/config.h index c5ab32f8d4..0324aaa7d3 100644 --- a/users/zer09/config.h +++ b/users/zer09/config.h @@ -1,10 +1,6 @@ #ifndef USERSPACE_CONFIG_H #define USERSPACE_CONFIG_H -#ifndef QMK_KEYS_PER_SCAN -#define QMK_KEYS_PER_SCAN 4 -#endif // !QMK_KEYS_PER_SCAN - // this makes it possible to do rolling combos (zx) with keys that // convert to other keys on hold (z becomes ctrl when you hold it, // and when this option isn't enabled, z rapidly followed by x diff --git a/users/zer09/zer09.c b/users/zer09/zer09.c index a6768f0a1a..78433b4c20 100644 --- a/users/zer09/zer09.c +++ b/users/zer09/zer09.c @@ -43,7 +43,7 @@ void matrix_init_user(void) { void matrix_scan_user(void) { static uint8_t is_leds_changes = 1; - c_lyr = biton32(layer_state); + c_lyr = get_highest_layer(layer_state); is_leds_changes = is_leds_changes << set_layer_led(c_lyr); is_leds_changes = is_leds_changes << shifted_layer(); |