]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboards/comet46/lib/host_led_state_reader.c
[Keyboard] Snagpad Configurator bugfix and readme refactor (#6381)
[qmk_firmware.git] / keyboards / comet46 / lib / host_led_state_reader.c
1 #include <stdio.h>
2 #include "comet46.h"
3
4 char host_led_state_str[22];
5
6 const char *read_host_led_state(void) {
7   uint8_t leds = host_keyboard_leds();
8
9   snprintf(host_led_state_str, sizeof(host_led_state_str), "Lock: %s%s%s",
10            (leds & (1 << USB_LED_CAPS_LOCK)) ? "CAPL " : "",
11            (leds & (1 << USB_LED_SCROLL_LOCK)) ? "SCRL " : "",
12            (leds & (1 << USB_LED_NUM_LOCK)) ? "NUML" : "");
13
14   return host_led_state_str;
15 }