You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

ledmap.h 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef LEDMAP_H
  2. #define LEDMAP_H
  3. #include "stdint.h"
  4. #include "stdbool.h"
  5. #include "led.h"
  6. typedef led_pack_t led_state_t;
  7. typedef led_pack_t led_binding_t;
  8. typedef enum {
  9. LEDMAP_NO = 0,
  10. LEDMAP_DEFAULT_LAYER_0,
  11. LEDMAP_DEFAULT_LAYER_31 = LEDMAP_DEFAULT_LAYER_0 + 31,
  12. LEDMAP_LAYER_0,
  13. LEDMAP_LAYER_31 = LEDMAP_LAYER_0 + 31,
  14. LEDMAP_NUM_LOCK,
  15. LEDMAP_CAPS_LOCK,
  16. LEDMAP_SCROLL_LOCK,
  17. LEDMAP_COMPOSE,
  18. LEDMAP_KANA,
  19. LEDMAP_BACKLIGHT = 0x80
  20. } ledmap_code_t;
  21. #define LEDMAP_MASK 0x7F
  22. typedef union {
  23. uint8_t raw;
  24. struct {
  25. uint8_t binding : 7;
  26. bool backlight : 1;
  27. };
  28. } ledmap_t;
  29. #define LEDMAP_DEFAULT_LAYER(x) (LEDMAP_DEFAULT_LAYER_0 + x)
  30. #define LEDMAP_LAYER(x) (LEDMAP_LAYER_0 + x)
  31. void ledmap_init(void);
  32. #ifdef LEDMAP_ENABLE
  33. uint8_t ledmap_get_code(uint8_t index);
  34. void ledmap_led_init(void);
  35. void ledmap_led_on(uint8_t index);
  36. void ledmap_led_off(uint8_t index);
  37. #else
  38. #define ledmaps
  39. #define ledmap_get()
  40. #define ledmap_led_init()
  41. #define ledmap_led_on()
  42. #define ledmap_led_off()
  43. #endif
  44. #endif