From 9ab16e62f75dc6228549ec0aba00ec0704bbc779 Mon Sep 17 00:00:00 2001 From: Ryan Date: Mon, 3 Jul 2023 04:35:41 +1000 Subject: [PATCH] Get rid of `USB_LED_NUM_LOCK` (#21424) --- .../gherkin/keymaps/default/keymap.c | 7 +-- keyboards/contra/keymaps/maxr1998/keymap.c | 5 +- keyboards/crkbd/keymaps/rpbaptist/keymap.c | 6 +-- .../dz60rgb/keymaps/matthewrobo/keymap.c | 13 ++--- .../dztech/dz60rgb/keymaps/mekanist/keymap.c | 25 ++-------- .../dz65rgb/keymaps/matthewrobo/keymap.c | 11 +--- .../arrow_pad/keymaps/default/keymap.c | 7 +-- .../arrow_pad/keymaps/pad_21/keymap.c | 7 +-- .../arrow_pad/keymaps/pad_24/keymap.c | 7 +-- keyboards/input_club/infinity60/led.c | 50 ++++++++++--------- .../input_club/infinity60/led_controller.c | 5 +- .../kbdfans/niu_mini/keymaps/tobias/keymap.c | 12 ++--- .../kprepublic/jj40/keymaps/stevexyz/keymap.c | 5 +- .../massdrop/alt/keymaps/jdelkins_ss/keymap.c | 3 +- keyboards/mt/mt980/keymaps/walker/keymap.c | 4 +- .../novelkeys/novelpad/keymaps/0xdec/keymap.c | 5 +- .../setta21/keymaps/salicylic/keymap.c | 6 +-- .../cypher/rev1/keymaps/kwer/keymap.c | 19 ++----- .../xiudi/xd75/keymaps/billypython/keymap.c | 2 +- keyboards/xiudi/xd75/keymaps/boy_314/keymap.c | 7 +-- keyboards/yosino58/keymaps/default/keymap.c | 5 +- keyboards/yosino58/keymaps/sakura/keymap.c | 5 +- .../community/numpad_5x6/bjohnson/keymap.c | 5 +- quantum/led.h | 1 - users/doogle999/doogle999.c | 2 +- 25 files changed, 91 insertions(+), 133 deletions(-) diff --git a/keyboards/40percentclub/gherkin/keymaps/default/keymap.c b/keyboards/40percentclub/gherkin/keymaps/default/keymap.c index ab2a1fa1c14..f4d3032857c 100644 --- a/keyboards/40percentclub/gherkin/keymaps/default/keymap.c +++ b/keyboards/40percentclub/gherkin/keymaps/default/keymap.c @@ -59,16 +59,17 @@ void keyboard_pre_init_user(void) { setPinOutput(B0); } -void led_set_user(uint8_t usb_led) { - if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) { +bool led_update_user(led_t led_state) { + if (led_state.num_lock) { writePinLow(D5); } else { writePinHigh(D5); } - if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { + if (led_state.caps_lock) { writePinLow(B0); } else { writePinHigh(B0); } + return false; } diff --git a/keyboards/contra/keymaps/maxr1998/keymap.c b/keyboards/contra/keymaps/maxr1998/keymap.c index 8a56c607461..0802a211f06 100644 --- a/keyboards/contra/keymaps/maxr1998/keymap.c +++ b/keyboards/contra/keymaps/maxr1998/keymap.c @@ -176,10 +176,11 @@ void update_tri_layer_user(void) { } } -void led_set_user(uint8_t usb_led) { +bool led_update_user(led_t led_state) { // Force-enable Numlock - if (!(usb_led & (1<. * both regular threads and ISRs, unlocked (during resume-from-sleep). * In particular, I2C functions (interrupt-driven) should NOT be called from here. */ -void led_set(uint8_t usb_led) { - msg_t msg; +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + if (res) { + msg_t msg; - if (usb_led & (1<event.pressed) { layer_invert(L_NUMPAD); - bool num_lock = host_keyboard_leds() & 1<. /* FIXME: Add doxygen comments here. */ /* keyboard LEDs */ -#define USB_LED_NUM_LOCK 0 #define USB_LED_CAPS_LOCK 1 #ifdef __cplusplus diff --git a/users/doogle999/doogle999.c b/users/doogle999/doogle999.c index 5d71599687a..a5bd637ecea 100644 --- a/users/doogle999/doogle999.c +++ b/users/doogle999/doogle999.c @@ -389,7 +389,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) /* KC_KP_1, KC_KP_2, ..., KC_KP_0, KC_KP_DOT */ (keycode >= KC_KP_1 && keycode <= KC_KP_DOT); - if(numpadKeyPressed && !(host_keyboard_leds() & (1 << USB_LED_NUM_LOCK))) + if(numpadKeyPressed && !host_keyboard_led_state().num_lock) { add_key(KC_NUM_LOCK); send_keyboard_report();