diff options
| author | Ryan <fauxpark@gmail.com> | 2023-07-06 18:48:02 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-06 09:48:02 +0100 |
| commit | 87b11345a55d076966846d87b60d0f315b8bb984 (patch) | |
| tree | a64503358d5f30b55a722b882eebaf1b60b03e1f | |
| parent | 928e03e8d669cb35a96c2aa4a09012c527b27892 (diff) | |
Get rid of `USB_LED_CAPS_LOCK` (#21436)
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] = { | |||
| 18 | 18 | ||
| 19 | }; | 19 | }; |
| 20 | 20 | ||
| 21 | void led_set_user(uint8_t usb_led) { | 21 | bool led_update_user(led_t led_state) { |
| 22 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) { | 22 | if (led_state.caps_lock) { |
| 23 | setPinOutput(B2); | 23 | setPinOutput(B2); |
| 24 | writePinLow(B2); | 24 | writePinLow(B2); |
| 25 | } else { | 25 | } else { |
| 26 | setPinInput(B2); | 26 | setPinInput(B2); |
| 27 | writePinLow(B2); | 27 | writePinLow(B2); |
| 28 | } | 28 | } |
| 29 | return false; | ||
| 29 | } | 30 | } |
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] = { | |||
| 18 | 18 | ||
| 19 | }; | 19 | }; |
| 20 | 20 | ||
| 21 | void led_set_user(uint8_t usb_led) { | 21 | bool led_update_user(led_t led_state) { |
| 22 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) { | 22 | if (led_state.caps_lock) { |
| 23 | setPinOutput(B2); | 23 | setPinOutput(B2); |
| 24 | writePinLow(B2); | 24 | writePinLow(B2); |
| 25 | } else { | 25 | } else { |
| 26 | setPinInput(B2); | 26 | setPinInput(B2); |
| 27 | writePinLow(B2); | 27 | writePinLow(B2); |
| 28 | } | 28 | } |
| 29 | return false; | ||
| 29 | } | 30 | } |
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) { | |||
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | // support for standard mod state keys (caps lock, scroll lock, etc.) | 74 | // support for standard mod state keys (caps lock, scroll lock, etc.) |
| 75 | void led_set_user(uint8_t usb_led) { | 75 | bool led_update_user(led_t led_state) { |
| 76 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) { | 76 | if (led_state.caps_lock) { |
| 77 | DDRB |= (1 << 2); PORTB &= ~(1 << 2); | 77 | DDRB |= (1 << 2); PORTB &= ~(1 << 2); |
| 78 | } else { | 78 | } else { |
| 79 | DDRB &= ~(1 << 2); PORTB &= ~(1 << 2); | 79 | DDRB &= ~(1 << 2); PORTB &= ~(1 << 2); |
| 80 | } | 80 | } |
| 81 | return false; | ||
| 81 | } | 82 | } |
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] = { | |||
| 18 | 18 | ||
| 19 | }; | 19 | }; |
| 20 | 20 | ||
| 21 | void led_set_user(uint8_t usb_led) { | 21 | bool led_update_user(led_t led_state) { |
| 22 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) { | 22 | if (led_state.caps_lock) { |
| 23 | setPinOutput(B2); | 23 | setPinOutput(B2); |
| 24 | writePinLow(B2); | 24 | writePinLow(B2); |
| 25 | } else { | 25 | } else { |
| 26 | setPinInput(B2); | 26 | setPinInput(B2); |
| 27 | writePinLow(B2); | 27 | writePinLow(B2); |
| 28 | } | 28 | } |
| 29 | return false; | ||
| 29 | } | 30 | } |
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) { | |||
| 157 | // Custom Caps Lock backlight behaviour | 157 | // Custom Caps Lock backlight behaviour |
| 158 | // ------------------------------------ | 158 | // ------------------------------------ |
| 159 | 159 | ||
| 160 | void led_set_user(uint8_t usb_led) { | 160 | bool led_update_user(led_t led_state) { |
| 161 | // This exists because I don't like the backlight to turn OFF when the Caps Lock is ON. | 161 | // This exists because I don't like the backlight to turn OFF when the Caps Lock is ON. |
| 162 | // That is, this will turn the backlight ON (at half the brightness) when the Caps Lock is ON as well. | 162 | // That is, this will turn the backlight ON (at half the brightness) when the Caps Lock is ON as well. |
| 163 | static bool prev_is_caps_on; | 163 | static bool prev_is_caps_on; |
| 164 | bool is_caps_on = IS_LED_ON(usb_led, USB_LED_CAPS_LOCK); | 164 | bool is_caps_on = led_state.caps_lock; |
| 165 | 165 | ||
| 166 | if (prev_is_caps_on != is_caps_on) { | 166 | if (prev_is_caps_on != is_caps_on) { |
| 167 | prev_is_caps_on = is_caps_on; | 167 | prev_is_caps_on = is_caps_on; |
| @@ -178,7 +178,7 @@ void led_set_user(uint8_t usb_led) { | |||
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | // Turn on the Pro Micro's on-board LEDs for Caps Lock | 180 | // Turn on the Pro Micro's on-board LEDs for Caps Lock |
| 181 | if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { | 181 | if (led_state.caps_lock) { |
| 182 | // Set to low | 182 | // Set to low |
| 183 | setPinOutput(B0); | 183 | setPinOutput(B0); |
| 184 | writePinLow(B0); | 184 | writePinLow(B0); |
| @@ -189,6 +189,7 @@ void led_set_user(uint8_t usb_led) { | |||
| 189 | setPinInput(B0); | 189 | setPinInput(B0); |
| 190 | setPinInput(D5); | 190 | setPinInput(D5); |
| 191 | } | 191 | } |
| 192 | return false; | ||
| 192 | } | 193 | } |
| 193 | 194 | ||
| 194 | // Backlight idle timeout feature | 195 | // 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] = { | |||
| 35 | ) | 35 | ) |
| 36 | }; | 36 | }; |
| 37 | 37 | ||
| 38 | 38 | bool led_update_user(led_t led_state){ | |
| 39 | |||
| 40 | void led_set_user(uint8_t usb_led){ | ||
| 41 | //turn on the Pro Micro's on board LEDs for CAPS LOCK | 39 | //turn on the Pro Micro's on board LEDs for CAPS LOCK |
| 42 | if(IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)){ | 40 | if(led_state.caps_lock){ |
| 43 | //set led pins to low | 41 | //set led pins to low |
| 44 | setPinOutput(B0); | 42 | setPinOutput(B0); |
| 45 | writePinLow(B0); | 43 | writePinLow(B0); |
| @@ -50,4 +48,5 @@ void led_set_user(uint8_t usb_led){ | |||
| 50 | setPinInput(B0); | 48 | setPinInput(B0); |
| 51 | setPinInput(D5); | 49 | setPinInput(D5); |
| 52 | } | 50 | } |
| 51 | return false; | ||
| 53 | } | 52 | } |
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 <http://www.gnu.org/licenses/>. | |||
| 19 | #include <stdint.h> | 19 | #include <stdint.h> |
| 20 | #include "led.h" | 20 | #include "led.h" |
| 21 | 21 | ||
| 22 | 22 | bool led_update_kb(led_t led_state) | |
| 23 | void led_set(uint8_t usb_led) | ||
| 24 | { | 23 | { |
| 25 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) { | 24 | bool res = led_update_user(led_state); |
| 26 | // output low | 25 | if (res) { |
| 27 | DDRB |= (1<<0); | 26 | if (led_state.caps_lock) { |
| 28 | PORTB &= ~(1<<0); | 27 | // output low |
| 29 | DDRD |= (1<<5); | 28 | DDRB |= (1<<0); |
| 30 | PORTD &= ~(1<<5); | 29 | PORTB &= ~(1<<0); |
| 31 | } else { | 30 | DDRD |= (1<<5); |
| 32 | // Hi-Z | 31 | PORTD &= ~(1<<5); |
| 33 | DDRB &= ~(1<<0); | 32 | } else { |
| 34 | PORTB &= ~(1<<0); | 33 | // Hi-Z |
| 35 | DDRD &= ~(1<<5); | 34 | DDRB &= ~(1<<0); |
| 36 | PORTD &= ~(1<<5); | 35 | PORTB &= ~(1<<0); |
| 36 | DDRD &= ~(1<<5); | ||
| 37 | PORTD &= ~(1<<5); | ||
| 38 | } | ||
| 37 | } | 39 | } |
| 40 | return false; | ||
| 38 | } | 41 | } |
diff --git a/keyboards/converter/siemens_tastatur/keymaps/default/keymap.c b/keyboards/converter/siemens_tastatur/keymaps/default/keymap.c index 0ce8a64ab7..0f3911a2d3 100644 --- a/keyboards/converter/siemens_tastatur/keymaps/default/keymap.c +++ b/keyboards/converter/siemens_tastatur/keymaps/default/keymap.c | |||
| @@ -51,10 +51,11 @@ void matrix_init_user(void) { | |||
| 51 | writePinLow(B0); | 51 | writePinLow(B0); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | void led_set_user(uint8_t usb_led) { | 54 | bool led_update_user(led_t led_state) { |
| 55 | if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { | 55 | if (led_state.caps_lock) { |
| 56 | writePinHigh(B0); | 56 | writePinHigh(B0); |
| 57 | } else { | 57 | } else { |
| 58 | writePinLow(B0); | 58 | writePinLow(B0); |
| 59 | } | 59 | } |
| 60 | return false; | ||
| 60 | } | 61 | } |
diff --git a/keyboards/dz60/keymaps/muzfuz/keymap.c b/keyboards/dz60/keymaps/muzfuz/keymap.c index fcd4c317d1..1a71b9bb86 100644 --- a/keyboards/dz60/keymaps/muzfuz/keymap.c +++ b/keyboards/dz60/keymaps/muzfuz/keymap.c | |||
| @@ -25,12 +25,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 25 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), | 25 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), |
| 26 | }; | 26 | }; |
| 27 | 27 | ||
| 28 | void led_set_user(uint8_t usb_led) { | 28 | bool led_update_user(led_t led_state) { |
| 29 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) { | 29 | if (led_state.caps_lock) { |
| 30 | DDRB |= (1 << 2); PORTB &= ~(1 << 2); | 30 | DDRB |= (1 << 2); PORTB &= ~(1 << 2); |
| 31 | } else { | 31 | } else { |
| 32 | DDRB &= ~(1 << 2); PORTB &= ~(1 << 2); | 32 | DDRB &= ~(1 << 2); PORTB &= ~(1 << 2); |
| 33 | } | 33 | } |
| 34 | return false; | ||
| 34 | } | 35 | } |
| 35 | 36 | ||
| 36 | bool process_record_user(uint16_t keycode, keyrecord_t *record) | 37 | bool process_record_user(uint16_t keycode, keyrecord_t *record) |
diff --git a/keyboards/dztech/dz60rgb_ansi/keymaps/kuru/keymap.c b/keyboards/dztech/dz60rgb_ansi/keymaps/kuru/keymap.c index 7f3b24de74..e5f5083ee5 100644 --- a/keyboards/dztech/dz60rgb_ansi/keymaps/kuru/keymap.c +++ b/keyboards/dztech/dz60rgb_ansi/keymaps/kuru/keymap.c | |||
| @@ -85,7 +85,7 @@ void highlight_layer3(void){ | |||
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | bool rgb_matrix_indicators_user(void) { | 87 | bool rgb_matrix_indicators_user(void) { |
| 88 | uint8_t this_led = host_keyboard_leds(); | 88 | led_t led_state = host_keyboard_led_state(); |
| 89 | if (!g_suspend_state) { | 89 | if (!g_suspend_state) { |
| 90 | switch (get_highest_layer(layer_state)) { | 90 | switch (get_highest_layer(layer_state)) { |
| 91 | case 3: | 91 | case 3: |
| @@ -94,7 +94,7 @@ bool rgb_matrix_indicators_user(void) { | |||
| 94 | break; | 94 | break; |
| 95 | } | 95 | } |
| 96 | } | 96 | } |
| 97 | if ( this_led & (1<<USB_LED_CAPS_LOCK)) { | 97 | if (led_state.caps_lock) { |
| 98 | rgb_matrix_set_color(40, 0xFF, 0xFF, 0xFF); | 98 | rgb_matrix_set_color(40, 0xFF, 0xFF, 0xFF); |
| 99 | } | 99 | } |
| 100 | return false; | 100 | return false; |
diff --git a/keyboards/dztech/dz60rgb_ansi/keymaps/muralisc/keymap.c b/keyboards/dztech/dz60rgb_ansi/keymaps/muralisc/keymap.c index af2d9fa3dc..ff829f53fa 100644 --- a/keyboards/dztech/dz60rgb_ansi/keymaps/muralisc/keymap.c +++ b/keyboards/dztech/dz60rgb_ansi/keymaps/muralisc/keymap.c | |||
| @@ -146,7 +146,7 @@ void highlight_layer3(void) { | |||
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | bool rgb_matrix_indicators_user(void) { | 148 | bool rgb_matrix_indicators_user(void) { |
| 149 | uint8_t this_led = host_keyboard_leds(); | 149 | led_t led_state = host_keyboard_led_state(); |
| 150 | if (!g_suspend_state) { | 150 | if (!g_suspend_state) { |
| 151 | switch (get_highest_layer(layer_state)) { | 151 | switch (get_highest_layer(layer_state)) { |
| 152 | case 1: | 152 | case 1: |
| @@ -161,7 +161,7 @@ bool rgb_matrix_indicators_user(void) { | |||
| 161 | break; | 161 | break; |
| 162 | } | 162 | } |
| 163 | } | 163 | } |
| 164 | if ( this_led & (1<<USB_LED_CAPS_LOCK)) { | 164 | if (led_state.caps_lock) { |
| 165 | rgb_matrix_set_color(40, 0xFF, 0xFF, 0xFF); | 165 | rgb_matrix_set_color(40, 0xFF, 0xFF, 0xFF); |
| 166 | } | 166 | } |
| 167 | return false; | 167 | return false; |
diff --git a/keyboards/ergodox_ez/keymaps/dvorak_42_key/keymap.c b/keyboards/ergodox_ez/keymaps/dvorak_42_key/keymap.c index 34284e146d..f8fce23ce5 100644 --- a/keyboards/ergodox_ez/keymaps/dvorak_42_key/keymap.c +++ b/keyboards/ergodox_ez/keymaps/dvorak_42_key/keymap.c | |||
| @@ -296,12 +296,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 296 | 296 | ||
| 297 | 297 | ||
| 298 | 298 | ||
| 299 | void led_set_user(uint8_t usb_led) { | 299 | bool led_update_user(led_t led_state) { |
| 300 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) { | 300 | if (led_state.caps_lock) { |
| 301 | ergodox_right_led_1_on(); | 301 | ergodox_right_led_1_on(); |
| 302 | } else { | 302 | } else { |
| 303 | ergodox_right_led_1_off(); | 303 | ergodox_right_led_1_off(); |
| 304 | } | 304 | } |
| 305 | return false; | ||
| 305 | } | 306 | } |
| 306 | 307 | ||
| 307 | 308 | ||
diff --git a/keyboards/ergodox_ez/keymaps/smurmann/keymap.c b/keyboards/ergodox_ez/keymaps/smurmann/keymap.c index 0d60e46bfc..65a7a08ec7 100644 --- a/keyboards/ergodox_ez/keymaps/smurmann/keymap.c +++ b/keyboards/ergodox_ez/keymaps/smurmann/keymap.c | |||
| @@ -194,11 +194,12 @@ void matrix_scan_user(void) { | |||
| 194 | } | 194 | } |
| 195 | }; | 195 | }; |
| 196 | 196 | ||
| 197 | void led_set_user(uint8_t usb_led){ | 197 | bool led_update_user(led_t led_state){ |
| 198 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) | 198 | if (led_state.caps_lock) |
| 199 | { | 199 | { |
| 200 | capsOn = true; | 200 | capsOn = true; |
| 201 | }else { | 201 | }else { |
| 202 | capsOn = false; | 202 | capsOn = false; |
| 203 | } | 203 | } |
| 204 | return false; | ||
| 204 | } | 205 | } |
diff --git a/keyboards/handwired/frenchdev/keymaps/default/keymap.c b/keyboards/handwired/frenchdev/keymaps/default/keymap.c index e5a5dcc6c1..60e355f290 100644 --- a/keyboards/handwired/frenchdev/keymaps/default/keymap.c +++ b/keyboards/handwired/frenchdev/keymaps/default/keymap.c | |||
| @@ -351,11 +351,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 351 | return true; | 351 | return true; |
| 352 | } | 352 | } |
| 353 | 353 | ||
| 354 | void led_set_user(uint8_t usb_led) { | 354 | bool led_update_user(led_t led_state) { |
| 355 | if (usb_led & (1<<USB_LED_CAPS_LOCK)){ | 355 | if (led_state.caps_lock){ |
| 356 | frenchdev_led_3_on(); | 356 | frenchdev_led_3_on(); |
| 357 | } else { | 357 | } else { |
| 358 | frenchdev_led_3_off(); | 358 | frenchdev_led_3_off(); |
| 359 | } | 359 | } |
| 360 | return ; | 360 | return false; |
| 361 | } | 361 | } |
diff --git a/keyboards/handwired/owlet60/keymaps/oled_testing/keymap.c b/keyboards/handwired/owlet60/keymaps/oled_testing/keymap.c index f617fb5e68..f54ceb4491 100644 --- a/keyboards/handwired/owlet60/keymaps/oled_testing/keymap.c +++ b/keyboards/handwired/owlet60/keymaps/oled_testing/keymap.c | |||
| @@ -67,24 +67,6 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) { | |||
| 67 | return OLED_ROTATION_180; | 67 | return OLED_ROTATION_180; |
| 68 | } | 68 | } |
| 69 | bool oled_task_user(void) { | 69 | bool oled_task_user(void) { |
| 70 | // Host Keyboard Layer Status | ||
| 71 | /*oled_write_P(PSTR("Lyr: "), false); | ||
| 72 | switch (get_highest_layer(layer_state)) { | ||
| 73 | case 0: | ||
| 74 | oled_write_P(PSTR("Alpha\n"), false); | ||
| 75 | break; | ||
| 76 | case 1: | ||
| 77 | oled_write_P(PSTR("FN\n"), false); | ||
| 78 | break; | ||
| 79 | default: | ||
| 80 | // Or use the write_ln shortcut over adding '\n' to the end of your string | ||
| 81 | oled_write_ln_P(PSTR("Undefined"), false); | ||
| 82 | } | ||
| 83 | |||
| 84 | uint8_t led_usb_state = host_keyboard_leds(); | ||
| 85 | oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false); | ||
| 86 | */ | ||
| 87 | |||
| 88 | static const char PROGMEM qmk_logo[] = { | 70 | static const char PROGMEM qmk_logo[] = { |
| 89 | 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, | 71 | 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, |
| 90 | 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, | 72 | 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, |
diff --git a/keyboards/handwired/promethium/keymaps/default/keymap.c b/keyboards/handwired/promethium/keymaps/default/keymap.c index 42819245c7..ff73e51d5e 100644 --- a/keyboards/handwired/promethium/keymaps/default/keymap.c +++ b/keyboards/handwired/promethium/keymaps/default/keymap.c | |||
| @@ -1303,8 +1303,8 @@ void turn_off_capslock(void) { | |||
| 1303 | rgbsps_send(); | 1303 | rgbsps_send(); |
| 1304 | } | 1304 | } |
| 1305 | 1305 | ||
| 1306 | void led_set_user(uint8_t usb_led) { | 1306 | bool led_update_user(led_t led_state) { |
| 1307 | bool new_capslock = usb_led & (1<<USB_LED_CAPS_LOCK); | 1307 | bool new_capslock = led_state.caps_lock; |
| 1308 | if (new_capslock ^ capslock) { // capslock state is different | 1308 | if (new_capslock ^ capslock) { // capslock state is different |
| 1309 | if ((capslock = new_capslock)) { | 1309 | if ((capslock = new_capslock)) { |
| 1310 | rgbsps_set(LED_IND_CAPSLOCK, THEME_COLOR_CAPSLOCK); | 1310 | rgbsps_set(LED_IND_CAPSLOCK, THEME_COLOR_CAPSLOCK); |
| @@ -1313,6 +1313,7 @@ void turn_off_capslock(void) { | |||
| 1313 | } | 1313 | } |
| 1314 | rgbsps_send(); | 1314 | rgbsps_send(); |
| 1315 | } | 1315 | } |
| 1316 | return false; | ||
| 1316 | } | 1317 | } |
| 1317 | #endif | 1318 | #endif |
| 1318 | 1319 | ||
diff --git a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c index 203a0eda22..37cff59cb1 100644 --- a/keyboards/handwired/promethium/keymaps/priyadi/keymap.c +++ b/keyboards/handwired/promethium/keymaps/priyadi/keymap.c | |||
| @@ -1306,8 +1306,8 @@ void turn_off_capslock(void) { | |||
| 1306 | rgbsps_send(); | 1306 | rgbsps_send(); |
| 1307 | } | 1307 | } |
| 1308 | 1308 | ||
| 1309 | void led_set_user(uint8_t usb_led) { | 1309 | bool led_update_user(led_t led_state) { |
| 1310 | bool new_capslock = usb_led & (1<<USB_LED_CAPS_LOCK); | 1310 | bool new_capslock = led_state.caps_lock; |
| 1311 | if (new_capslock ^ capslock) { // capslock state is different | 1311 | if (new_capslock ^ capslock) { // capslock state is different |
| 1312 | if ((capslock = new_capslock)) { | 1312 | if ((capslock = new_capslock)) { |
| 1313 | rgbsps_set(LED_IND_CAPSLOCK, THEME_COLOR_CAPSLOCK); | 1313 | rgbsps_set(LED_IND_CAPSLOCK, THEME_COLOR_CAPSLOCK); |
| @@ -1316,6 +1316,7 @@ void turn_off_capslock(void) { | |||
| 1316 | } | 1316 | } |
| 1317 | rgbsps_send(); | 1317 | rgbsps_send(); |
| 1318 | } | 1318 | } |
| 1319 | return false; | ||
| 1319 | } | 1320 | } |
| 1320 | #endif | 1321 | #endif |
| 1321 | 1322 | ||
diff --git a/keyboards/kbdfans/kbd67/rev2/keymaps/tucznak/keymap.c b/keyboards/kbdfans/kbd67/rev2/keymaps/tucznak/keymap.c index 682f15c445..88fe681f14 100644 --- a/keyboards/kbdfans/kbd67/rev2/keymaps/tucznak/keymap.c +++ b/keyboards/kbdfans/kbd67/rev2/keymaps/tucznak/keymap.c | |||
| @@ -69,22 +69,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 69 | _______, _______, _______, _______, _______, _______, _______, _______, XXXXXXX, _______, _______, _______), | 69 | _______, _______, _______, _______, _______, _______, _______, _______, XXXXXXX, _______, _______, _______), |
| 70 | }; | 70 | }; |
| 71 | 71 | ||
| 72 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 72 | bool led_update_user(led_t led_state) { |
| 73 | return true; | 73 | if (led_state.caps_lock) { |
| 74 | } | ||
| 75 | |||
| 76 | void matrix_init_user(void) { | ||
| 77 | |||
| 78 | } | ||
| 79 | |||
| 80 | void matrix_scan_user(void) { | ||
| 81 | |||
| 82 | } | ||
| 83 | |||
| 84 | void led_set_user(uint8_t usb_led) { | ||
| 85 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) { | ||
| 86 | rgblight_enable_noeeprom(); | 74 | rgblight_enable_noeeprom(); |
| 87 | } else { | 75 | } else { |
| 88 | rgblight_disable_noeeprom(); | 76 | rgblight_disable_noeeprom(); |
| 89 | } | 77 | } |
| 78 | return false; | ||
| 90 | } | 79 | } |
diff --git a/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c b/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c index 8f2305ed4c..a8a369a611 100644 --- a/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c +++ b/keyboards/kbdfans/kbd6x/keymaps/konstantin/keymap.c | |||
| @@ -43,8 +43,8 @@ static void check_light_layer(layer_state_t state) { | |||
| 43 | last_checked_layer = true; | 43 | last_checked_layer = true; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | static void check_light_led(uint8_t leds) { | 46 | static void check_light_led(led_t led_state) { |
| 47 | if (IS_LED_ON(leds, USB_LED_CAPS_LOCK)) { | 47 | if (led_state.caps_lock) { |
| 48 | caps_light(); | 48 | caps_light(); |
| 49 | } else if (IS_LAYER_ON(L_FN)) { | 49 | } else if (IS_LAYER_ON(L_FN)) { |
| 50 | fn_light(); | 50 | fn_light(); |
| @@ -57,7 +57,7 @@ static void check_light_led(uint8_t leds) { | |||
| 57 | static void inline check_light(void) { | 57 | static void inline check_light(void) { |
| 58 | last_checked_layer | 58 | last_checked_layer |
| 59 | ? check_light_layer(layer_state) | 59 | ? check_light_layer(layer_state) |
| 60 | : check_light_led(host_keyboard_leds()); | 60 | : check_light_led(host_keyboard_led_state()); |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | void eeconfig_init_keymap(void) { | 63 | void eeconfig_init_keymap(void) { |
diff --git a/keyboards/kbdfans/kbd75/keymaps/tucznak/keymap.c b/keyboards/kbdfans/kbd75/keymaps/tucznak/keymap.c index 88272e3c72..c7f05a4e94 100644 --- a/keyboards/kbdfans/kbd75/keymaps/tucznak/keymap.c +++ b/keyboards/kbdfans/kbd75/keymaps/tucznak/keymap.c | |||
| @@ -79,11 +79,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 79 | return true; | 79 | return true; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | void led_set_user(uint8_t usb_led) { | 82 | bool led_update_user(led_t led_state) { |
| 83 | if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { | 83 | if (led_state.caps_lock) { |
| 84 | setPinOutput(B2); | 84 | setPinOutput(B2); |
| 85 | writePinLow(B2); | 85 | writePinLow(B2); |
| 86 | } else { | 86 | } else { |
| 87 | setPinInput(B2); | 87 | setPinInput(B2); |
| 88 | } | 88 | } |
| 89 | return false; | ||
| 89 | } | 90 | } |
diff --git a/keyboards/keebio/bfo9000/keymaps/abstractkb/keymap.c b/keyboards/keebio/bfo9000/keymaps/abstractkb/keymap.c index 4af086df3a..637a7e0440 100644 --- a/keyboards/keebio/bfo9000/keymaps/abstractkb/keymap.c +++ b/keyboards/keebio/bfo9000/keymaps/abstractkb/keymap.c | |||
| @@ -56,12 +56,13 @@ layer_state_t layer_state_set_user(layer_state_t state) { | |||
| 56 | return state; | 56 | return state; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | void led_set_user(uint8_t usb_led) { | 59 | bool led_update_user(led_t led_state) { |
| 60 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) { | 60 | if (led_state.caps_lock) { |
| 61 | rgblight_mode_noeeprom(RGBLIGHT_MODE_ALTERNATING); | 61 | rgblight_mode_noeeprom(RGBLIGHT_MODE_ALTERNATING); |
| 62 | } else { | 62 | } else { |
| 63 | layer_state_set_user(layer_state); | 63 | layer_state_set_user(layer_state); |
| 64 | } | 64 | } |
| 65 | return false; | ||
| 65 | } | 66 | } |
| 66 | 67 | ||
| 67 | void myrgb_toggle(void) { | 68 | void myrgb_toggle(void) { |
diff --git a/keyboards/kmini/keymaps/default/keymap.c b/keyboards/kmini/keymaps/default/keymap.c index c3a7b12a40..1f041daffc 100755 --- a/keyboards/kmini/keymaps/default/keymap.c +++ b/keyboards/kmini/keymaps/default/keymap.c | |||
| @@ -39,10 +39,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 39 | ), | 39 | ), |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | void led_set_user(uint8_t usb_led) { | 42 | bool led_update_user(led_t led_state) { |
| 43 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) { | 43 | if (led_state.caps_lock) { |
| 44 | writePinLow(B1); | 44 | writePinLow(B1); |
| 45 | } else { | 45 | } else { |
| 46 | writePinHigh(B1); | 46 | writePinHigh(B1); |
| 47 | } | 47 | } |
| 48 | return false; | ||
| 48 | } | 49 | } |
diff --git a/keyboards/kprepublic/bm40hsrgb/keymaps/signynt/keymap.c b/keyboards/kprepublic/bm40hsrgb/keymaps/signynt/keymap.c index 5a1d366f56..eb20a1a25b 100644 --- a/keyboards/kprepublic/bm40hsrgb/keymaps/signynt/keymap.c +++ b/keyboards/kprepublic/bm40hsrgb/keymaps/signynt/keymap.c | |||
| @@ -165,7 +165,7 @@ if(IS_LAYER_ON(NSSL)) { | |||
| 165 | 165 | ||
| 166 | //capslock leds | 166 | //capslock leds |
| 167 | 167 | ||
| 168 | if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) { | 168 | if (host_keyboard_led_state().caps_lock) { |
| 169 | rgb_matrix_set_color_all(50, 15.6, 0); | 169 | rgb_matrix_set_color_all(50, 15.6, 0); |
| 170 | } | 170 | } |
| 171 | 171 | ||
diff --git a/keyboards/kprepublic/jj50/keymaps/abstractkb/keymap.c b/keyboards/kprepublic/jj50/keymaps/abstractkb/keymap.c index 21f8fcbb0f..f02f27005b 100644 --- a/keyboards/kprepublic/jj50/keymaps/abstractkb/keymap.c +++ b/keyboards/kprepublic/jj50/keymaps/abstractkb/keymap.c | |||
| @@ -64,12 +64,13 @@ layer_state_t layer_state_set_user(layer_state_t state) { | |||
| 64 | return state; | 64 | return state; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | void led_set_user(uint8_t usb_led) { | 67 | bool led_update_user(led_t led_state) { |
| 68 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) { | 68 | if (led_state.caps_lock) { |
| 69 | rgblight_mode_noeeprom(RGBLIGHT_MODE_ALTERNATING); | 69 | rgblight_mode_noeeprom(RGBLIGHT_MODE_ALTERNATING); |
| 70 | } else { | 70 | } else { |
| 71 | layer_state_set_user(layer_state); | 71 | layer_state_set_user(layer_state); |
| 72 | } | 72 | } |
| 73 | return false; | ||
| 73 | } | 74 | } |
| 74 | 75 | ||
| 75 | void myrgb_toggle(void) { | 76 | void myrgb_toggle(void) { |
diff --git a/keyboards/kprepublic/jj50/keymaps/abstractkb_gergomatch/keymap.c b/keyboards/kprepublic/jj50/keymaps/abstractkb_gergomatch/keymap.c index 5292d99b5a..888e43e7dd 100644 --- a/keyboards/kprepublic/jj50/keymaps/abstractkb_gergomatch/keymap.c +++ b/keyboards/kprepublic/jj50/keymaps/abstractkb_gergomatch/keymap.c | |||
| @@ -64,12 +64,13 @@ layer_state_t layer_state_set_user(layer_state_t state) { | |||
| 64 | return state; | 64 | return state; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | void led_set_user(uint8_t usb_led) { | 67 | bool led_update_user(led_t led_state) { |
| 68 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) { | 68 | if (led_state.caps_lock) { |
| 69 | rgblight_mode_noeeprom(RGBLIGHT_MODE_ALTERNATING); | 69 | rgblight_mode_noeeprom(RGBLIGHT_MODE_ALTERNATING); |
| 70 | } else { | 70 | } else { |
| 71 | layer_state_set_user(layer_state); | 71 | layer_state_set_user(layer_state); |
| 72 | } | 72 | } |
| 73 | return false; | ||
| 73 | } | 74 | } |
| 74 | 75 | ||
| 75 | void myrgb_toggle(void) { | 76 | void myrgb_toggle(void) { |
diff --git a/keyboards/lazydesigners/dimple/staggered/keymaps/tominabox1/keymap.c b/keyboards/lazydesigners/dimple/staggered/keymaps/tominabox1/keymap.c index cdaade987f..d1917e4aa7 100644 --- a/keyboards/lazydesigners/dimple/staggered/keymaps/tominabox1/keymap.c +++ b/keyboards/lazydesigners/dimple/staggered/keymaps/tominabox1/keymap.c | |||
| @@ -100,10 +100,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 100 | ), | 100 | ), |
| 101 | }; | 101 | }; |
| 102 | 102 | ||
| 103 | void led_set_user(uint8_t usb_led) { | 103 | bool led_update_user(led_t led_state) { |
| 104 | if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { | 104 | if (led_state.caps_lock) { |
| 105 | writePinLow(E6); | 105 | writePinLow(E6); |
| 106 | } else { | 106 | } else { |
| 107 | writePinHigh(E6); | 107 | writePinHigh(E6); |
| 108 | } | 108 | } |
| 109 | return false; | ||
| 109 | } | 110 | } |
diff --git a/keyboards/lazydesigners/the50/keymaps/default/keymap.c b/keyboards/lazydesigners/the50/keymaps/default/keymap.c index 5d8ea732f6..61e6ee878c 100644 --- a/keyboards/lazydesigners/the50/keymaps/default/keymap.c +++ b/keyboards/lazydesigners/the50/keymaps/default/keymap.c | |||
| @@ -49,11 +49,12 @@ EE_CLR, _______, _______, _______, _______, | |||
| 49 | ) | 49 | ) |
| 50 | }; | 50 | }; |
| 51 | 51 | ||
| 52 | void led_set_user(uint8_t usb_led) { | 52 | bool led_update_user(led_t led_state) { |
| 53 | // Turn LED On/Off for Caps Lock | 53 | // Turn LED On/Off for Caps Lock |
| 54 | if (host_keyboard_leds() & (1 << USB_LED_CAPS_LOCK)) { | 54 | if (led_state.caps_lock) { |
| 55 | the50_led_on(); | 55 | the50_led_on(); |
| 56 | } else { | 56 | } else { |
| 57 | the50_led_off(); | 57 | the50_led_off(); |
| 58 | } | 58 | } |
| 59 | return false; | ||
| 59 | } | 60 | } |
diff --git a/keyboards/lazydesigners/the50/keymaps/mikethetiger/keymap.c b/keyboards/lazydesigners/the50/keymaps/mikethetiger/keymap.c index 8986fd6c3d..c384c3c520 100644 --- a/keyboards/lazydesigners/the50/keymaps/mikethetiger/keymap.c +++ b/keyboards/lazydesigners/the50/keymaps/mikethetiger/keymap.c | |||
| @@ -69,11 +69,12 @@ EE_CLR, _______, _______, _______, _______, | |||
| 69 | ) | 69 | ) |
| 70 | }; | 70 | }; |
| 71 | 71 | ||
| 72 | void led_set_user(uint8_t usb_led) { | 72 | bool led_update_user(led_t led_state) { |
| 73 | // Turn LED On/Off for Caps Lock | 73 | // Turn LED On/Off for Caps Lock |
| 74 | if (host_keyboard_leds() & (1 << USB_LED_CAPS_LOCK)) { | 74 | if (led_state.caps_lock) { |
| 75 | the50_led_on(); | 75 | the50_led_on(); |
| 76 | } else { | 76 | } else { |
| 77 | the50_led_off(); | 77 | the50_led_off(); |
| 78 | } | 78 | } |
| 79 | return false; | ||
| 79 | } | 80 | } |
diff --git a/keyboards/noxary/268/keymaps/ansi/keymap.c b/keyboards/noxary/268/keymaps/ansi/keymap.c index dac8e6c0dd..860d17177c 100644 --- a/keyboards/noxary/268/keymaps/ansi/keymap.c +++ b/keyboards/noxary/268/keymaps/ansi/keymap.c | |||
| @@ -52,12 +52,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 52 | 52 | ||
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | void led_set_user(uint8_t usb_led) { | 55 | bool led_update_user(led_t led_state) { |
| 56 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) { | 56 | if (led_state.caps_lock) { |
| 57 | setPinOutput(B6); | 57 | setPinOutput(B6); |
| 58 | writePinHigh(B6); | 58 | writePinHigh(B6); |
| 59 | } else { | 59 | } else { |
| 60 | setPinInput(B6); | 60 | setPinInput(B6); |
| 61 | writePinLow(B6); | 61 | writePinLow(B6); |
| 62 | } | 62 | } |
| 63 | return false; | ||
| 63 | } | 64 | } |
diff --git a/keyboards/noxary/268/keymaps/default/keymap.c b/keyboards/noxary/268/keymaps/default/keymap.c index 571396f21d..9023c6f81f 100644 --- a/keyboards/noxary/268/keymaps/default/keymap.c +++ b/keyboards/noxary/268/keymaps/default/keymap.c | |||
| @@ -70,8 +70,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 70 | 70 | ||
| 71 | }; | 71 | }; |
| 72 | 72 | ||
| 73 | void led_set_user(uint8_t usb_led) { | 73 | bool led_update_user(led_t led_state) { |
| 74 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) { | 74 | if (led_state.caps_lock) { |
| 75 | setPinOutput(B6); | 75 | setPinOutput(B6); |
| 76 | writePinHigh(B6); | 76 | writePinHigh(B6); |
| 77 | } | 77 | } |
| @@ -79,4 +79,5 @@ void led_set_user(uint8_t usb_led) { | |||
| 79 | setPinInput(B6); | 79 | setPinInput(B6); |
| 80 | writePinLow(B6); | 80 | writePinLow(B6); |
| 81 | } | 81 | } |
| 82 | return false; | ||
| 82 | } | 83 | } |
diff --git a/keyboards/noxary/268/keymaps/iso/keymap.c b/keyboards/noxary/268/keymaps/iso/keymap.c index 410883dd54..76462bf7fe 100644 --- a/keyboards/noxary/268/keymaps/iso/keymap.c +++ b/keyboards/noxary/268/keymaps/iso/keymap.c | |||
| @@ -52,12 +52,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 52 | 52 | ||
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | void led_set_user(uint8_t usb_led) { | 55 | bool led_update_user(led_t led_state) { |
| 56 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) { | 56 | if (led_state.caps_lock) { |
| 57 | setPinOutput(B6); | 57 | setPinOutput(B6); |
| 58 | writePinHigh(B6); | 58 | writePinHigh(B6); |
| 59 | } else { | 59 | } else { |
| 60 | setPinInput(B6); | 60 | setPinInput(B6); |
| 61 | writePinLow(B6); | 61 | writePinLow(B6); |
| 62 | } | 62 | } |
| 63 | return false; | ||
| 63 | } | 64 | } |
diff --git a/keyboards/noxary/268/keymaps/sixtyeight/keymap.c b/keyboards/noxary/268/keymaps/sixtyeight/keymap.c index 8e78994017..3527cf7ccc 100644 --- a/keyboards/noxary/268/keymaps/sixtyeight/keymap.c +++ b/keyboards/noxary/268/keymaps/sixtyeight/keymap.c | |||
| @@ -70,11 +70,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 70 | 70 | ||
| 71 | }; | 71 | }; |
| 72 | 72 | ||
| 73 | void led_set_user(uint8_t usb_led) { | 73 | bool led_update_user(led_t led_state) { |
| 74 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) { | 74 | if (led_state.caps_lock) { |
| 75 | DDRB |= (1 << 6); PORTB |= (1 << 6); | 75 | DDRB |= (1 << 6); PORTB |= (1 << 6); |
| 76 | } | 76 | } |
| 77 | else { | 77 | else { |
| 78 | DDRB &= ~(1 << 6); PORTB &= ~(1 << 6); | 78 | DDRB &= ~(1 << 6); PORTB &= ~(1 << 6); |
| 79 | } | 79 | } |
| 80 | return false; | ||
| 80 | } | 81 | } |
diff --git a/keyboards/owlab/spring/spring.c b/keyboards/owlab/spring/spring.c index 8088fb03c2..13280ff9b3 100644 --- a/keyboards/owlab/spring/spring.c +++ b/keyboards/owlab/spring/spring.c | |||
| @@ -108,7 +108,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | |||
| 108 | 108 | ||
| 109 | 109 | ||
| 110 | case KC_CAPS: | 110 | case KC_CAPS: |
| 111 | if(IS_LED_ON(host_keyboard_leds(), USB_LED_CAPS_LOCK)){ | 111 | if(host_keyboard_led_state().caps_lock){ |
| 112 | caps_mode_index = CAPS_MODE_LOWER; | 112 | caps_mode_index = CAPS_MODE_LOWER; |
| 113 | } else{ | 113 | } else{ |
| 114 | caps_mode_index = CAPS_MODE_UPPER; | 114 | caps_mode_index = CAPS_MODE_UPPER; |
diff --git a/keyboards/percent/canoe/keymaps/boy_314/keymap.c b/keyboards/percent/canoe/keymaps/boy_314/keymap.c index e9c56ed1b1..cccfd448a0 100644 --- a/keyboards/percent/canoe/keymaps/boy_314/keymap.c +++ b/keyboards/percent/canoe/keymaps/boy_314/keymap.c | |||
| @@ -47,10 +47,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 47 | 47 | ||
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | void led_set_user(uint8_t usb_led) { | 50 | bool led_update_user(led_t led_state) { |
| 51 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) { | 51 | if (led_state.caps_lock) { |
| 52 | rgblight_sethsv(HSV_RED); | 52 | rgblight_sethsv(HSV_RED); |
| 53 | } else { | 53 | } else { |
| 54 | rgblight_sethsv(HSV_TURQUOISE); | 54 | rgblight_sethsv(HSV_TURQUOISE); |
| 55 | } | 55 | } |
| 56 | return false; | ||
| 56 | } \ No newline at end of file | 57 | } \ No newline at end of file |
diff --git a/keyboards/planck/keymaps/altgr/common/init.h b/keyboards/planck/keymaps/altgr/common/init.h index 6366a19f65..6d0b4392fb 100644 --- a/keyboards/planck/keymaps/altgr/common/init.h +++ b/keyboards/planck/keymaps/altgr/common/init.h | |||
| @@ -13,21 +13,22 @@ void matrix_init_user(void) | |||
| 13 | 13 | ||
| 14 | #ifdef AUDIO_ENABLE | 14 | #ifdef AUDIO_ENABLE |
| 15 | #ifdef BACKLIGHT_ENABLE | 15 | #ifdef BACKLIGHT_ENABLE |
| 16 | void led_set_user(uint8_t usb_led) | 16 | bool led_update_user(led_t led_state) |
| 17 | { | 17 | { |
| 18 | static uint8_t old_usb_led = 0; | 18 | static led_t old_led_state = {0}; |
| 19 | _delay_ms(10); // gets rid of tick | 19 | _delay_ms(10); // gets rid of tick |
| 20 | if (!is_playing_notes()) { | 20 | if (!is_playing_notes()) { |
| 21 | if ((usb_led & (1<<USB_LED_CAPS_LOCK)) && !(old_usb_led & (1<<USB_LED_CAPS_LOCK))) { | 21 | if (led_state.caps_lock && !old_led_state.caps_lock) { |
| 22 | // if capslock LED is turning on | 22 | // if capslock LED is turning on |
| 23 | PLAY_SONG(song_caps_on); | 23 | PLAY_SONG(song_caps_on); |
| 24 | } | 24 | } |
| 25 | else if (!(usb_led & (1<<USB_LED_CAPS_LOCK)) && (old_usb_led & (1<<USB_LED_CAPS_LOCK))) { | 25 | else if (!led_state.caps_lock && old_led_state.caps_lock) { |
| 26 | // if capslock LED is turning off | 26 | // if capslock LED is turning off |
| 27 | PLAY_SONG(song_caps_off); | 27 | PLAY_SONG(song_caps_off); |
| 28 | } | 28 | } |
| 29 | } | 29 | } |
| 30 | old_usb_led = usb_led; | 30 | old_led_state = led_state; |
| 31 | return false; | ||
| 31 | } | 32 | } |
| 32 | #endif | 33 | #endif |
| 33 | 34 | ||
diff --git a/keyboards/planck/keymaps/hiea/common/init.h b/keyboards/planck/keymaps/hiea/common/init.h index 6366a19f65..6d0b4392fb 100644 --- a/keyboards/planck/keymaps/hiea/common/init.h +++ b/keyboards/planck/keymaps/hiea/common/init.h | |||
| @@ -13,21 +13,22 @@ void matrix_init_user(void) | |||
| 13 | 13 | ||
| 14 | #ifdef AUDIO_ENABLE | 14 | #ifdef AUDIO_ENABLE |
| 15 | #ifdef BACKLIGHT_ENABLE | 15 | #ifdef BACKLIGHT_ENABLE |
| 16 | void led_set_user(uint8_t usb_led) | 16 | bool led_update_user(led_t led_state) |
| 17 | { | 17 | { |
| 18 | static uint8_t old_usb_led = 0; | 18 | static led_t old_led_state = {0}; |
| 19 | _delay_ms(10); // gets rid of tick | 19 | _delay_ms(10); // gets rid of tick |
| 20 | if (!is_playing_notes()) { | 20 | if (!is_playing_notes()) { |
| 21 | if ((usb_led & (1<<USB_LED_CAPS_LOCK)) && !(old_usb_led & (1<<USB_LED_CAPS_LOCK))) { | 21 | if (led_state.caps_lock && !old_led_state.caps_lock) { |
| 22 | // if capslock LED is turning on | 22 | // if capslock LED is turning on |
| 23 | PLAY_SONG(song_caps_on); | 23 | PLAY_SONG(song_caps_on); |
| 24 | } | 24 | } |
| 25 | else if (!(usb_led & (1<<USB_LED_CAPS_LOCK)) && (old_usb_led & (1<<USB_LED_CAPS_LOCK))) { | 25 | else if (!led_state.caps_lock && old_led_state.caps_lock) { |
| 26 | // if capslock LED is turning off | 26 | // if capslock LED is turning off |
| 27 | PLAY_SONG(song_caps_off); | 27 | PLAY_SONG(song_caps_off); |
| 28 | } | 28 | } |
| 29 | } | 29 | } |
| 30 | old_usb_led = usb_led; | 30 | old_led_state = led_state; |
| 31 | return false; | ||
| 31 | } | 32 | } |
| 32 | #endif | 33 | #endif |
| 33 | 34 | ||
diff --git a/keyboards/planck/keymaps/hieax/common/init.h b/keyboards/planck/keymaps/hieax/common/init.h index 6366a19f65..6d0b4392fb 100644 --- a/keyboards/planck/keymaps/hieax/common/init.h +++ b/keyboards/planck/keymaps/hieax/common/init.h | |||
| @@ -13,21 +13,22 @@ void matrix_init_user(void) | |||
| 13 | 13 | ||
| 14 | #ifdef AUDIO_ENABLE | 14 | #ifdef AUDIO_ENABLE |
| 15 | #ifdef BACKLIGHT_ENABLE | 15 | #ifdef BACKLIGHT_ENABLE |
| 16 | void led_set_user(uint8_t usb_led) | 16 | bool led_update_user(led_t led_state) |
| 17 | { | 17 | { |
| 18 | static uint8_t old_usb_led = 0; | 18 | static led_t old_led_state = {0}; |
| 19 | _delay_ms(10); // gets rid of tick | 19 | _delay_ms(10); // gets rid of tick |
| 20 | if (!is_playing_notes()) { | 20 | if (!is_playing_notes()) { |
| 21 | if ((usb_led & (1<<USB_LED_CAPS_LOCK)) && !(old_usb_led & (1<<USB_LED_CAPS_LOCK))) { | 21 | if (led_state.caps_lock && !old_led_state.caps_lock) { |
| 22 | // if capslock LED is turning on | 22 | // if capslock LED is turning on |
| 23 | PLAY_SONG(song_caps_on); | 23 | PLAY_SONG(song_caps_on); |
| 24 | } | 24 | } |
| 25 | else if (!(usb_led & (1<<USB_LED_CAPS_LOCK)) && (old_usb_led & (1<<USB_LED_CAPS_LOCK))) { | 25 | else if (!led_state.caps_lock && old_led_state.caps_lock) { |
| 26 | // if capslock LED is turning off | 26 | // if capslock LED is turning off |
| 27 | PLAY_SONG(song_caps_off); | 27 | PLAY_SONG(song_caps_off); |
| 28 | } | 28 | } |
| 29 | } | 29 | } |
| 30 | old_usb_led = usb_led; | 30 | old_led_state = led_state; |
| 31 | return false; | ||
| 31 | } | 32 | } |
| 32 | #endif | 33 | #endif |
| 33 | 34 | ||
diff --git a/keyboards/planck/keymaps/rootiest/keymap.c b/keyboards/planck/keymaps/rootiest/keymap.c index 7e3b8af367..d6e8c7ef0f 100644 --- a/keyboards/planck/keymaps/rootiest/keymap.c +++ b/keyboards/planck/keymaps/rootiest/keymap.c | |||
| @@ -1527,7 +1527,7 @@ void scap_finished(tap_dance_state_t* state, void* user_data) { | |||
| 1527 | register_code(KC_LSFT); | 1527 | register_code(KC_LSFT); |
| 1528 | break; | 1528 | break; |
| 1529 | default: | 1529 | default: |
| 1530 | if (host_keyboard_leds() & (1 << USB_LED_CAPS_LOCK)) { | 1530 | if (host_keyboard_led_state().caps_lock) { |
| 1531 | tap_code(KC_CAPS); | 1531 | tap_code(KC_CAPS); |
| 1532 | reset_tap_dance(state); | 1532 | reset_tap_dance(state); |
| 1533 | break; | 1533 | break; |
diff --git a/keyboards/planck/keymaps/sdothum/common/init.h b/keyboards/planck/keymaps/sdothum/common/init.h index 6366a19f65..6d0b4392fb 100644 --- a/keyboards/planck/keymaps/sdothum/common/init.h +++ b/keyboards/planck/keymaps/sdothum/common/init.h | |||
| @@ -13,21 +13,22 @@ void matrix_init_user(void) | |||
| 13 | 13 | ||
| 14 | #ifdef AUDIO_ENABLE | 14 | #ifdef AUDIO_ENABLE |
| 15 | #ifdef BACKLIGHT_ENABLE | 15 | #ifdef BACKLIGHT_ENABLE |
| 16 | void led_set_user(uint8_t usb_led) | 16 | bool led_update_user(led_t led_state) |
| 17 | { | 17 | { |
| 18 | static uint8_t old_usb_led = 0; | 18 | static led_t old_led_state = {0}; |
| 19 | _delay_ms(10); // gets rid of tick | 19 | _delay_ms(10); // gets rid of tick |
| 20 | if (!is_playing_notes()) { | 20 | if (!is_playing_notes()) { |
| 21 | if ((usb_led & (1<<USB_LED_CAPS_LOCK)) && !(old_usb_led & (1<<USB_LED_CAPS_LOCK))) { | 21 | if (led_state.caps_lock && !old_led_state.caps_lock) { |
| 22 | // if capslock LED is turning on | 22 | // if capslock LED is turning on |
| 23 | PLAY_SONG(song_caps_on); | 23 | PLAY_SONG(song_caps_on); |
| 24 | } | 24 | } |
| 25 | else if (!(usb_led & (1<<USB_LED_CAPS_LOCK)) && (old_usb_led & (1<<USB_LED_CAPS_LOCK))) { | 25 | else if (!led_state.caps_lock && old_led_state.caps_lock) { |
| 26 | // if capslock LED is turning off | 26 | // if capslock LED is turning off |
| 27 | PLAY_SONG(song_caps_off); | 27 | PLAY_SONG(song_caps_off); |
| 28 | } | 28 | } |
| 29 | } | 29 | } |
| 30 | old_usb_led = usb_led; | 30 | old_led_state = led_state; |
| 31 | return false; | ||
| 31 | } | 32 | } |
| 32 | #endif | 33 | #endif |
| 33 | 34 | ||
diff --git a/keyboards/playkbtw/ca66/keymaps/olivia/keymap.c b/keyboards/playkbtw/ca66/keymaps/olivia/keymap.c index 9b441a8892..8ef6c0499d 100644 --- a/keyboards/playkbtw/ca66/keymaps/olivia/keymap.c +++ b/keyboards/playkbtw/ca66/keymaps/olivia/keymap.c | |||
| @@ -17,20 +17,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 17 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | 17 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), |
| 18 | }; | 18 | }; |
| 19 | 19 | ||
| 20 | void matrix_init_user(void) { | 20 | bool led_update_user(led_t led_state) { |
| 21 | } | 21 | if (led_state.caps_lock) { |
| 22 | |||
| 23 | void matrix_scan_user(void) { | ||
| 24 | } | ||
| 25 | |||
| 26 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 27 | return true; | ||
| 28 | } | ||
| 29 | |||
| 30 | void led_set_user(uint8_t usb_led) { | ||
| 31 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) { | ||
| 32 | DDRD |= (1 << 1); PORTD &= ~(1 << 1); | 22 | DDRD |= (1 << 1); PORTD &= ~(1 << 1); |
| 33 | } else { | 23 | } else { |
| 34 | DDRD &= ~(1 << 1); PORTD &= ~(1 << 1); | 24 | DDRD &= ~(1 << 1); PORTD &= ~(1 << 1); |
| 35 | } | 25 | } |
| 26 | return false; | ||
| 36 | } | 27 | } |
diff --git a/keyboards/playkbtw/pk60/keymaps/default/keymap.c b/keyboards/playkbtw/pk60/keymaps/default/keymap.c index 65d3996a85..cc0276673a 100644 --- a/keyboards/playkbtw/pk60/keymaps/default/keymap.c +++ b/keyboards/playkbtw/pk60/keymaps/default/keymap.c | |||
| @@ -20,12 +20,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 20 | 20 | ||
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | void led_set_user(uint8_t usb_led) { | 23 | bool led_update_user(led_t led_state) { |
| 24 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) { | 24 | if (led_state.caps_lock) { |
| 25 | setPinOutput(F4); | 25 | setPinOutput(F4); |
| 26 | writePinLow(F4); | 26 | writePinLow(F4); |
| 27 | } else { | 27 | } else { |
| 28 | setPinInput(F4); | 28 | setPinInput(F4); |
| 29 | writePinLow(F4); | 29 | writePinLow(F4); |
| 30 | } | 30 | } |
| 31 | return false; | ||
| 31 | } | 32 | } |
diff --git a/keyboards/primekb/prime_e/keymaps/jetpacktuxedo/keymap.c b/keyboards/primekb/prime_e/keymaps/jetpacktuxedo/keymap.c index cdd1b56430..a45a841285 100644 --- a/keyboards/primekb/prime_e/keymaps/jetpacktuxedo/keymap.c +++ b/keyboards/primekb/prime_e/keymaps/jetpacktuxedo/keymap.c | |||
| @@ -100,13 +100,14 @@ layer_state_t layer_state_set_user(layer_state_t state) { | |||
| 100 | return state; | 100 | return state; |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | void led_set_user(uint8_t usb_led) { | 103 | bool led_update_user(led_t led_state) { |
| 104 | if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { | 104 | if (led_state.caps_lock) { |
| 105 | CAPS = 1; | 105 | CAPS = 1; |
| 106 | } | 106 | } |
| 107 | else { | 107 | else { |
| 108 | CAPS = 0; | 108 | CAPS = 0; |
| 109 | } | 109 | } |
| 110 | return false; | ||
| 110 | } | 111 | } |
| 111 | 112 | ||
| 112 | void togg_indicator(uint8_t *state, uint8_t pin) { | 113 | void togg_indicator(uint8_t *state, uint8_t pin) { |
diff --git a/keyboards/primekb/prime_e/keymaps/madhatter/keymap.c b/keyboards/primekb/prime_e/keymaps/madhatter/keymap.c index f3228ec0d5..998046c6d7 100644 --- a/keyboards/primekb/prime_e/keymaps/madhatter/keymap.c +++ b/keyboards/primekb/prime_e/keymaps/madhatter/keymap.c | |||
| @@ -91,8 +91,9 @@ layer_state_t layer_state_set_user(layer_state_t state) { | |||
| 91 | return state; | 91 | return state; |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | void led_set_user(uint8_t usb_led) { | 94 | bool led_update_user(led_t led_state) { |
| 95 | CAPS = IS_LED_ON(usb_led, USB_LED_CAPS_LOCK); | 95 | CAPS = led_state.caps_lock; |
| 96 | return false; | ||
| 96 | } | 97 | } |
| 97 | 98 | ||
| 98 | void togg_indicator(uint8_t *state, uint8_t pin) { | 99 | void togg_indicator(uint8_t *state, uint8_t pin) { |
diff --git a/keyboards/shoc/keymaps/bongo/keymap.c b/keyboards/shoc/keymaps/bongo/keymap.c index 14779f1d75..8f57181330 100644 --- a/keyboards/shoc/keymaps/bongo/keymap.c +++ b/keyboards/shoc/keymaps/bongo/keymap.c | |||
| @@ -163,7 +163,7 @@ bool oled_task_user(void) { | |||
| 163 | oled_set_cursor(0,6); | 163 | oled_set_cursor(0,6); |
| 164 | oled_write_P(PSTR(" WPM: "), false); | 164 | oled_write_P(PSTR(" WPM: "), false); |
| 165 | oled_write(get_u8_str(get_current_wpm(), '0'), false); | 165 | oled_write(get_u8_str(get_current_wpm(), '0'), false); |
| 166 | if(host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)){ | 166 | if(host_keyboard_led_state().caps_lock){ |
| 167 | oled_set_cursor(0,5); | 167 | oled_set_cursor(0,5); |
| 168 | oled_write_P(PSTR(" CAPS LOCK"), false); | 168 | oled_write_P(PSTR(" CAPS LOCK"), false); |
| 169 | } | 169 | } |
diff --git a/keyboards/thevankeyboards/bananasplit/keymaps/jockyxu1122_iso/keymap.c b/keyboards/thevankeyboards/bananasplit/keymaps/jockyxu1122_iso/keymap.c index 1472f88212..5146c8f4f3 100644 --- a/keyboards/thevankeyboards/bananasplit/keymaps/jockyxu1122_iso/keymap.c +++ b/keyboards/thevankeyboards/bananasplit/keymaps/jockyxu1122_iso/keymap.c | |||
| @@ -91,12 +91,13 @@ Capslock's led cannot be controlled separately on bananasplit and you can only t | |||
| 91 | leds at once. If you only install led for capslock, it will look like capslock has toggable | 91 | leds at once. If you only install led for capslock, it will look like capslock has toggable |
| 92 | backlight. | 92 | backlight. |
| 93 | */ | 93 | */ |
| 94 | void led_set_user(uint8_t usb_led) { | 94 | bool led_update_user(led_t led_state) { |
| 95 | if (usb_led && (1 << USB_LED_CAPS_LOCK)) { | 95 | if (led_state.caps_lock) { |
| 96 | DDRB |= (1 << 7); | 96 | DDRB |= (1 << 7); |
| 97 | PORTB |= (1 << 7); | 97 | PORTB |= (1 << 7); |
| 98 | } else { | 98 | } else { |
| 99 | DDRB &= ~(1 << 7); | 99 | DDRB &= ~(1 << 7); |
| 100 | PORTB &= ~(1 << 7); | 100 | PORTB &= ~(1 << 7); |
| 101 | } | 101 | } |
| 102 | return false; | ||
| 102 | } | 103 | } |
diff --git a/keyboards/uk78/keymaps/default/keymap.c b/keyboards/uk78/keymaps/default/keymap.c index 2fa09f7d6d..e4bdf90508 100644 --- a/keyboards/uk78/keymaps/default/keymap.c +++ b/keyboards/uk78/keymaps/default/keymap.c | |||
| @@ -75,12 +75,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 75 | 75 | ||
| 76 | }; | 76 | }; |
| 77 | 77 | ||
| 78 | void led_set_user(uint8_t usb_led) { | 78 | bool led_update_user(led_t led_state) { |
| 79 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) { | 79 | if (led_state.caps_lock) { |
| 80 | setPinOutput(A3); | 80 | setPinOutput(A3); |
| 81 | writePinHigh(A3); | 81 | writePinHigh(A3); |
| 82 | } else { | 82 | } else { |
| 83 | setPinInput(A3); | 83 | setPinInput(A3); |
| 84 | writePinLow(A3); | 84 | writePinLow(A3); |
| 85 | } | 85 | } |
| 86 | return false; | ||
| 86 | } | 87 | } |
diff --git a/keyboards/uk78/keymaps/rask/keymap.c b/keyboards/uk78/keymaps/rask/keymap.c index eaf8c117a2..01220a775e 100644 --- a/keyboards/uk78/keymaps/rask/keymap.c +++ b/keyboards/uk78/keymaps/rask/keymap.c | |||
| @@ -74,10 +74,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 74 | 74 | ||
| 75 | }; | 75 | }; |
| 76 | 76 | ||
| 77 | void led_set_user(uint8_t usb_led) { | 77 | bool led_update_user(led_t led_state) { |
| 78 | if (usb_led & (1 << USB_LED_CAPS_LOCK)) { | 78 | if (led_state.caps_lock) { |
| 79 | DDRA |= (1 << 3); PORTA |= (1 << 3); | 79 | DDRA |= (1 << 3); PORTA |= (1 << 3); |
| 80 | } else { | 80 | } else { |
| 81 | DDRA &= ~(1 << 3); PORTA &= ~(1 << 3); | 81 | DDRA &= ~(1 << 3); PORTA &= ~(1 << 3); |
| 82 | } | 82 | } |
| 83 | return false; | ||
| 83 | } | 84 | } |
diff --git a/keyboards/v60_type_r/keymaps/followingghosts/keymap.c b/keyboards/v60_type_r/keymaps/followingghosts/keymap.c index ab1fbd70d9..419c9ad5a7 100644 --- a/keyboards/v60_type_r/keymaps/followingghosts/keymap.c +++ b/keyboards/v60_type_r/keymaps/followingghosts/keymap.c | |||
| @@ -95,8 +95,8 @@ WASD are Up Left Right Down respectively | |||
| 95 | 95 | ||
| 96 | }; | 96 | }; |
| 97 | 97 | ||
| 98 | void led_set_user(uint8_t usb_led) { | 98 | bool led_update_user(led_t led_state) { |
| 99 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) { | 99 | if (led_state.caps_lock) { |
| 100 | // output low | 100 | // output low |
| 101 | DDRE |= (1<<PE6); | 101 | DDRE |= (1<<PE6); |
| 102 | PORTE &= ~(1<<PE6); | 102 | PORTE &= ~(1<<PE6); |
| @@ -106,4 +106,5 @@ void led_set_user(uint8_t usb_led) { | |||
| 106 | DDRE &= ~(1<<PE6); | 106 | DDRE &= ~(1<<PE6); |
| 107 | PORTE &= ~(1<<PE6); | 107 | PORTE &= ~(1<<PE6); |
| 108 | } | 108 | } |
| 109 | return false; | ||
| 109 | } | 110 | } |
diff --git a/keyboards/v60_type_r/keymaps/vimouse/keymap.c b/keyboards/v60_type_r/keymaps/vimouse/keymap.c index f426a94044..2eb06c0503 100644 --- a/keyboards/v60_type_r/keymaps/vimouse/keymap.c +++ b/keyboards/v60_type_r/keymaps/vimouse/keymap.c | |||
| @@ -97,8 +97,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 97 | _____, _____, _____, _____, _____, _____, _____, _____), | 97 | _____, _____, _____, _____, _____, _____, _____, _____), |
| 98 | }; | 98 | }; |
| 99 | 99 | ||
| 100 | void led_set_user(uint8_t usb_led) { | 100 | bool led_update_user(led_t led_state) { |
| 101 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) { | 101 | if (led_state.caps_lock) { |
| 102 | // output low | 102 | // output low |
| 103 | DDRE |= (1<<PE6); | 103 | DDRE |= (1<<PE6); |
| 104 | PORTE &= ~(1<<PE6); | 104 | PORTE &= ~(1<<PE6); |
| @@ -108,4 +108,5 @@ void led_set_user(uint8_t usb_led) { | |||
| 108 | DDRE &= ~(1<<PE6); | 108 | DDRE &= ~(1<<PE6); |
| 109 | PORTE &= ~(1<<PE6); | 109 | PORTE &= ~(1<<PE6); |
| 110 | } | 110 | } |
| 111 | return false; | ||
| 111 | } | 112 | } |
diff --git a/keyboards/v60_type_r/keymaps/xtonhasvim/keymap.c b/keyboards/v60_type_r/keymaps/xtonhasvim/keymap.c index 98bfa70d2f..f2fd693ece 100644 --- a/keyboards/v60_type_r/keymaps/xtonhasvim/keymap.c +++ b/keyboards/v60_type_r/keymaps/xtonhasvim/keymap.c | |||
| @@ -69,8 +69,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 69 | }; | 69 | }; |
| 70 | 70 | ||
| 71 | 71 | ||
| 72 | void led_set_user(uint8_t usb_led) { | 72 | bool led_update_user(led_t led_state) { |
| 73 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) { | 73 | if (led_state.caps_lock) { |
| 74 | // output low | 74 | // output low |
| 75 | DDRE |= (1<<PE6); | 75 | DDRE |= (1<<PE6); |
| 76 | PORTE &= ~(1<<PE6); | 76 | PORTE &= ~(1<<PE6); |
| @@ -80,6 +80,7 @@ void led_set_user(uint8_t usb_led) { | |||
| 80 | DDRE &= ~(1<<PE6); | 80 | DDRE &= ~(1<<PE6); |
| 81 | PORTE &= ~(1<<PE6); | 81 | PORTE &= ~(1<<PE6); |
| 82 | } | 82 | } |
| 83 | return false; | ||
| 83 | } | 84 | } |
| 84 | 85 | ||
| 85 | #define C_RED 0xFF, 0x00, 0x00 | 86 | #define C_RED 0xFF, 0x00, 0x00 |
diff --git a/keyboards/work_louder/work_board/keymaps/drashna/keymap.c b/keyboards/work_louder/work_board/keymaps/drashna/keymap.c index 1747ab638e..2c20225742 100644 --- a/keyboards/work_louder/work_board/keymaps/drashna/keymap.c +++ b/keyboards/work_louder/work_board/keymaps/drashna/keymap.c | |||
| @@ -110,7 +110,7 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { | |||
| 110 | 110 | ||
| 111 | bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) { | 111 | bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) { |
| 112 | uint8_t this_mod = get_mods(); | 112 | uint8_t this_mod = get_mods(); |
| 113 | uint8_t this_led = host_keyboard_leds(); | 113 | led_t this_led = host_keyboard_led_state(); |
| 114 | uint8_t this_osm = get_oneshot_mods(); | 114 | uint8_t this_osm = get_oneshot_mods(); |
| 115 | #define THUMB_LED 6 | 115 | #define THUMB_LED 6 |
| 116 | #define RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(...) RGB_MATRIX_INDICATOR_SET_COLOR(__VA_ARGS__) | 116 | #define RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(...) RGB_MATRIX_INDICATOR_SET_COLOR(__VA_ARGS__) |
| @@ -134,7 +134,7 @@ bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) { | |||
| 134 | } | 134 | } |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1 << USB_LED_CAPS_LOCK)) { | 137 | if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led.caps_lock) { |
| 138 | if (!layer_state_is(_ADJUST)) { | 138 | if (!layer_state_is(_ADJUST)) { |
| 139 | RGB_MATRIX_INDICATOR_SET_COLOR(12, 0x00, 0xFF, 0x00); | 139 | RGB_MATRIX_INDICATOR_SET_COLOR(12, 0x00, 0xFF, 0x00); |
| 140 | RGB_MATRIX_INDICATOR_SET_COLOR(13, 0x00, 0xFF, 0x00); | 140 | RGB_MATRIX_INDICATOR_SET_COLOR(13, 0x00, 0xFF, 0x00); |
diff --git a/keyboards/xbows/woody/woody.c b/keyboards/xbows/woody/woody.c index 9757bde9c9..fa0ba7f768 100644 --- a/keyboards/xbows/woody/woody.c +++ b/keyboards/xbows/woody/woody.c | |||
| @@ -101,7 +101,7 @@ bool rgb_matrix_indicators_kb(void) { | |||
| 101 | if (!rgb_matrix_indicators_user()) { | 101 | if (!rgb_matrix_indicators_user()) { |
| 102 | return false; | 102 | return false; |
| 103 | } | 103 | } |
| 104 | if (IS_LED_ON(host_keyboard_leds(), USB_LED_CAPS_LOCK)) { | 104 | if (host_keyboard_led_state().caps_lock) { |
| 105 | rgb_matrix_set_color(30, 0xFF, 0x00, 0x00); | 105 | rgb_matrix_set_color(30, 0xFF, 0x00, 0x00); |
| 106 | } | 106 | } |
| 107 | return true; | 107 | return true; |
diff --git a/keyboards/xiudi/xd75/keymaps/bulbizarre/keymap.c b/keyboards/xiudi/xd75/keymaps/bulbizarre/keymap.c index 64add732ad..02dbe01f17 100644 --- a/keyboards/xiudi/xd75/keymaps/bulbizarre/keymap.c +++ b/keyboards/xiudi/xd75/keymaps/bulbizarre/keymap.c | |||
| @@ -130,16 +130,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 130 | return true; | 130 | return true; |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | void matrix_init_user(void) { | 133 | bool led_update_user(led_t led_state) { |
| 134 | 134 | if (led_state.caps_lock) { | |
| 135 | } | ||
| 136 | |||
| 137 | void matrix_scan_user(void) { | ||
| 138 | |||
| 139 | } | ||
| 140 | |||
| 141 | void led_set_user(uint8_t usb_led) { | ||
| 142 | if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { | ||
| 143 | capslock_led_on(); | 135 | capslock_led_on(); |
| 144 | } else { | 136 | } else { |
| 145 | capslock_led_off(); | 137 | capslock_led_off(); |
| @@ -149,4 +141,5 @@ void led_set_user(uint8_t usb_led) { | |||
| 149 | } else { | 141 | } else { |
| 150 | gp100_led_off(); | 142 | gp100_led_off(); |
| 151 | } | 143 | } |
| 144 | return false; | ||
| 152 | } | 145 | } |
diff --git a/layouts/community/60_ansi_arrow_split_bs_7u_spc/mrsendyyk/keymap.c b/layouts/community/60_ansi_arrow_split_bs_7u_spc/mrsendyyk/keymap.c index 3af6af5091..37e459893c 100644 --- a/layouts/community/60_ansi_arrow_split_bs_7u_spc/mrsendyyk/keymap.c +++ b/layouts/community/60_ansi_arrow_split_bs_7u_spc/mrsendyyk/keymap.c | |||
| @@ -109,9 +109,9 @@ void update_led(void) { | |||
| 109 | } | 109 | } |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | void led_set_user(uint8_t usb_led) { | 112 | bool led_update_user(led_t led_state) { |
| 113 | // Caps Lock Indicator | 113 | // Caps Lock Indicator |
| 114 | if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { | 114 | if (led_state.caps_lock) { |
| 115 | writePinLow(B2); | 115 | writePinLow(B2); |
| 116 | rgblight_setrgb(255, 110, 0); | 116 | rgblight_setrgb(255, 110, 0); |
| 117 | } | 117 | } |
| @@ -133,6 +133,7 @@ void led_set_user(uint8_t usb_led) { | |||
| 133 | } | 133 | } |
| 134 | update_led(); | 134 | update_led(); |
| 135 | } | 135 | } |
| 136 | return false; | ||
| 136 | } | 137 | } |
| 137 | 138 | ||
| 138 | layer_state_t layer_state_set_user(layer_state_t state) { | 139 | layer_state_t layer_state_set_user(layer_state_t state) { |
diff --git a/layouts/community/ergodox/colemak_code_friendly/keymap.c b/layouts/community/ergodox/colemak_code_friendly/keymap.c index ae5bdcc5b8..d9e3c9fa61 100644 --- a/layouts/community/ergodox/colemak_code_friendly/keymap.c +++ b/layouts/community/ergodox/colemak_code_friendly/keymap.c | |||
| @@ -310,9 +310,6 @@ void matrix_init_user(void) { | |||
| 310 | void matrix_scan_user(void) { | 310 | void matrix_scan_user(void) { |
| 311 | uint8_t layer = get_highest_layer(layer_state); | 311 | uint8_t layer = get_highest_layer(layer_state); |
| 312 | 312 | ||
| 313 | //led 1, RED, Caps-Lock ON | ||
| 314 | //if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ergodox_right_led_1_on(); | ||
| 315 | |||
| 316 | //led 2, GREEN | 313 | //led 2, GREEN |
| 317 | if (layer == LAYER_NUM) | 314 | if (layer == LAYER_NUM) |
| 318 | ergodox_right_led_2_on(); | 315 | ergodox_right_led_2_on(); |
| @@ -327,9 +324,10 @@ void matrix_scan_user(void) { | |||
| 327 | }; | 324 | }; |
| 328 | 325 | ||
| 329 | // Runs constantly in the background, in a loop. | 326 | // Runs constantly in the background, in a loop. |
| 330 | void led_set_user(uint8_t usb_led) { | 327 | bool led_update_user(led_t led_state) { |
| 331 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) | 328 | if (led_state.caps_lock) |
| 332 | ergodox_right_led_1_on(); | 329 | ergodox_right_led_1_on(); |
| 333 | else | 330 | else |
| 334 | ergodox_right_led_1_off(); | 331 | ergodox_right_led_1_off(); |
| 332 | return false; | ||
| 335 | } | 333 | } |
diff --git a/layouts/community/ergodox/drashna/keymap.c b/layouts/community/ergodox/drashna/keymap.c index 1853b70071..8d1449486a 100644 --- a/layouts/community/ergodox/drashna/keymap.c +++ b/layouts/community/ergodox/drashna/keymap.c | |||
| @@ -212,9 +212,9 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | |||
| 212 | 212 | ||
| 213 | void housekeeping_task_keymap(void) { // runs frequently to update info | 213 | void housekeeping_task_keymap(void) { // runs frequently to update info |
| 214 | #ifdef KEYBOARD_ergodox_ez | 214 | #ifdef KEYBOARD_ergodox_ez |
| 215 | uint8_t modifiers = get_mods(); | 215 | uint8_t modifiers = get_mods(); |
| 216 | uint8_t led_usb_state = host_keyboard_leds(); | 216 | led_t led_state = host_keyboard_led_state(); |
| 217 | uint8_t one_shot = get_oneshot_mods(); | 217 | uint8_t one_shot = get_oneshot_mods(); |
| 218 | 218 | ||
| 219 | if (!skip_leds) { | 219 | if (!skip_leds) { |
| 220 | ergodox_board_led_off(); | 220 | ergodox_board_led_off(); |
| @@ -225,7 +225,7 @@ void housekeeping_task_keymap(void) { // runs frequently to update info | |||
| 225 | // Since we're not using the LEDs here for layer indication anymore, | 225 | // Since we're not using the LEDs here for layer indication anymore, |
| 226 | // then lets use them for modifier indicators. Shame we don't have 4... | 226 | // then lets use them for modifier indicators. Shame we don't have 4... |
| 227 | // Also, no "else", since we want to know each, independently. | 227 | // Also, no "else", since we want to know each, independently. |
| 228 | if ((modifiers | one_shot) & MOD_MASK_SHIFT || led_usb_state & (1 << USB_LED_CAPS_LOCK)) { | 228 | if ((modifiers | one_shot) & MOD_MASK_SHIFT || led_state.caps_lock) { |
| 229 | ergodox_right_led_2_on(); | 229 | ergodox_right_led_2_on(); |
| 230 | ergodox_right_led_2_set(50); | 230 | ergodox_right_led_2_set(50); |
| 231 | } | 231 | } |
diff --git a/layouts/community/ergodox/jjerrell/keymap.c b/layouts/community/ergodox/jjerrell/keymap.c index 110a8aba63..48572d2de3 100644 --- a/layouts/community/ergodox/jjerrell/keymap.c +++ b/layouts/community/ergodox/jjerrell/keymap.c | |||
| @@ -94,12 +94,12 @@ layer_state_t layer_state_set_keymap(layer_state_t state) { | |||
| 94 | 94 | ||
| 95 | void matrix_scan_keymap(void) { | 95 | void matrix_scan_keymap(void) { |
| 96 | uint8_t modifiers = get_mods(); | 96 | uint8_t modifiers = get_mods(); |
| 97 | uint8_t led_usb_state = host_keyboard_leds(); | 97 | led_t led_state = host_keyboard_led_state(); |
| 98 | uint8_t one_shot = get_oneshot_mods(); | 98 | uint8_t one_shot = get_oneshot_mods(); |
| 99 | uint8_t layer_is_workman = layer_state_is(_WORKMAN); | 99 | uint8_t layer_is_workman = layer_state_is(_WORKMAN); |
| 100 | 100 | ||
| 101 | if ((modifiers) && (layer_is_workman)) { | 101 | if ((modifiers) && (layer_is_workman)) { |
| 102 | if (modifiers & MOD_MASK_SHIFT || led_usb_state & (1<<USB_LED_CAPS_LOCK) || one_shot & MOD_MASK_SHIFT) { | 102 | if (modifiers & MOD_MASK_SHIFT || led_state.caps_lock || one_shot & MOD_MASK_SHIFT) { |
| 103 | ergodox_right_led_1_on(); | 103 | ergodox_right_led_1_on(); |
| 104 | ergodox_right_led_1_set( 25 ); | 104 | ergodox_right_led_1_set( 25 ); |
| 105 | } else { | 105 | } else { |
diff --git a/layouts/community/ergodox/ordinary/keymap.c b/layouts/community/ergodox/ordinary/keymap.c index 6c7586034c..c828c6fb97 100644 --- a/layouts/community/ergodox/ordinary/keymap.c +++ b/layouts/community/ergodox/ordinary/keymap.c | |||
| @@ -238,7 +238,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 238 | // Runs constantly in the background, in a loop. | 238 | // Runs constantly in the background, in a loop. |
| 239 | void matrix_scan_user(void) { | 239 | void matrix_scan_user(void) { |
| 240 | // shift or caps lock turns on red light | 240 | // shift or caps lock turns on red light |
| 241 | if ((keyboard_report->mods & MOD_BIT(KC_LSFT)) || (keyboard_report->mods & MOD_BIT(KC_RSFT)) || (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) { | 241 | if ((keyboard_report->mods & MOD_BIT(KC_LSFT)) || (keyboard_report->mods & MOD_BIT(KC_RSFT)) || host_keyboard_led_state().caps_lock) { |
| 242 | ergodox_right_led_1_on(); | 242 | ergodox_right_led_1_on(); |
| 243 | } else { | 243 | } else { |
| 244 | ergodox_right_led_1_off(); | 244 | 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] = { | |||
| 238 | // Runs constantly in the background, in a loop. | 238 | // Runs constantly in the background, in a loop. |
| 239 | void matrix_scan_user(void) { | 239 | void matrix_scan_user(void) { |
| 240 | // shift or caps lock turns on red light | 240 | // shift or caps lock turns on red light |
| 241 | if ((keyboard_report->mods & MOD_BIT(KC_LSFT)) || (keyboard_report->mods & MOD_BIT(KC_RSFT)) || (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) { | 241 | if ((keyboard_report->mods & MOD_BIT(KC_LSFT)) || (keyboard_report->mods & MOD_BIT(KC_RSFT)) || host_keyboard_led_state().caps_lock) { |
| 242 | ergodox_right_led_1_on(); | 242 | ergodox_right_led_1_on(); |
| 243 | } else { | 243 | } else { |
| 244 | ergodox_right_led_1_off(); | 244 | 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) { | |||
| 686 | 686 | ||
| 687 | if ((capslock_state & MOD_MASK_SHIFT) == MOD_MASK_SHIFT) { | 687 | if ((capslock_state & MOD_MASK_SHIFT) == MOD_MASK_SHIFT) { |
| 688 | // CAPSLOCK is currently active, disable it | 688 | // CAPSLOCK is currently active, disable it |
| 689 | if (host_keyboard_leds() & (1 << USB_LED_CAPS_LOCK)) { | 689 | if (host_keyboard_led_state().caps_lock) { |
| 690 | unregister_code(KC_LOCKING_CAPS_LOCK); | 690 | unregister_code(KC_LOCKING_CAPS_LOCK); |
| 691 | } else { | 691 | } else { |
| 692 | register_code(KC_LOCKING_CAPS_LOCK); | 692 | register_code(KC_LOCKING_CAPS_LOCK); |
| @@ -697,11 +697,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 697 | return process_record_user_shifted(keycode, record); | 697 | return process_record_user_shifted(keycode, record); |
| 698 | }; | 698 | }; |
| 699 | 699 | ||
| 700 | // Runs just one time when the keyboard initializes. | ||
| 701 | void matrix_init_user(void){ | ||
| 702 | |||
| 703 | }; | ||
| 704 | |||
| 705 | // Runs constantly in the background, in a loop. | 700 | // Runs constantly in the background, in a loop. |
| 706 | void matrix_scan_user(void) { | 701 | void matrix_scan_user(void) { |
| 707 | uint8_t layer = get_highest_layer(layer_state); | 702 | 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) { | |||
| 106 | ergodox_right_led_3_off(); | 106 | ergodox_right_led_3_off(); |
| 107 | ergodox_board_led_off(); | 107 | ergodox_board_led_off(); |
| 108 | 108 | ||
| 109 | if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) { | 109 | if (host_keyboard_led_state().caps_lock) { |
| 110 | ergodox_right_led_3_on(); | 110 | ergodox_right_led_3_on(); |
| 111 | } | 111 | } |
| 112 | 112 | ||
diff --git a/layouts/community/ergodox/swedish-lindhe/keymap.c b/layouts/community/ergodox/swedish-lindhe/keymap.c index 1644512de7..376574f690 100644 --- a/layouts/community/ergodox/swedish-lindhe/keymap.c +++ b/layouts/community/ergodox/swedish-lindhe/keymap.c | |||
| @@ -154,11 +154,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 154 | ), | 154 | ), |
| 155 | }; | 155 | }; |
| 156 | 156 | ||
| 157 | // Runs just one time when the keyboard initializes. | ||
| 158 | void matrix_init_user(void) { | ||
| 159 | |||
| 160 | }; | ||
| 161 | |||
| 162 | // Runs constantly in the background, in a loop. | 157 | // Runs constantly in the background, in a loop. |
| 163 | void matrix_scan_user(void) { | 158 | void matrix_scan_user(void) { |
| 164 | 159 | ||
| @@ -185,7 +180,7 @@ void matrix_scan_user(void) { | |||
| 185 | break; | 180 | break; |
| 186 | } | 181 | } |
| 187 | 182 | ||
| 188 | if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) { | 183 | if (host_keyboard_led_state().caps_lock) { |
| 189 | // if capslk is on, set led 1 on | 184 | // if capslk is on, set led 1 on |
| 190 | ergodox_right_led_1_on(); | 185 | ergodox_right_led_1_on(); |
| 191 | } else { | 186 | } else { |
diff --git a/layouts/community/ortho_4x12/brandonschlack/keymap.c b/layouts/community/ortho_4x12/brandonschlack/keymap.c index 7361de1a03..04c83de9e9 100644 --- a/layouts/community/ortho_4x12/brandonschlack/keymap.c +++ b/layouts/community/ortho_4x12/brandonschlack/keymap.c | |||
| @@ -100,12 +100,13 @@ void keyboard_post_init_keymap(void) { | |||
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | // Use Green LED for Caps Lock | 102 | // Use Green LED for Caps Lock |
| 103 | void led_set_user(uint8_t usb_led) { | 103 | bool led_update_user(led_t led_state) { |
| 104 | if (IS_LED_OFF(usb_led, USB_LED_CAPS_LOCK)) { | 104 | if (led_state.caps_lock) { |
| 105 | writePinLow(LED_GREEN); | 105 | writePinLow(LED_GREEN); |
| 106 | } else { | 106 | } else { |
| 107 | writePinHigh(LED_GREEN); | 107 | writePinHigh(LED_GREEN); |
| 108 | } | 108 | } |
| 109 | return false; | ||
| 109 | } | 110 | } |
| 110 | #endif | 111 | #endif |
| 111 | 112 | ||
diff --git a/layouts/community/ortho_4x12/drashna/keymap.c b/layouts/community/ortho_4x12/drashna/keymap.c index 475ccc5c3a..cdf41fc5dc 100644 --- a/layouts/community/ortho_4x12/drashna/keymap.c +++ b/layouts/community/ortho_4x12/drashna/keymap.c | |||
| @@ -184,7 +184,7 @@ led_config_t g_led_config = { | |||
| 184 | 184 | ||
| 185 | bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) { | 185 | bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) { |
| 186 | uint8_t this_mod = get_mods(); | 186 | uint8_t this_mod = get_mods(); |
| 187 | uint8_t this_led = host_keyboard_leds(); | 187 | led_t this_led = host_keyboard_led_state(); |
| 188 | uint8_t this_osm = get_oneshot_mods(); | 188 | uint8_t this_osm = get_oneshot_mods(); |
| 189 | # ifdef KEYBOARD_planck_ez | 189 | # ifdef KEYBOARD_planck_ez |
| 190 | # define THUMB_LED 41 | 190 | # define THUMB_LED 41 |
| @@ -208,7 +208,7 @@ bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) { | |||
| 208 | break; | 208 | break; |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1 << USB_LED_CAPS_LOCK)) { | 211 | if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led.caps_lock) { |
| 212 | if (!layer_state_cmp(layer_state, _ADJUST)) { | 212 | if (!layer_state_cmp(layer_state, _ADJUST)) { |
| 213 | RGB_MATRIX_INDICATOR_SET_COLOR(24, 0x00, 0xFF, 0x00); | 213 | RGB_MATRIX_INDICATOR_SET_COLOR(24, 0x00, 0xFF, 0x00); |
| 214 | } | 214 | } |
diff --git a/platforms/avr/sleep_led.c b/platforms/avr/sleep_led.c index b05431633b..ad6253be93 100644 --- a/platforms/avr/sleep_led.c +++ b/platforms/avr/sleep_led.c | |||
| @@ -109,16 +109,19 @@ ISR(TIMERx_COMPA_vect) { | |||
| 109 | uint8_t duration : 2; | 109 | uint8_t duration : 2; |
| 110 | uint8_t index : 6; | 110 | uint8_t index : 6; |
| 111 | } pwm; | 111 | } pwm; |
| 112 | } timer = {.row = 0}; | 112 | } timer = {.row = 0}; |
| 113 | static led_t led_state = {0}; | ||
| 113 | 114 | ||
| 114 | timer.row++; | 115 | timer.row++; |
| 115 | 116 | ||
| 116 | // LED on | 117 | // LED on |
| 117 | if (timer.pwm.count == 0) { | 118 | if (timer.pwm.count == 0) { |
| 118 | led_set(1 << USB_LED_CAPS_LOCK); | 119 | led_state.caps_lock = true; |
| 120 | led_set(led_state.raw); | ||
| 119 | } | 121 | } |
| 120 | // LED off | 122 | // LED off |
| 121 | if (timer.pwm.count == pgm_read_byte(&breathing_table[timer.pwm.index])) { | 123 | if (timer.pwm.count == pgm_read_byte(&breathing_table[timer.pwm.index])) { |
| 122 | led_set(0); | 124 | led_state.caps_lock = false; |
| 125 | led_set(led_state.raw); | ||
| 123 | } | 126 | } |
| 124 | } | 127 | } |
diff --git a/platforms/chibios/sleep_led.c b/platforms/chibios/sleep_led.c index a777d60468..a35514bf2e 100644 --- a/platforms/chibios/sleep_led.c +++ b/platforms/chibios/sleep_led.c | |||
| @@ -41,17 +41,20 @@ void sleep_led_timer_callback(void) { | |||
| 41 | uint8_t duration : 2; | 41 | uint8_t duration : 2; |
| 42 | uint8_t index : 6; | 42 | uint8_t index : 6; |
| 43 | } pwm; | 43 | } pwm; |
| 44 | } timer = {.row = 0}; | 44 | } timer = {.row = 0}; |
| 45 | static led_t led_state = {0}; | ||
| 45 | 46 | ||
| 46 | timer.row++; | 47 | timer.row++; |
| 47 | 48 | ||
| 48 | // LED on | 49 | // LED on |
| 49 | if (timer.pwm.count == 0) { | 50 | if (timer.pwm.count == 0) { |
| 50 | led_set(1 << USB_LED_CAPS_LOCK); | 51 | led_state.caps_lock = true; |
| 52 | led_set(led_state.raw); | ||
| 51 | } | 53 | } |
| 52 | // LED off | 54 | // LED off |
| 53 | if (timer.pwm.count == breathing_table[timer.pwm.index]) { | 55 | if (timer.pwm.count == breathing_table[timer.pwm.index]) { |
| 54 | led_set(0); | 56 | led_state.caps_lock = false; |
| 57 | led_set(led_state.raw); | ||
| 55 | } | 58 | } |
| 56 | } | 59 | } |
| 57 | 60 | ||
| @@ -190,7 +193,7 @@ void sleep_led_toggle(void) { | |||
| 190 | void sleep_led_init(void) {} | 193 | void sleep_led_init(void) {} |
| 191 | 194 | ||
| 192 | void sleep_led_enable(void) { | 195 | void sleep_led_enable(void) { |
| 193 | led_set(1 << USB_LED_CAPS_LOCK); | 196 | led_set(2); // Caps Lock |
| 194 | } | 197 | } |
| 195 | 198 | ||
| 196 | void sleep_led_disable(void) { | 199 | void sleep_led_disable(void) { |
diff --git a/quantum/led.c b/quantum/led.c index 42144566fd..8d86374a6f 100644 --- a/quantum/led.c +++ b/quantum/led.c | |||
| @@ -153,14 +153,14 @@ __attribute__((weak)) void led_set(uint8_t usb_led) { | |||
| 153 | /** \brief Trigger behaviour on transition to suspend | 153 | /** \brief Trigger behaviour on transition to suspend |
| 154 | */ | 154 | */ |
| 155 | void led_suspend(void) { | 155 | void led_suspend(void) { |
| 156 | uint8_t leds_off = 0; | 156 | led_t leds_off = {0}; |
| 157 | #ifdef BACKLIGHT_CAPS_LOCK | 157 | #ifdef BACKLIGHT_CAPS_LOCK |
| 158 | if (is_backlight_enabled()) { | 158 | if (is_backlight_enabled()) { |
| 159 | // Don't try to turn off Caps Lock indicator as it is backlight and backlight is already off | 159 | // Don't try to turn off Caps Lock indicator as it is backlight and backlight is already off |
| 160 | leds_off |= (1 << USB_LED_CAPS_LOCK); | 160 | leds_off.caps_lock = true; |
| 161 | } | 161 | } |
| 162 | #endif | 162 | #endif |
| 163 | led_set(leds_off); | 163 | led_set(leds_off.raw); |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | /** \brief Trigger behaviour on transition from suspend | 166 | /** \brief Trigger behaviour on transition from suspend |
diff --git a/quantum/led.h b/quantum/led.h index 679e743396..b9fad670ae 100644 --- a/quantum/led.h +++ b/quantum/led.h | |||
| @@ -22,9 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 22 | 22 | ||
| 23 | /* FIXME: Add doxygen comments here. */ | 23 | /* FIXME: Add doxygen comments here. */ |
| 24 | 24 | ||
| 25 | /* keyboard LEDs */ | ||
| 26 | #define USB_LED_CAPS_LOCK 1 | ||
| 27 | |||
| 28 | #ifdef __cplusplus | 25 | #ifdef __cplusplus |
| 29 | extern "C" { | 26 | extern "C" { |
| 30 | #endif | 27 | #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 | |||
| 11 | * This is especially useful for One Shot Mods, since it's not always obvious if they're still lit up. | 11 | * This is especially useful for One Shot Mods, since it's not always obvious if they're still lit up. |
| 12 | */ | 12 | */ |
| 13 | #if defined(INDICATOR_LIGHTS) | 13 | #if defined(INDICATOR_LIGHTS) |
| 14 | void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { | 14 | void set_rgb_indicators(uint8_t this_mod, led_t this_led, uint8_t this_osm) { |
| 15 | if (userspace_config.rgb_layer_change && get_highest_layer(layer_state) == 0) { | 15 | if (userspace_config.rgb_layer_change && get_highest_layer(layer_state) == 0) { |
| 16 | if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1 << USB_LED_CAPS_LOCK)) { | 16 | if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led.caps_lock) { |
| 17 | # ifdef SHFT_LED1 | 17 | # ifdef SHFT_LED1 |
| 18 | rgblight_sethsv_at(120, 255, 255, SHFT_LED1); | 18 | rgblight_sethsv_at(120, 255, 255, SHFT_LED1); |
| 19 | # endif // SHFT_LED1 | 19 | # endif // SHFT_LED1 |
| @@ -79,7 +79,7 @@ void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { | |||
| 79 | /* Function for the indicators */ | 79 | /* Function for the indicators */ |
| 80 | void matrix_scan_indicator(void) { | 80 | void matrix_scan_indicator(void) { |
| 81 | if (has_initialized) { | 81 | if (has_initialized) { |
| 82 | set_rgb_indicators(get_mods(), host_keyboard_leds(), get_oneshot_mods()); | 82 | set_rgb_indicators(get_mods(), host_keyboard_led_state(), get_oneshot_mods()); |
| 83 | } | 83 | } |
| 84 | } | 84 | } |
| 85 | #endif // INDICATOR_LIGHTS | 85 | #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) { | |||
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | static bool is_capslocked = false; | 137 | static bool is_capslocked = false; |
| 138 | void led_set_user(uint8_t usb_led) { | 138 | bool led_update_user(led_t led_state) { |
| 139 | if (usb_led & (1<<USB_LED_CAPS_LOCK)) { | 139 | if (led_state.caps_lock) { |
| 140 | is_capslocked = true; | 140 | is_capslocked = true; |
| 141 | // DDRB |= (1 << 2); PORTB &= ~(1 << 2); | 141 | // DDRB |= (1 << 2); PORTB &= ~(1 << 2); |
| 142 | } else { | 142 | } else { |
| 143 | is_capslocked = false; | 143 | is_capslocked = false; |
| 144 | // DDRB &= ~(1 << 2); PORTB &= ~(1 << 2); | 144 | // DDRB &= ~(1 << 2); PORTB &= ~(1 << 2); |
| 145 | } | 145 | } |
| 146 | return false; | ||
| 146 | } | 147 | } |
| 147 | //rgblight_set(); | 148 | //rgblight_set(); |
| 148 | 149 | ||
