diff options
Diffstat (limited to 'keyboards/planck')
-rw-r--r-- | keyboards/planck/keymaps/altgr/common/init.h | 11 | ||||
-rw-r--r-- | keyboards/planck/keymaps/hiea/common/init.h | 11 | ||||
-rw-r--r-- | keyboards/planck/keymaps/hieax/common/init.h | 11 | ||||
-rw-r--r-- | keyboards/planck/keymaps/rootiest/keymap.c | 2 | ||||
-rw-r--r-- | keyboards/planck/keymaps/sdothum/common/init.h | 11 |
5 files changed, 25 insertions, 21 deletions
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) #ifdef AUDIO_ENABLE #ifdef BACKLIGHT_ENABLE -void led_set_user(uint8_t usb_led) +bool led_update_user(led_t led_state) { - static uint8_t old_usb_led = 0; + static led_t old_led_state = {0}; _delay_ms(10); // gets rid of tick if (!is_playing_notes()) { - if ((usb_led & (1<<USB_LED_CAPS_LOCK)) && !(old_usb_led & (1<<USB_LED_CAPS_LOCK))) { + if (led_state.caps_lock && !old_led_state.caps_lock) { // if capslock LED is turning on PLAY_SONG(song_caps_on); } - else if (!(usb_led & (1<<USB_LED_CAPS_LOCK)) && (old_usb_led & (1<<USB_LED_CAPS_LOCK))) { + else if (!led_state.caps_lock && old_led_state.caps_lock) { // if capslock LED is turning off PLAY_SONG(song_caps_off); } } - old_usb_led = usb_led; + old_led_state = led_state; + return false; } #endif 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) #ifdef AUDIO_ENABLE #ifdef BACKLIGHT_ENABLE -void led_set_user(uint8_t usb_led) +bool led_update_user(led_t led_state) { - static uint8_t old_usb_led = 0; + static led_t old_led_state = {0}; _delay_ms(10); // gets rid of tick if (!is_playing_notes()) { - if ((usb_led & (1<<USB_LED_CAPS_LOCK)) && !(old_usb_led & (1<<USB_LED_CAPS_LOCK))) { + if (led_state.caps_lock && !old_led_state.caps_lock) { // if capslock LED is turning on PLAY_SONG(song_caps_on); } - else if (!(usb_led & (1<<USB_LED_CAPS_LOCK)) && (old_usb_led & (1<<USB_LED_CAPS_LOCK))) { + else if (!led_state.caps_lock && old_led_state.caps_lock) { // if capslock LED is turning off PLAY_SONG(song_caps_off); } } - old_usb_led = usb_led; + old_led_state = led_state; + return false; } #endif 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) #ifdef AUDIO_ENABLE #ifdef BACKLIGHT_ENABLE -void led_set_user(uint8_t usb_led) +bool led_update_user(led_t led_state) { - static uint8_t old_usb_led = 0; + static led_t old_led_state = {0}; _delay_ms(10); // gets rid of tick if (!is_playing_notes()) { - if ((usb_led & (1<<USB_LED_CAPS_LOCK)) && !(old_usb_led & (1<<USB_LED_CAPS_LOCK))) { + if (led_state.caps_lock && !old_led_state.caps_lock) { // if capslock LED is turning on PLAY_SONG(song_caps_on); } - else if (!(usb_led & (1<<USB_LED_CAPS_LOCK)) && (old_usb_led & (1<<USB_LED_CAPS_LOCK))) { + else if (!led_state.caps_lock && old_led_state.caps_lock) { // if capslock LED is turning off PLAY_SONG(song_caps_off); } } - old_usb_led = usb_led; + old_led_state = led_state; + return false; } #endif 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) { register_code(KC_LSFT); break; default: - if (host_keyboard_leds() & (1 << USB_LED_CAPS_LOCK)) { + if (host_keyboard_led_state().caps_lock) { tap_code(KC_CAPS); reset_tap_dance(state); 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) #ifdef AUDIO_ENABLE #ifdef BACKLIGHT_ENABLE -void led_set_user(uint8_t usb_led) +bool led_update_user(led_t led_state) { - static uint8_t old_usb_led = 0; + static led_t old_led_state = {0}; _delay_ms(10); // gets rid of tick if (!is_playing_notes()) { - if ((usb_led & (1<<USB_LED_CAPS_LOCK)) && !(old_usb_led & (1<<USB_LED_CAPS_LOCK))) { + if (led_state.caps_lock && !old_led_state.caps_lock) { // if capslock LED is turning on PLAY_SONG(song_caps_on); } - else if (!(usb_led & (1<<USB_LED_CAPS_LOCK)) && (old_usb_led & (1<<USB_LED_CAPS_LOCK))) { + else if (!led_state.caps_lock && old_led_state.caps_lock) { // if capslock LED is turning off PLAY_SONG(song_caps_off); } } - old_usb_led = usb_led; + old_led_state = led_state; + return false; } #endif |