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.
120 lines
4.1 KiB
120 lines
4.1 KiB
/******************************************************************************
|
|
|
|
版权所有 (C), 2018-2099, Radkil_Std
|
|
|
|
******************************************************************************
|
|
文 件 名 : led.h
|
|
版 本 号 : 初稿
|
|
作 者 : Radkil
|
|
生成日期 : 2023年2月12日
|
|
最近修改 :
|
|
功能描述 : led.c 的头文件
|
|
|
|
修改历史 :
|
|
1.日 期 : 2023年2月12日
|
|
作 者 : Radkil
|
|
修改内容 : 创建文件
|
|
|
|
******************************************************************************/
|
|
|
|
/*----------------------------------------------*
|
|
* 外部变量说明 *
|
|
*----------------------------------------------*/
|
|
|
|
/*----------------------------------------------*
|
|
* 外部函数原型说明 *
|
|
*----------------------------------------------*/
|
|
|
|
/*----------------------------------------------*
|
|
* 内部函数原型说明 *
|
|
*----------------------------------------------*/
|
|
|
|
/*----------------------------------------------*
|
|
* 全局变量 *
|
|
*----------------------------------------------*/
|
|
|
|
/*----------------------------------------------*
|
|
* 模块级变量 *
|
|
*----------------------------------------------*/
|
|
|
|
/*----------------------------------------------*
|
|
* 常量定义 *
|
|
*----------------------------------------------*/
|
|
|
|
/*----------------------------------------------*
|
|
* 宏定义 *
|
|
*----------------------------------------------*/
|
|
|
|
#ifndef __LED_H__
|
|
#define __LED_H__
|
|
|
|
|
|
#ifdef __cplusplus
|
|
#if __cplusplus
|
|
extern "C"{
|
|
#endif
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
/*==============================================*
|
|
* include header files *
|
|
*----------------------------------------------*/
|
|
#include <stdint.h>
|
|
#include "slist.h"
|
|
#include "common.h"
|
|
|
|
/*==============================================*
|
|
* constants or macros define *
|
|
*----------------------------------------------*/
|
|
|
|
typedef struct T_led_t rd_led_t; /**< Agile Led 结构体 */
|
|
|
|
typedef struct
|
|
{
|
|
void *m_pLuaState;
|
|
int m_iPinRef;
|
|
} l_led_t;
|
|
|
|
struct T_led_t
|
|
{
|
|
int m_iActiveLogic; /**< 有效电平 */
|
|
uint8_t m_iActive; /**< 激活标志 */
|
|
uint8_t m_iLoopInit; /**< 循环次数 */
|
|
uint8_t m_iLoopCnt; /**< 循环次数计数 */
|
|
uint8_t m_iArrNum; /**< 数组元素数目 */
|
|
uint8_t m_iArrIndex; /**< 数组索引 */
|
|
const uint32_t *m_piLightArr; /**< 闪烁数组 */
|
|
uint32_t m_iTimeout; /**< 超时时间 */
|
|
void (*m_pCompelete)(rd_led_t *_ptLed); /**< 操作完成回调函数 */
|
|
l_led_t *m_pLed_t; /*用于适配lua层传给m_pCbkCtrl的入参*/
|
|
void (*m_pCbkCtrl)(l_led_t *pLed, int _iState); /**< io操作接口 */
|
|
rd_slist_t m_tSlist; /**< 单向链表节点 */
|
|
};
|
|
|
|
/*==============================================*
|
|
* project-wide global variables *
|
|
*----------------------------------------------*/
|
|
|
|
|
|
|
|
/*==============================================*
|
|
* routines' or functions' implementations *
|
|
*----------------------------------------------*/
|
|
|
|
extern rd_led_t *rd_LedCreate(int active_logic, const char *light_mode, uint8_t loop_cnt, void (*_pCbkCtrl)(l_led_t *pLed, int _iState), l_led_t *pLed_t);
|
|
extern int rd_LedDelete(rd_led_t *_ptLed);
|
|
extern int rd_LedDynamicChangeLightMode(rd_led_t *_ptLed, const char *light_mode, uint8_t loop_cnt);
|
|
extern void rd_LedOff(rd_led_t *_ptLed);
|
|
extern void rd_LedOn(rd_led_t *_ptLed);
|
|
extern void rd_LedProcess(void);
|
|
extern int rd_LedStart(rd_led_t *_ptLed);
|
|
extern int rd_LedStop(rd_led_t *_ptLed);
|
|
|
|
#ifdef __cplusplus
|
|
#if __cplusplus
|
|
}
|
|
#endif
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
#endif /* __LED_H__ */
|
|
|