12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #ifndef __hal_esb_H__
- #define __hal_esb_H__
- #include <stdbool.h>
- #include <stdint.h>
- #include <string.h>
- #include "sdk_common.h"
- #include "SEGGER_RTT.h"
- #include "usr_config.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #ifdef __cplusplus
- }
- #endif
- typedef enum {
- ESB_T_HEART = 0,
- ESB_T_MOTION, //动作
- ESB_T_UPDATA, //数据更新
- ESB_T_A2 = 0xa2, //数据更新
- ESB_NUM_OF_T,
- }ESB_T_n;
- typedef enum {
- ESB_R_HEART = 0,
- ESB_R_MOTION, //动作
- ESB_R_UPDATA, //数据更新
- ESB_R_A1 = 0xa1, //数据更新
- ESB_R_A2 = 0xa2, //数据更新
- ESB_NUM_OF_R,
- }ESB_R_n;
- typedef void (*ESB_Callback)(void*);
- typedef struct _ESB_Rx{
- uint8_t cmd;
- uint8_t* pDat;
- uint8_t datLen;
- ESB_Callback cb;
- }ESB_Rx_t;
- typedef struct _ESB_Tx{
- uint8_t cmd;
- uint8_t* pDat;
- uint8_t datLen;
- uint8_t nTimes;
- uint32_t periodTime;
- uint32_t periodTimecnt;
- uint32_t waitTime;
- ESB_Callback cb;
- }ESB_Tx_t;
- void ESB_Initialize(void);
- void ESB_Send(unsigned char cmd,unsigned char *pDat,unsigned char datLen);
- int ESB_Tx_Send(unsigned char cmd,unsigned char *pDat,unsigned char datLen,uint8_t nTimes,uint32_t periodTime,uint32_t afterTime,uint32_t waitTime);
- int ESB_Rx_Regist(unsigned char cmd,ESB_Callback cb);
- int ESB_Tx_Regist(unsigned char cmd,ESB_Callback timeout_cb);
- void ESB_Tx_Clear(unsigned char cmd);
- #endif /* __DF_H */
|