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<