~ruther/qmk_firmware

ref: ab8c5013c856bfa23289d7892be1c2bee808b542 qmk_firmware/keyboards/crkbd/lib/host_led_state_reader.c -rw-r--r-- 442 bytes
ab8c5013 — Ryan BIOI G60/Morgan65: use custom Bluetooth driver (#20897) 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>
#include "crkbd.h"

char host_led_state_str[24];

const char *read_host_led_state(void)
{
  uint8_t leds = host_keyboard_leds();
  snprintf(host_led_state_str, sizeof(host_led_state_str), "NL:%s CL:%s SL:%s",
           (leds & (1 << USB_LED_NUM_LOCK)) ? "on" : "- ",
           (leds & (1 << USB_LED_CAPS_LOCK)) ? "on" : "- ",
           (leds & (1 << USB_LED_SCROLL_LOCK)) ? "on" : "- ");

  return host_led_state_str;
}
Do not follow this link