2
0

host_led_state_reader.c 442 B

123456789101112131415
  1. #include <stdio.h>
  2. #include "comet46.h"
  3. char host_led_state_str[22];
  4. const char *read_host_led_state(void) {
  5. uint8_t leds = host_keyboard_leds();
  6. snprintf(host_led_state_str, sizeof(host_led_state_str), "Lock: %s%s%s",
  7. (leds & (1 << USB_LED_CAPS_LOCK)) ? "CAPL " : "",
  8. (leds & (1 << USB_LED_SCROLL_LOCK)) ? "SCRL " : "",
  9. (leds & (1 << USB_LED_NUM_LOCK)) ? "NUML" : "");
  10. return host_led_state_str;
  11. }