host_led_state_reader.c 422 B

12345678910111213141516
  1. #include <stdio.h>
  2. #include "led.h"
  3. #include "host.h"
  4. char host_led_state_str[22];
  5. const char *read_host_led_state(void) {
  6. led_t led_state = host_keyboard_led_state();
  7. snprintf(host_led_state_str, sizeof(host_led_state_str), "Lock: %s%s%s",
  8. led_state.caps_lock ? "CAPL " : "",
  9. led_state.scroll_lock ? "SCRL " : "",
  10. led_state.num_lock ? "NUML" : "");
  11. return host_led_state_str;
  12. }