27 lines
790 B
C++
27 lines
790 B
C++
#include "Arduino.h"
|
|
#include "config.h"
|
|
|
|
class Serialcommand
|
|
{
|
|
private:
|
|
static const int inbuffersize = 20;
|
|
int CmdState; // 指令接收状态
|
|
uint8_t ch; // 临时单个字符存储
|
|
int datalen;
|
|
bool recv_flag; // 指令接收成功标志
|
|
uint8_t inBuffer[inbuffersize]; // 接收指令缓冲区
|
|
uint8_t bufferIndex;
|
|
static const int outbuffersize = 20;
|
|
uint8_t outBuffer[outbuffersize];
|
|
void Uart_Command_Rev(void);
|
|
uint8_t getsum(const uint8_t *buffer, size_t size);
|
|
bool checksum();
|
|
void sendcmdret(uint8_t cmdret);
|
|
|
|
public:
|
|
Serialcommand(); // 构造函数
|
|
~Serialcommand(); // 析构函数
|
|
void getcommand();
|
|
void sendinfo(HookStatus status, int linelength, int pullweight);
|
|
};
|