Files
microchip-application-bmd38…/led_drv.h
T
chain40 a27733c879 feat: 實作按鍵功能
1. 長按三秒上電
2. 長按三秒斷電
3. 支援短按 1~3 下
2024-05-29 21:14:00 +08:00

91 lines
2.6 KiB
C

#pragma once
#ifndef __LED_DRV_H__
#define __LED_DRV_H__
#include "app_config.h"
#include "led_drv_if.h"
#define LED_DRV_ERROR (-1)
#define LED_DRV_SUCCESS (0)
#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_ORANGE \
(struct led_color) \
{ \
.R = 0xFF, .G = 0x58, .B = 0x09 \
}
#define LED_YELLOW \
(struct led_color) \
{ \
.R = 0xEF, .G = 0x9F, .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 \
}
#define LED_BLUE \
(struct led_color) \
{ \
.R = 0x00, .G = 0x00, .B = 0xFF \
}
#define LED_PURPLE \
(struct led_color) \
{ \
.R = 0xFF, .G = 0x00, .B = 0xFF \
}
#define LED_ORANGE \
(struct led_color) \
{ \
.R = 0xFF, .G = 0x58, .B = 0x09 \
}
#define LED_OFF LED_NONE
#define LED_ON LED_GREEN
#define LED_ERROR LED_RED
#define LED_IDEL_DISCONNECT LED_YELLOW
#define LED_IDEL_CONNECTED LED_GREEN
#define LED_REC LED_CYAN
#define LED_IDENTICY_DEV LED_PURPLE
#define LED_BUTTON_PRESS LED_YELLOW
#define BT_WAIT 0x01
#define NO_EVENT 0x02
#define PRE_WORK 0x03
#define WORKING 0x04
#define POST_WORK 0x05
#if (DEF_LED_DRV_ENABLED)
int32_t
led_init(void);
int32_t led_set(struct led_color color);
int32_t led_single_led_set(uint32_t idx, struct led_color color, uint8_t brightness);
int32_t led_mode(uint16_t mode_status);
int32_t led_as_rainbow(void);
#else
#define led_init()
#define led_set(x)
#define led_single_led_set(x, y, z)
#define led_mode(x)
#define led_as_rainbow(x)
#endif /* ! DEF_LED_DRV_ENABLED */
#endif // __LED_DRV_H__