32 lines
577 B
C++
32 lines
577 B
C++
|
|
#ifndef SBUSPARSER_H
|
||
|
|
#define SBUSPARSER_H
|
||
|
|
|
||
|
|
#include <stdint.h>
|
||
|
|
#include <stdbool.h>
|
||
|
|
|
||
|
|
#define DeepOfFilter 5
|
||
|
|
|
||
|
|
|
||
|
|
class SBusParser
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
bool parse_char(uint8_t c);
|
||
|
|
uint16_t Channel[20];
|
||
|
|
private:
|
||
|
|
|
||
|
|
int16_t FilterFirstIni = DeepOfFilter;
|
||
|
|
uint16_t FilterCount = 0;
|
||
|
|
uint16_t Channel_Old[DeepOfFilter][20];//5次不跳跃才算做有效数据
|
||
|
|
|
||
|
|
uint8_t status = 0u;
|
||
|
|
unsigned int idx;
|
||
|
|
uint8_t Buf[25];
|
||
|
|
uint8_t sum;
|
||
|
|
uint8_t seq;
|
||
|
|
|
||
|
|
bool update(void);
|
||
|
|
uint16_t fine(uint16_t data,uint16_t compare,uint8_t type);
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif // SBUSPARSER_H
|