summaryrefslogtreecommitdiff
path: root/quantum/quantum.c
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2020-11-08 22:31:16 +0000
committerGitHub <noreply@github.com>2020-11-08 22:31:16 +0000
commit1ff5ee255fadcd6bfc4defb68ef097d67ebd40ad (patch)
tree559d771e6c2490ea7816b095b0e6e9a196462ec0 /quantum/quantum.c
parent9cd3ffa5ba1187c0bc11b613078d89b503dcf419 (diff)
Indicator LEDs as config (#10816)
* First pass * Add config options to docs * Update some wording * Slight tidy up of backlight caps logic * Init pin to correct state * Move init location * Reverse default state
Diffstat (limited to 'quantum/quantum.c')
-rw-r--r--quantum/quantum.c56
1 files changed, 4 insertions, 52 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index dab6c9172f..0b2f98762d 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -23,7 +23,6 @@
#ifdef BACKLIGHT_ENABLE
# include "backlight.h"
-extern backlight_config_t backlight_config;
#endif
#ifdef FAUXCLICKY_ENABLE
@@ -602,6 +601,10 @@ void matrix_init_quantum() {
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
+#if defined(LED_NUM_LOCK_PIN) || defined(LED_CAPS_LOCK_PIN) || defined(LED_SCROLL_LOCK_PIN) || defined(LED_COMPOSE_PIN) || defined(LED_KANA_PIN)
+ // TODO: remove calls to led_init_ports from keyboards and remove ifdef
+ led_init_ports();
+#endif
#ifdef BACKLIGHT_ENABLE
# ifdef LED_MATRIX_ENABLE
led_matrix_init();
@@ -725,55 +728,6 @@ void api_send_unicode(uint32_t unicode) {
#endif
}
-/** \brief Lock LED set callback - keymap/user level
- *
- * \deprecated Use led_update_user() instead.
- */
-__attribute__((weak)) void led_set_user(uint8_t usb_led) {}
-
-/** \brief Lock LED set callback - keyboard level
- *
- * \deprecated Use led_update_kb() instead.
- */
-__attribute__((weak)) void led_set_kb(uint8_t usb_led) { led_set_user(usb_led); }
-
-/** \brief Lock LED update callback - keymap/user level
- *
- * \return True if led_update_kb() should run its own code, false otherwise.
- */
-__attribute__((weak)) bool led_update_user(led_t led_state) { return true; }
-
-/** \brief Lock LED update callback - keyboard level
- *
- * \return Ignored for now.
- */
-__attribute__((weak)) bool led_update_kb(led_t led_state) { return led_update_user(led_state); }
-
-__attribute__((weak)) void led_init_ports(void) {}
-
-__attribute__((weak)) void led_set(uint8_t usb_led) {
-#if defined(BACKLIGHT_CAPS_LOCK) && defined(BACKLIGHT_ENABLE)
- // Use backlight as Caps Lock indicator
- uint8_t bl_toggle_lvl = 0;
-
- if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK) && !backlight_config.enable) {
- // Turning Caps Lock ON and backlight is disabled in config
- // Toggling backlight to the brightest level
- bl_toggle_lvl = BACKLIGHT_LEVELS;
- } else if (IS_LED_OFF(usb_led, USB_LED_CAPS_LOCK) && backlight_config.enable) {
- // Turning Caps Lock OFF and backlight is enabled in config
- // Toggling backlight and restoring config level
- bl_toggle_lvl = backlight_config.level;
- }
-
- // Set level without modify backlight_config to keep ability to restore state
- backlight_set(bl_toggle_lvl);
-#endif
-
- led_set_kb(usb_led);
- led_update_kb((led_t)usb_led);
-}
-
//------------------------------------------------------------------------------
// Override these functions in your keymap file to play different tunes on
// different events such as startup and bootloader jump
@@ -781,5 +735,3 @@ __attribute__((weak)) void led_set(uint8_t usb_led) {
__attribute__((weak)) void startup_user() {}
__attribute__((weak)) void shutdown_user() {}
-
-//------------------------------------------------------------------------------