diff options
| author | fauxpark <fauxpark@gmail.com> | 2019-11-06 11:42:16 +1100 |
|---|---|---|
| committer | Joel Challis <git@zvecr.com> | 2019-11-06 00:42:16 +0000 |
| commit | dfb78d2a086daa2ceb3fd043afce03785abfa23a (patch) | |
| tree | 7cd724b1cd12a65025bbc9d3cb32d7dd39cb9928 /quantum/quantum.c | |
| parent | ed0575fc8aacdfdd83a31fc98df2b1cad2e977f4 (diff) | |
| download | qmk_firmware-dfb78d2a086daa2ceb3fd043afce03785abfa23a.tar.gz qmk_firmware-dfb78d2a086daa2ceb3fd043afce03785abfa23a.zip | |
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.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c index 1f17c6ff7..c27c3aba6 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
| @@ -1070,10 +1070,30 @@ void api_send_unicode(uint32_t unicode) { | |||
| 1070 | #endif | 1070 | #endif |
| 1071 | } | 1071 | } |
| 1072 | 1072 | ||
| 1073 | /** \brief Lock LED set callback - keymap/user level | ||
| 1074 | * | ||
| 1075 | * \deprecated Use led_update_user() instead. | ||
| 1076 | */ | ||
| 1073 | __attribute__((weak)) void led_set_user(uint8_t usb_led) {} | 1077 | __attribute__((weak)) void led_set_user(uint8_t usb_led) {} |
| 1074 | 1078 | ||
| 1079 | /** \brief Lock LED set callback - keyboard level | ||
| 1080 | * | ||
| 1081 | * \deprecated Use led_update_kb() instead. | ||
| 1082 | */ | ||
| 1075 | __attribute__((weak)) void led_set_kb(uint8_t usb_led) { led_set_user(usb_led); } | 1083 | __attribute__((weak)) void led_set_kb(uint8_t usb_led) { led_set_user(usb_led); } |
| 1076 | 1084 | ||
| 1085 | /** \brief Lock LED update callback - keymap/user level | ||
| 1086 | * | ||
| 1087 | * \return True if led_update_kb() should run its own code, false otherwise. | ||
| 1088 | */ | ||
| 1089 | __attribute__((weak)) bool led_update_user(led_t led_state) { return true; } | ||
| 1090 | |||
| 1091 | /** \brief Lock LED update callback - keyboard level | ||
| 1092 | * | ||
| 1093 | * \return Ignored for now. | ||
| 1094 | */ | ||
| 1095 | __attribute__((weak)) bool led_update_kb(led_t led_state) { return led_update_user(led_state); } | ||
| 1096 | |||
| 1077 | __attribute__((weak)) void led_init_ports(void) {} | 1097 | __attribute__((weak)) void led_init_ports(void) {} |
| 1078 | 1098 | ||
| 1079 | __attribute__((weak)) void led_set(uint8_t usb_led) { | 1099 | __attribute__((weak)) void led_set(uint8_t usb_led) { |
| @@ -1096,6 +1116,7 @@ __attribute__((weak)) void led_set(uint8_t usb_led) { | |||
| 1096 | #endif | 1116 | #endif |
| 1097 | 1117 | ||
| 1098 | led_set_kb(usb_led); | 1118 | led_set_kb(usb_led); |
| 1119 | led_update_kb((led_t) usb_led); | ||
| 1099 | } | 1120 | } |
| 1100 | 1121 | ||
| 1101 | //------------------------------------------------------------------------------ | 1122 | //------------------------------------------------------------------------------ |
