From 94ba2e5a9f9c01b015b447554bfee99f5bcee032 Mon Sep 17 00:00:00 2001 From: DidierLoiseau Date: Fri, 18 Jan 2019 02:28:33 +0100 Subject: 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 * Update docs/custom_quantum_functions.md Co-Authored-By: DidierLoiseau * 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 --- tmk_core/common/host.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tmk_core') diff --git a/tmk_core/common/host.h b/tmk_core/common/host.h index aeabba710..e70bb6853 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 -- cgit v1.2.3-24-g4f1b