From 37a85e1f9b5d6ad28e52b800f1b17d68ee5e4892 Mon Sep 17 00:00:00 2001 From: Joshua Diamond Date: Sun, 28 Aug 2022 13:10:28 -0400 Subject: More spidey3 userspace cleanup (#18049) --- users/spidey3/config.h | 4 ++-- users/spidey3/layer_rgb.c | 20 ++++++++++++++------ users/spidey3/rules.mk | 1 + users/spidey3/spidey3.c | 11 ++++------- users/spidey3/spidey3.h | 5 +---- 5 files changed, 22 insertions(+), 19 deletions(-) (limited to 'users') diff --git a/users/spidey3/config.h b/users/spidey3/config.h index 49409ed85d..91bcf910ee 100644 --- a/users/spidey3/config.h +++ b/users/spidey3/config.h @@ -9,7 +9,7 @@ #ifdef RGBLIGHT_ENABLE # define RGBLIGHT_LAYERS -# define RGBLIGHT_MAX_LAYERS 17 +# define RGBLIGHT_MAX_LAYERS 18 # define RGBLIGHT_LAYER_BLINK # define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF # define RGBLIGHT_STARTUP_ANIMATION @@ -37,7 +37,7 @@ #endif -#define UNICODE_SELECTED_MODES UC_MAC, UC_LNX, UC_WINC +#define UNICODE_SELECTED_MODES UC_MAC, UC_LNX, UC_WINC, UC_EMACS #define SPI_DEBUG_SCAN_RATE diff --git a/users/spidey3/layer_rgb.c b/users/spidey3/layer_rgb.c index 671205362f..c867468194 100644 --- a/users/spidey3/layer_rgb.c +++ b/users/spidey3/layer_rgb.c @@ -65,6 +65,7 @@ const rgblight_segment_t PROGMEM _uc_mac_layer[] = RGBLIGHT_LAYER_SEGMENTS(CORN // UC_WIN disabled in config.h // UC_BSD not implemented const rgblight_segment_t PROGMEM _uc_winc_layer[] = RGBLIGHT_LAYER_SEGMENTS(CORNER_BR(HSV_CYAN)); +const rgblight_segment_t PROGMEM _uc_emacs_layer[] = RGBLIGHT_LAYER_SEGMENTS(CORNER_BR(HSV_GREEN)); // Now define the array of layers. Higher numbered layers take precedence. const rgblight_segment_t *const PROGMEM _rgb_layers[] = { @@ -89,6 +90,7 @@ const rgblight_segment_t *const PROGMEM _rgb_layers[] = { [UNICODE_OFFSET + UC_WIN] = _none, [UNICODE_OFFSET + UC_BSD] = _none, [UNICODE_OFFSET + UC_WINC] = _uc_winc_layer, + [UNICODE_OFFSET + UC_EMACS] = _uc_emacs_layer, [UNICODE_OFFSET + UC__COUNT] = NULL }; @@ -300,8 +302,8 @@ void matrix_scan_user_rgb(void) { # ifdef STARTUP_ANIMATION_DEBUG dprintf("sua RAMP_DOWN counter=%u\n", counter); # endif + rgblight_sethsv_noeeprom(old_config.hue, STARTUP_ANIMATION_SATURATION, counter); if (counter >= STARTUP_ANIMATION_FADE_STEP) { - rgblight_sethsv_noeeprom(old_config.hue, STARTUP_ANIMATION_SATURATION, counter); counter -= STARTUP_ANIMATION_FADE_STEP; } else { startup_animation_state = CLEAN_UP; @@ -456,7 +458,9 @@ void post_process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { break; case RGB_TOG: - rgb_layer_ack_yn(rgblight_config.enable); + // Hack - we only get called on the press for RGB_TOG, + // but the flag is only flipped on the release... + rgb_layer_ack_yn(!rgblight_config.enable); break; #ifdef VELOCIKEY_ENABLE @@ -473,10 +477,14 @@ void post_process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { break; #endif -#if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) - case SPI_LNX: - case SPI_OSX: - case SPI_WIN: +#if defined(UNICODE_COMMON_ENABLE) + case UC_M_MA: + case UC_M_LN: + case UC_M_WI: + case UC_M_BS: + case UC_M_WC: + case UC_M_EM: + case UC_MOD: case UC_RMOD: rgb_layer_ack(ACK_MEH); diff --git a/users/spidey3/rules.mk b/users/spidey3/rules.mk index de8ed113e7..c95582e176 100644 --- a/users/spidey3/rules.mk +++ b/users/spidey3/rules.mk @@ -1,6 +1,7 @@ BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite CONSOLE_ENABLE = yes # Console for debug BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +NKRO_ENABLE = yes LTO_ENABLE = yes SRC += init.c diff --git a/users/spidey3/spidey3.c b/users/spidey3/spidey3.c index e993f4828e..842bb465f7 100644 --- a/users/spidey3/spidey3.c +++ b/users/spidey3/spidey3.c @@ -55,7 +55,8 @@ void matrix_scan_user(void) { } static uint32_t math_glyph_exceptions(const uint16_t keycode, const bool shifted) { - if (shifted) { + bool caps = host_keyboard_led_state().caps_lock; + if (shifted != caps) { switch (keycode) { // clang-format off case KC_C: return 0x2102; @@ -97,7 +98,8 @@ bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, uin clear_oneshot_mods(); #endif - uint32_t base = shifted ? baseAlphaUpper : baseAlphaLower; + bool caps = host_keyboard_led_state().caps_lock; + uint32_t base = ((shifted == caps) ? baseAlphaLower : baseAlphaUpper); _register(base + (keycode - KC_A)); set_mods(temp_mod); } @@ -201,11 +203,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case CH_ASST: host_consumer_send(AL_ASSISTANT); return false; case CH_SUSP: tap_code16(LGUI(LSFT(KC_L))); return true; -#if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) - case SPI_LNX: set_unicode_input_mode(UC_LNX); break; - case SPI_OSX: set_unicode_input_mode(UC_OSX); break; - case SPI_WIN: set_unicode_input_mode(UC_WINC); break; -#endif // clang-format on case SPI_NORMAL ... SPI_MATH: diff --git a/users/spidey3/spidey3.h b/users/spidey3/spidey3.h index e96ab7a145..e91b299e55 100644 --- a/users/spidey3/spidey3.h +++ b/users/spidey3/spidey3.h @@ -17,10 +17,7 @@ enum userspace_layers { }; enum custom_keycodes { - SPI_LNX = SAFE_RANGE, // Mode: Linux - SPI_OSX, // Mode: Mac - SPI_WIN, // Mode: Windows - CH_CPNL, // AL Control Panel + CH_CPNL = SAFE_RANGE, // AL Control Panel CH_ASST, // AL Context-aware Desktop Assistant CH_SUSP, // Suspend -- cgit v1.2.3