39 lines
726 B
C
39 lines
726 B
C
#ifndef __LED_H__
|
|
#define __LED_H__
|
|
|
|
#include <global.h>
|
|
|
|
struct apa102_pkt {
|
|
uint8_t global;
|
|
uint8_t b; /* each channel 8 bit 0-255 */
|
|
uint8_t g;
|
|
uint8_t r;
|
|
} __attribute__((packed));
|
|
|
|
enum status_led {
|
|
LED_CONNECTED,
|
|
LED_ACQUIRING,
|
|
LED_ERROR,
|
|
LED_OVERLOAD,
|
|
LED_BUTTONS,
|
|
LED_DISPLAY,
|
|
LED_POWER,
|
|
LED_ENCODER,
|
|
LED_CHANNEL_A,
|
|
LED_CHANNEL_B,
|
|
LED_N_TOTAL,
|
|
};
|
|
|
|
struct led_state {
|
|
uint32_t _zeros;
|
|
struct apa102_pkt led[LED_N_TOTAL];
|
|
uint32_t _ones;
|
|
} __attribute__((packed));
|
|
|
|
extern struct led_state st_led;
|
|
|
|
void led_init(void);
|
|
void led_set_global_brightness(int brightness);
|
|
void set_led(int led, uint8_t r, uint8_t g, uint8_t b);
|
|
|
|
#endif /* __LED_H__ */
|