1
0
This repo is archived. You can view files and clone it, but cannot push or open issues or pull requests.
tmk_keyboard_custom/common/ledmap.h

60 lines
1.5 KiB
C
Raw Permalink Normal View History

2014-07-19 02:27:00 +00:00
#ifndef LEDMAP_H
#define LEDMAP_H
2014-07-20 03:52:56 +00:00
#include "stdint.h"
#include "stdbool.h"
#include "led.h"
2014-07-19 02:27:00 +00:00
2014-07-20 03:52:56 +00:00
typedef led_pack_t led_state_t;
typedef led_pack_t led_binding_t;
2014-07-20 03:52:56 +00:00
enum ledmap_binding {
LEDMAP_BINDING_NO = 0,
LEDMAP_BINDING_DEFAULT_LAYER,
LEDMAP_BINDING_LAYER,
LEDMAP_BINDING_USB_LED
};
enum ledmap_usb_led {
LEDMAP_USB_LED_NUM_LOCK = 0,
LEDMAP_USB_LED_CAPS_LOCK,
LEDMAP_USB_LED_SCROLL_LOCK,
LEDMAP_USB_LED_COMPOSE,
LEDMAP_USB_LED_KANA,
};
typedef union {
uint16_t code;
struct {
uint8_t param: 8;
uint8_t binding: 4;
bool reverse: 1;
bool backlight: 1;
uint8_t reserved: 2;
};
} ledmap_t;
#define LEDMAP_DEFAULT_LAYER(layer) (LEDMAP_BINDING_DEFAULT_LAYER<<8 | layer)
#define LEDMAP_LAYER(layer) (LEDMAP_BINDING_LAYER<<8 | layer )
#define LEDMAP_NUM_LOCK (LEDMAP_BINDING_USB_LED<<8 | LEDMAP_USB_LED_NUM_LOCK)
#define LEDMAP_CAPS_LOCK (LEDMAP_BINDING_USB_LED<<8 | LEDMAP_USB_LED_CAPS_LOCK)
#define LEDMAP_SCROLL_LOCK (LEDMAP_BINDING_USB_LED<<8 | LEDMAP_USB_LED_SCROLL_LOCK)
#define LEDMAP_REVERSE (1<<12)
#define LEDMAP_BACKLIGHT (1<<13)
2014-07-20 03:52:56 +00:00
void ledmap_init(void);
2014-07-20 03:52:56 +00:00
#ifdef LEDMAP_ENABLE
ledmap_t ledmap_get_code(uint8_t index);
2014-07-20 03:52:56 +00:00
void ledmap_led_init(void);
void ledmap_led_on(uint8_t index);
void ledmap_led_off(uint8_t index);
2014-07-19 02:27:00 +00:00
#else
#define ledmap_get_code()
2014-07-20 03:52:56 +00:00
#define ledmap_led_init()
#define ledmap_led_on()
#define ledmap_led_off()
2014-07-19 02:27:00 +00:00
#endif
#endif