summaryrefslogtreecommitdiffstats
path: root/tmk_core/common
diff options
context:
space:
mode:
authorDidierLoiseau <didierloiseau+github@gmail.com>2019-01-18 02:28:33 +0100
committerDrashna Jaelre <drashna@live.com>2019-01-17 17:28:33 -0800
commit94ba2e5a9f9c01b015b447554bfee99f5bcee032 (patch)
treee43aaab00774e4d69e9c440eba1e4d2b4e523639 /tmk_core/common
parent77399bfe515f4dde5cb6c08dbc466ac1aa77cda3 (diff)
Defined IS_(HOST_)LED_ON/OFF() and improved LED documentation (#4853)
* Defined IS_(HOST_)LED_ON/OFF() and improved LED documentation * Update docs/custom_quantum_functions.md Co-Authored-By: DidierLoiseau <didierloiseau+github@gmail.com> * Update docs/custom_quantum_functions.md Co-Authored-By: DidierLoiseau <didierloiseau+github@gmail.com> * Integrated @drashna and @fauxpark's PR comments - changed all plurals of "LED" to "LEDs" in the file - rewording of the note about host_keyboard_leds() vs. led_set_user() * Update docs/custom_quantum_functions.md Co-Authored-By: DidierLoiseau <didierloiseau+github@gmail.com>
Diffstat (limited to 'tmk_core/common')
-rw-r--r--tmk_core/common/host.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/tmk_core/common/host.h b/tmk_core/common/host.h
index aeabba7107..e70bb68533 100644
--- a/tmk_core/common/host.h
+++ b/tmk_core/common/host.h
@@ -46,6 +46,12 @@ void host_consumer_send(uint16_t data);
uint16_t host_last_system_report(void);
uint16_t host_last_consumer_report(void);
+#define IS_LED_ON(USB_LED, LED_NAME) ((USB_LED) & (1 << (LED_NAME)))
+#define IS_LED_OFF(USB_LED, LED_NAME) (~(USB_LED) & (1 << (LED_NAME)))
+
+#define IS_HOST_LED_ON(LED_NAME) IS_LED_ON(host_keyboard_leds(), (LED_NAME))
+#define IS_HOST_LED_OFF(LED_NAME) IS_LED_OFF(host_keyboard_leds(), (LED_NAME))
+
#ifdef __cplusplus
}
#endif