summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/quantum.c21
-rw-r--r--quantum/quantum.h2
-rw-r--r--quantum/template/base/keyboard.c4
-rw-r--r--quantum/template/base/keymaps/default/keymap.c4
4 files changed, 27 insertions, 4 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 1f17c6ff71..c27c3aba61 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -1070,10 +1070,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) {
@@ -1096,6 +1116,7 @@ __attribute__((weak)) void led_set(uint8_t usb_led) {
#endif
led_set_kb(usb_led);
+ led_update_kb((led_t) usb_led);
}
//------------------------------------------------------------------------------
diff --git a/quantum/quantum.h b/quantum/quantum.h
index 87343a15df..7988c58788 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -289,5 +289,7 @@ uint16_t hex_to_keycode(uint8_t hex);
void led_set_user(uint8_t usb_led);
void led_set_kb(uint8_t usb_led);
+bool led_update_user(led_t led_state);
+bool led_update_kb(led_t led_state);
void api_send_unicode(uint32_t unicode);
diff --git a/quantum/template/base/keyboard.c b/quantum/template/base/keyboard.c
index 55e4fffd3a..fc31c294a2 100644
--- a/quantum/template/base/keyboard.c
+++ b/quantum/template/base/keyboard.c
@@ -42,9 +42,9 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
return process_record_user(keycode, record);
}
-void led_set_kb(uint8_t usb_led) {
+bool led_update_kb(led_t led_state) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
- led_set_user(usb_led);
+ return led_update_user(led_state);
}
*/
diff --git a/quantum/template/base/keymaps/default/keymap.c b/quantum/template/base/keymaps/default/keymap.c
index 4d5bac7b2f..3a68f5487c 100644
--- a/quantum/template/base/keymaps/default/keymap.c
+++ b/quantum/template/base/keymaps/default/keymap.c
@@ -70,7 +70,7 @@ void matrix_scan_user(void) {
}
-void led_set_user(uint8_t usb_led) {
-
+bool led_update_user(led_t led_state) {
+ return true;
}
*/