Files
microchip-application-bmd38…/led.h
T
2024-01-03 14:40:04 +08:00

42 lines
1.1 KiB
C

#pragma once
#ifndef __LED_H__
#define __LED_H__
#include <stdint.h>
struct led_color
{
uint8_t B;
uint8_t G;
uint8_t R;
};
#define LED_NONE \
(struct led_color) { .R = 0x00, .G = 0x00, .B = 0x00 }
#define LED_RED \
(struct led_color) { .R = 0xFF, .G = 0x00, .B = 0x00 }
#define LED_GREEN \
(struct led_color) { .R = 0x00, .G = 0xFF, .B = 0x00 }
#define LED_CYAN \
(struct led_color) { .R = 0x00, .G = 0xFF, .B = 0xFF } // connect to neulive
#define LED_BLUE \
(struct led_color) { .R = 0x00, .G = 0x00, .B = 0xFF } // neulive recording
#define LED_YELLOW \
(struct led_color) { .R = 0xEF, .G = 0x9F, .B = 0x00 } // neulive stimulate
#define LED_PURPLE \
(struct led_color) { .R = 0xFF, .G = 0x00, .B = 0xFF } // neulive rec + sti
#define LED_OFF LED_NONE
#define LED_ERROR LED_RED
#define LED_ON LED_GREEN
#define LED_CONNECTED LED_CYAN
#define LED_REC LED_BLUE
#define LED_STIMU LED_YELLOW
#define LED_STIMU_REC LED_PURPLE
void led_init(void);
void led_off(void);
void led_set(uint32_t idx, struct led_color color, uint8_t brightness);
#endif // !__LED_H__