initial commit
This commit is contained in:
29
by_frame.h
Normal file
29
by_frame.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef _BY_FRAME_H__
|
||||
#define _BY_FRAME_H__
|
||||
|
||||
/* BY_TINY_FRAME 的超级减配版本(好吧基本上完全没有关系)
|
||||
* 主要是等应答还是挺慢的,写数据场景只需要下位机校验数据合理性即可,读数据等应答即可
|
||||
* 并且需要同步的参数并不多,所以考虑直接使用定长的特定结构的帧,一帧全部下发
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#define BY_FRAME_HEAD (0XEB)
|
||||
|
||||
#define BY_FRAME_DATA_NUM (2)
|
||||
#define BY_FRANE_DATA_LEN (BY_FRAME_DATA_NUM * sizeof(uint32_t))
|
||||
#define BY_FRANE_LEN (BY_FRANE_DATA_LEN + 4)
|
||||
|
||||
typedef struct by_frame_queue_t {
|
||||
uint8_t *buff;
|
||||
int len;
|
||||
int size;
|
||||
} by_frame_queue_t;
|
||||
|
||||
extern int by_frame_init(void);
|
||||
extern int by_frame_parse(uint8_t *cmd, uint32_t *data_array);
|
||||
extern void by_frame_send(uint8_t cmd, uint8_t *data_array, uint8_t len);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user