summaryrefslogtreecommitdiff
path: root/quantum/quantum.c
diff options
context:
space:
mode:
authorfauxpark <fauxpark@gmail.com>2019-11-06 11:42:16 +1100
committerFlorian Didron <fdidron@users.noreply.github.com>2020-01-09 08:57:11 +0900
commit81126b6673313dc5e40ed92cc67f85b430003894 (patch)
tree02af8c915b543f0831cb05ed1a93cb2d89b4b0ea /quantum/quantum.c
parent4c1bdea275197442525673462e00be2f16bf1360 (diff)
New and improved lock LED callbacks (#7215)
* New and improved lock LED callbacks * Include stdbool * Update documentation * Use full function signatures and add keyboard-level example
Diffstat (limited to 'quantum/quantum.c')
-rw-r--r--quantum/quantum.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 7e2b90ea7f..141a153400 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -1081,10 +1081,30 @@ 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) {
@@ -1107,6 +1127,7 @@ __attribute__((weak)) void led_set(uint8_t usb_led) {
#endif
led_set_kb(usb_led);
+ led_update_kb((led_t) usb_led);
}
//------------------------------------------------------------------------------