feat: 增加简单串口通信帧发送解析功能
This commit is contained in:
24
app/by_frame.h
Normal file
24
app/by_frame.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef _BY_FRAME_H__
|
||||
#define _BY_FRAME_H__
|
||||
|
||||
/* BY_TINY_FRAME 的超级减配版本(好吧基本上完全没有关系)
|
||||
* 主要是等应答还是挺慢的,写数据场景只需要下位机校验数据合理性即可,读数据等应答即可
|
||||
* 并且需要同步的参数并不多,所以考虑直接使用定长的特定结构的帧,一帧全部下发
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "at32f403a_407.h"
|
||||
|
||||
#define BY_FRAME_HEAD (0XEB)
|
||||
|
||||
#define BY_FRAME_UART_INDEX (USART3)
|
||||
|
||||
#define BY_FRAME_DATA_NUM (3)
|
||||
|
||||
extern void by_frame_init(void);
|
||||
void by_frame_send(uint8_t cmd, uint32_t *data_array);
|
||||
uint8_t by_frame_parse(uint8_t *cmd, uint32_t *data_array);
|
||||
extern void by_frame_parse_uart_handle(uint8_t data);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user