12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #ifndef __hal_uart_H__
- #define __hal_uart_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 {
- UART0_T_HEART = 0,
- UART0_T_MOTION, //动作
- UART0_T_UPDATA, //数据更新
- UART0_T_PLAY, //比率设置
- UART0_T_SPEED, //速度设置
- UART0_T_RULE_ASK, //规则设置申请
- UART0_T_VOL_ASK, //声音设置申请
- UART0_T_PLAY_ASK, //比率设置申请
- UART0_T_SPEED_ASK, //速度设置申请
- UART0_T_BILL_ALL_ASK, //总帐申请
- UART0_T_BILL_PLAYER_ASK, //玩家帐目申请
- UART0_T_BILL_CLEAR, //清除所有玩家帐目
- UART0_T_RECOVER, //恢复出厂设置
- UART0_NUM_OF_T,
- }UART0_T_n;
- typedef enum {
- UART0_R_HEART = 0,
- UART0_R_RULE, //规则设置
- UART0_R_VOL, //声音设置
- UART0_R_PLAY, //比率设置
- UART0_R_SPEED, //速度设置
- UART0_R_BILL_ALL, //总帐
- UART0_R_BILL_PLAYER, //玩家帐目
- UART0_NUM_OF_R,
- }UART0_R_n;
- typedef void (*UART0_Callback)(void*);
- typedef struct _UART0_Rx{
- uint8_t cmd;
- uint8_t* pDat;
- uint8_t datLen;
- UART0_Callback cb;
- }UART0_Rx_t;
- typedef struct _UART0_Tx{
- uint8_t cmd;
- uint8_t* pDat;
- uint8_t datLen;
- uint8_t nTimes;
- uint32_t periodTime;
- uint32_t periodTimecnt;
- uint32_t waitTime;
- UART0_Callback cb;
- }UART0_Tx_t;
- void UART0_Initialize(void);
- void UART0_Send(unsigned char cmd,unsigned char *pDat,unsigned char datLen);
- int UART0_Tx_Send(unsigned char cmd,unsigned char *pDat,unsigned char datLen,uint8_t nTimes,uint32_t periodTime,uint32_t afterTime,uint32_t waitTime);
- int UART0_Rx_Regist(unsigned char cmd,UART0_Callback cb);
- int UART0_Tx_Regist(unsigned char cmd,UART0_Callback timeout_cb);
- void UART0_Tx_Clear(unsigned char cmd);
- #endif /* __DF_H */
|