From 87b11345a55d076966846d87b60d0f315b8bb984 Mon Sep 17 00:00:00 2001 From: Ryan Date: Thu, 6 Jul 2023 18:48:02 +1000 Subject: Get rid of `USB_LED_CAPS_LOCK` (#21436) --- .../1upkeyboards/1up60rgb/keymaps/default/keymap.c | 5 ++-- .../1upkeyboards/1up60rgb/keymaps/iso/keymap.c | 5 ++-- .../1upkeyboards/1up60rgb/keymaps/raffle/keymap.c | 5 ++-- .../1upkeyboards/1up60rgb/keymaps/tsangan/keymap.c | 5 ++-- .../40percentclub/mf68/keymaps/delivrance/keymap.c | 7 ++--- .../40percentclub/mf68/keymaps/emdarcher/keymap.c | 7 +++-- keyboards/40percentclub/ut47/led.c | 31 ++++++++++++---------- .../siemens_tastatur/keymaps/default/keymap.c | 5 ++-- keyboards/dz60/keymaps/muzfuz/keymap.c | 5 ++-- .../dztech/dz60rgb_ansi/keymaps/kuru/keymap.c | 4 +-- .../dztech/dz60rgb_ansi/keymaps/muralisc/keymap.c | 4 +-- .../ergodox_ez/keymaps/dvorak_42_key/keymap.c | 5 ++-- keyboards/ergodox_ez/keymaps/smurmann/keymap.c | 5 ++-- .../handwired/frenchdev/keymaps/default/keymap.c | 6 ++--- .../owlet60/keymaps/oled_testing/keymap.c | 18 ------------- .../handwired/promethium/keymaps/default/keymap.c | 5 ++-- .../handwired/promethium/keymaps/priyadi/keymap.c | 5 ++-- .../kbdfans/kbd67/rev2/keymaps/tucznak/keymap.c | 17 +++--------- .../kbdfans/kbd6x/keymaps/konstantin/keymap.c | 6 ++--- keyboards/kbdfans/kbd75/keymaps/tucznak/keymap.c | 5 ++-- .../keebio/bfo9000/keymaps/abstractkb/keymap.c | 5 ++-- keyboards/kmini/keymaps/default/keymap.c | 5 ++-- .../kprepublic/bm40hsrgb/keymaps/signynt/keymap.c | 2 +- .../kprepublic/jj50/keymaps/abstractkb/keymap.c | 5 ++-- .../jj50/keymaps/abstractkb_gergomatch/keymap.c | 5 ++-- .../dimple/staggered/keymaps/tominabox1/keymap.c | 5 ++-- .../lazydesigners/the50/keymaps/default/keymap.c | 5 ++-- .../the50/keymaps/mikethetiger/keymap.c | 5 ++-- keyboards/noxary/268/keymaps/ansi/keymap.c | 5 ++-- keyboards/noxary/268/keymaps/default/keymap.c | 5 ++-- keyboards/noxary/268/keymaps/iso/keymap.c | 5 ++-- keyboards/noxary/268/keymaps/sixtyeight/keymap.c | 5 ++-- keyboards/owlab/spring/spring.c | 2 +- keyboards/percent/canoe/keymaps/boy_314/keymap.c | 5 ++-- keyboards/planck/keymaps/altgr/common/init.h | 11 ++++---- keyboards/planck/keymaps/hiea/common/init.h | 11 ++++---- keyboards/planck/keymaps/hieax/common/init.h | 11 ++++---- keyboards/planck/keymaps/rootiest/keymap.c | 2 +- keyboards/planck/keymaps/sdothum/common/init.h | 11 ++++---- keyboards/playkbtw/ca66/keymaps/olivia/keymap.c | 15 +++-------- keyboards/playkbtw/pk60/keymaps/default/keymap.c | 5 ++-- .../primekb/prime_e/keymaps/jetpacktuxedo/keymap.c | 5 ++-- .../primekb/prime_e/keymaps/madhatter/keymap.c | 5 ++-- keyboards/shoc/keymaps/bongo/keymap.c | 2 +- .../bananasplit/keymaps/jockyxu1122_iso/keymap.c | 5 ++-- keyboards/uk78/keymaps/default/keymap.c | 5 ++-- keyboards/uk78/keymaps/rask/keymap.c | 5 ++-- .../v60_type_r/keymaps/followingghosts/keymap.c | 5 ++-- keyboards/v60_type_r/keymaps/vimouse/keymap.c | 5 ++-- keyboards/v60_type_r/keymaps/xtonhasvim/keymap.c | 5 ++-- .../work_board/keymaps/drashna/keymap.c | 4 +-- keyboards/xbows/woody/woody.c | 2 +- keyboards/xiudi/xd75/keymaps/bulbizarre/keymap.c | 13 +++------ .../mrsendyyk/keymap.c | 5 ++-- .../ergodox/colemak_code_friendly/keymap.c | 8 +++--- layouts/community/ergodox/drashna/keymap.c | 8 +++--- layouts/community/ergodox/jjerrell/keymap.c | 4 +-- layouts/community/ergodox/ordinary/keymap.c | 2 +- layouts/community/ergodox/ordinary_osx/keymap.c | 2 +- layouts/community/ergodox/osx_neo2/keymap.c | 7 +---- layouts/community/ergodox/software_neo2/keymap.c | 2 +- layouts/community/ergodox/swedish-lindhe/keymap.c | 7 +---- .../community/ortho_4x12/brandonschlack/keymap.c | 5 ++-- layouts/community/ortho_4x12/drashna/keymap.c | 4 +-- platforms/avr/sleep_led.c | 9 ++++--- platforms/chibios/sleep_led.c | 11 +++++--- quantum/led.c | 6 ++--- quantum/led.h | 3 --- users/curry/rgb_lighting_user.c | 6 ++--- users/turbomech/backupturbomech.c | 5 ++-- 70 files changed, 214 insertions(+), 226 deletions(-) diff --git a/keyboards/1upkeyboards/1up60rgb/keymaps/default/keymap.c b/keyboards/1upkeyboards/1up60rgb/keymaps/default/keymap.c index 15b7c9faa7..5792f51ca8 100644 --- a/keyboards/1upkeyboards/1up60rgb/keymaps/default/keymap.c +++ b/keyboards/1upkeyboards/1up60rgb/keymaps/default/keymap.c @@ -18,12 +18,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; -void led_set_user(uint8_t usb_led) { - if (usb_led & (1 << USB_LED_CAPS_LOCK)) { +bool led_update_user(led_t led_state) { + if (led_state.caps_lock) { setPinOutput(B2); writePinLow(B2); } else { setPinInput(B2); writePinLow(B2); } + return false; } diff --git a/keyboards/1upkeyboards/1up60rgb/keymaps/iso/keymap.c b/keyboards/1upkeyboards/1up60rgb/keymaps/iso/keymap.c index fd6087a238..20783c22cb 100644 --- a/keyboards/1upkeyboards/1up60rgb/keymaps/iso/keymap.c +++ b/keyboards/1upkeyboards/1up60rgb/keymaps/iso/keymap.c @@ -18,12 +18,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; -void led_set_user(uint8_t usb_led) { - if (usb_led & (1 << USB_LED_CAPS_LOCK)) { +bool led_update_user(led_t led_state) { + if (led_state.caps_lock) { setPinOutput(B2); writePinLow(B2); } else { setPinInput(B2); writePinLow(B2); } + return false; } diff --git a/keyboards/1upkeyboards/1up60rgb/keymaps/raffle/keymap.c b/keyboards/1upkeyboards/1up60rgb/keymaps/raffle/keymap.c index 78d00dd06d..453bf8c961 100644 --- a/keyboards/1upkeyboards/1up60rgb/keymaps/raffle/keymap.c +++ b/keyboards/1upkeyboards/1up60rgb/keymaps/raffle/keymap.c @@ -72,10 +72,11 @@ layer_state_t layer_state_set_user(layer_state_t state) { } // support for standard mod state keys (caps lock, scroll lock, etc.) -void led_set_user(uint8_t usb_led) { - if (usb_led & (1 << USB_LED_CAPS_LOCK)) { +bool led_update_user(led_t led_state) { + if (led_state.caps_lock) { DDRB |= (1 << 2); PORTB &= ~(1 << 2); } else { DDRB &= ~(1 << 2); PORTB &= ~(1 << 2); } + return false; } diff --git a/keyboards/1upkeyboards/1up60rgb/keymaps/tsangan/keymap.c b/keyboards/1upkeyboards/1up60rgb/keymaps/tsangan/keymap.c index a45947de54..5cc9227885 100644 --- a/keyboards/1upkeyboards/1up60rgb/keymaps/tsangan/keymap.c +++ b/keyboards/1upkeyboards/1up60rgb/keymaps/tsangan/keymap.c @@ -18,12 +18,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; -void led_set_user(uint8_t usb_led) { - if (usb_led & (1 << USB_LED_CAPS_LOCK)) { +bool led_update_user(led_t led_state) { + if (led_state.caps_lock) { setPinOutput(B2); writePinLow(B2); } else { setPinInput(B2); writePinLow(B2); } + return false; } diff --git a/keyboards/40percentclub/mf68/keymaps/delivrance/keymap.c b/keyboards/40percentclub/mf68/keymaps/delivrance/keymap.c index c3e359e24e..f7899ad886 100644 --- a/keyboards/40percentclub/mf68/keymaps/delivrance/keymap.c +++ b/keyboards/40percentclub/mf68/keymaps/delivrance/keymap.c @@ -157,11 +157,11 @@ void dynamic_macro_record_end_user(int8_t direction) { // Custom Caps Lock backlight behaviour // ------------------------------------ -void led_set_user(uint8_t usb_led) { +bool led_update_user(led_t led_state) { // This exists because I don't like the backlight to turn OFF when the Caps Lock is ON. // That is, this will turn the backlight ON (at half the brightness) when the Caps Lock is ON as well. static bool prev_is_caps_on; - bool is_caps_on = IS_LED_ON(usb_led, USB_LED_CAPS_LOCK); + bool is_caps_on = led_state.caps_lock; if (prev_is_caps_on != is_caps_on) { prev_is_caps_on = is_caps_on; @@ -178,7 +178,7 @@ void led_set_user(uint8_t usb_led) { } // Turn on the Pro Micro's on-board LEDs for Caps Lock - if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { + if (led_state.caps_lock) { // Set to low setPinOutput(B0); writePinLow(B0); @@ -189,6 +189,7 @@ void led_set_user(uint8_t usb_led) { setPinInput(B0); setPinInput(D5); } + return false; } // Backlight idle timeout feature diff --git a/keyboards/40percentclub/mf68/keymaps/emdarcher/keymap.c b/keyboards/40percentclub/mf68/keymaps/emdarcher/keymap.c index ea659979ea..3932a1ee9b 100644 --- a/keyboards/40percentclub/mf68/keymaps/emdarcher/keymap.c +++ b/keyboards/40percentclub/mf68/keymaps/emdarcher/keymap.c @@ -35,11 +35,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ) }; - - -void led_set_user(uint8_t usb_led){ +bool led_update_user(led_t led_state){ //turn on the Pro Micro's on board LEDs for CAPS LOCK - if(IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)){ + if(led_state.caps_lock){ //set led pins to low setPinOutput(B0); writePinLow(B0); @@ -50,4 +48,5 @@ void led_set_user(uint8_t usb_led){ setPinInput(B0); setPinInput(D5); } + return false; } diff --git a/keyboards/40percentclub/ut47/led.c b/keyboards/40percentclub/ut47/led.c index f5d8ffc12e..867a6e2e2a 100644 --- a/keyboards/40percentclub/ut47/led.c +++ b/keyboards/40percentclub/ut47/led.c @@ -19,20 +19,23 @@ along with this program. If not, see . #include #include "led.h" - -void led_set(uint8_t usb_led) +bool led_update_kb(led_t led_state) { - if (usb_led & (1<mods & MOD_BIT(KC_LSFT)) || (keyboard_report->mods & MOD_BIT(KC_RSFT)) || (host_keyboard_leds() & (1<mods & MOD_BIT(KC_LSFT)) || (keyboard_report->mods & MOD_BIT(KC_RSFT)) || host_keyboard_led_state().caps_lock) { ergodox_right_led_1_on(); } else { ergodox_right_led_1_off(); diff --git a/layouts/community/ergodox/ordinary_osx/keymap.c b/layouts/community/ergodox/ordinary_osx/keymap.c index f67a6d6da0..3de64f4994 100644 --- a/layouts/community/ergodox/ordinary_osx/keymap.c +++ b/layouts/community/ergodox/ordinary_osx/keymap.c @@ -238,7 +238,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Runs constantly in the background, in a loop. void matrix_scan_user(void) { // shift or caps lock turns on red light - if ((keyboard_report->mods & MOD_BIT(KC_LSFT)) || (keyboard_report->mods & MOD_BIT(KC_RSFT)) || (host_keyboard_leds() & (1<mods & MOD_BIT(KC_LSFT)) || (keyboard_report->mods & MOD_BIT(KC_RSFT)) || host_keyboard_led_state().caps_lock) { ergodox_right_led_1_on(); } else { ergodox_right_led_1_off(); diff --git a/layouts/community/ergodox/osx_neo2/keymap.c b/layouts/community/ergodox/osx_neo2/keymap.c index 5b279073cc..079a92a97e 100644 --- a/layouts/community/ergodox/osx_neo2/keymap.c +++ b/layouts/community/ergodox/osx_neo2/keymap.c @@ -686,7 +686,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if ((capslock_state & MOD_MASK_SHIFT) == MOD_MASK_SHIFT) { // CAPSLOCK is currently active, disable it - if (host_keyboard_leds() & (1 << USB_LED_CAPS_LOCK)) { + if (host_keyboard_led_state().caps_lock) { unregister_code(KC_LOCKING_CAPS_LOCK); } else { register_code(KC_LOCKING_CAPS_LOCK); @@ -697,11 +697,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return process_record_user_shifted(keycode, record); }; -// Runs just one time when the keyboard initializes. -void matrix_init_user(void){ - -}; - // Runs constantly in the background, in a loop. void matrix_scan_user(void) { uint8_t layer = get_highest_layer(layer_state); diff --git a/layouts/community/ergodox/software_neo2/keymap.c b/layouts/community/ergodox/software_neo2/keymap.c index c191a034f2..1c68a68b0f 100644 --- a/layouts/community/ergodox/software_neo2/keymap.c +++ b/layouts/community/ergodox/software_neo2/keymap.c @@ -106,7 +106,7 @@ void matrix_scan_user(void) { ergodox_right_led_3_off(); ergodox_board_led_off(); - if (host_keyboard_leds() & (1<. /* FIXME: Add doxygen comments here. */ -/* keyboard LEDs */ -#define USB_LED_CAPS_LOCK 1 - #ifdef __cplusplus extern "C" { #endif diff --git a/users/curry/rgb_lighting_user.c b/users/curry/rgb_lighting_user.c index b8d519feca..34156744fe 100644 --- a/users/curry/rgb_lighting_user.c +++ b/users/curry/rgb_lighting_user.c @@ -11,9 +11,9 @@ void rgblight_sethsv_default_helper(uint8_t index) { rgblight_sethsv_at(rgblight * This is especially useful for One Shot Mods, since it's not always obvious if they're still lit up. */ #if defined(INDICATOR_LIGHTS) -void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { +void set_rgb_indicators(uint8_t this_mod, led_t this_led, uint8_t this_osm) { if (userspace_config.rgb_layer_change && get_highest_layer(layer_state) == 0) { - if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1 << USB_LED_CAPS_LOCK)) { + if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led.caps_lock) { # ifdef SHFT_LED1 rgblight_sethsv_at(120, 255, 255, SHFT_LED1); # endif // SHFT_LED1 @@ -79,7 +79,7 @@ void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { /* Function for the indicators */ void matrix_scan_indicator(void) { if (has_initialized) { - set_rgb_indicators(get_mods(), host_keyboard_leds(), get_oneshot_mods()); + set_rgb_indicators(get_mods(), host_keyboard_led_state(), get_oneshot_mods()); } } #endif // INDICATOR_LIGHTS diff --git a/users/turbomech/backupturbomech.c b/users/turbomech/backupturbomech.c index 3671d27ab4..70d3d065c4 100644 --- a/users/turbomech/backupturbomech.c +++ b/users/turbomech/backupturbomech.c @@ -135,14 +135,15 @@ void matrix_init_user(void) { } static bool is_capslocked = false; -void led_set_user(uint8_t usb_led) { - if (usb_led & (1<