diff options
Diffstat (limited to 'quantum/quantum.c')
-rw-r--r-- | quantum/quantum.c | 56 |
1 files changed, 4 insertions, 52 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c index dab6c9172..0b2f98762 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
@@ -23,7 +23,6 @@ | |||
23 | 23 | ||
24 | #ifdef BACKLIGHT_ENABLE | 24 | #ifdef BACKLIGHT_ENABLE |
25 | # include "backlight.h" | 25 | # include "backlight.h" |
26 | extern backlight_config_t backlight_config; | ||
27 | #endif | 26 | #endif |
28 | 27 | ||
29 | #ifdef FAUXCLICKY_ENABLE | 28 | #ifdef FAUXCLICKY_ENABLE |
@@ -602,6 +601,10 @@ void matrix_init_quantum() { | |||
602 | if (!eeconfig_is_enabled()) { | 601 | if (!eeconfig_is_enabled()) { |
603 | eeconfig_init(); | 602 | eeconfig_init(); |
604 | } | 603 | } |
604 | #if defined(LED_NUM_LOCK_PIN) || defined(LED_CAPS_LOCK_PIN) || defined(LED_SCROLL_LOCK_PIN) || defined(LED_COMPOSE_PIN) || defined(LED_KANA_PIN) | ||
605 | // TODO: remove calls to led_init_ports from keyboards and remove ifdef | ||
606 | led_init_ports(); | ||
607 | #endif | ||
605 | #ifdef BACKLIGHT_ENABLE | 608 | #ifdef BACKLIGHT_ENABLE |
606 | # ifdef LED_MATRIX_ENABLE | 609 | # ifdef LED_MATRIX_ENABLE |
607 | led_matrix_init(); | 610 | led_matrix_init(); |
@@ -725,55 +728,6 @@ void api_send_unicode(uint32_t unicode) { | |||
725 | #endif | 728 | #endif |
726 | } | 729 | } |
727 | 730 | ||
728 | /** \brief Lock LED set callback - keymap/user level | ||
729 | * | ||
730 | * \deprecated Use led_update_user() instead. | ||
731 | */ | ||
732 | __attribute__((weak)) void led_set_user(uint8_t usb_led) {} | ||
733 | |||
734 | /** \brief Lock LED set callback - keyboard level | ||
735 | * | ||
736 | * \deprecated Use led_update_kb() instead. | ||
737 | */ | ||
738 | __attribute__((weak)) void led_set_kb(uint8_t usb_led) { led_set_user(usb_led); } | ||
739 | |||
740 | /** \brief Lock LED update callback - keymap/user level | ||
741 | * | ||
742 | * \return True if led_update_kb() should run its own code, false otherwise. | ||
743 | */ | ||
744 | __attribute__((weak)) bool led_update_user(led_t led_state) { return true; } | ||
745 | |||
746 | /** \brief Lock LED update callback - keyboard level | ||
747 | * | ||
748 | * \return Ignored for now. | ||
749 | */ | ||
750 | __attribute__((weak)) bool led_update_kb(led_t led_state) { return led_update_user(led_state); } | ||
751 | |||
752 | __attribute__((weak)) void led_init_ports(void) {} | ||
753 | |||
754 | __attribute__((weak)) void led_set(uint8_t usb_led) { | ||
755 | #if defined(BACKLIGHT_CAPS_LOCK) && defined(BACKLIGHT_ENABLE) | ||
756 | // Use backlight as Caps Lock indicator | ||
757 | uint8_t bl_toggle_lvl = 0; | ||
758 | |||
759 | if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK) && !backlight_config.enable) { | ||
760 | // Turning Caps Lock ON and backlight is disabled in config | ||
761 | // Toggling backlight to the brightest level | ||
762 | bl_toggle_lvl = BACKLIGHT_LEVELS; | ||
763 | } else if (IS_LED_OFF(usb_led, USB_LED_CAPS_LOCK) && backlight_config.enable) { | ||
764 | // Turning Caps Lock OFF and backlight is enabled in config | ||
765 | // Toggling backlight and restoring config level | ||
766 | bl_toggle_lvl = backlight_config.level; | ||
767 | } | ||
768 | |||
769 | // Set level without modify backlight_config to keep ability to restore state | ||
770 | backlight_set(bl_toggle_lvl); | ||
771 | #endif | ||
772 | |||
773 | led_set_kb(usb_led); | ||
774 | led_update_kb((led_t)usb_led); | ||
775 | } | ||
776 | |||
777 | //------------------------------------------------------------------------------ | 731 | //------------------------------------------------------------------------------ |
778 | // Override these functions in your keymap file to play different tunes on | 732 | // Override these functions in your keymap file to play different tunes on |
779 | // different events such as startup and bootloader jump | 733 | // different events such as startup and bootloader jump |
@@ -781,5 +735,3 @@ __attribute__((weak)) void led_set(uint8_t usb_led) { | |||
781 | __attribute__((weak)) void startup_user() {} | 735 | __attribute__((weak)) void startup_user() {} |
782 | 736 | ||
783 | __attribute__((weak)) void shutdown_user() {} | 737 | __attribute__((weak)) void shutdown_user() {} |
784 | |||
785 | //------------------------------------------------------------------------------ | ||