~ruther/qmk_firmware

ref: 8c9f54d70b12156781ba5757697079b83dff79a7 qmk_firmware/keyboards/satt/comet46/lib/host_led_state_reader.c -rw-r--r-- 442 bytes
8c9f54d7 — Nick Brassel Encoder map: NUM_DIRECTIONS (#21066) 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>
#include "quantum.h"

char host_led_state_str[22];

const char *read_host_led_state(void) {
  uint8_t leds = host_keyboard_leds();

  snprintf(host_led_state_str, sizeof(host_led_state_str), "Lock: %s%s%s",
           (leds & (1 << USB_LED_CAPS_LOCK)) ? "CAPL " : "",
           (leds & (1 << USB_LED_SCROLL_LOCK)) ? "SCRL " : "",
           (leds & (1 << USB_LED_NUM_LOCK)) ? "NUML" : "");

  return host_led_state_str;
}