You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
565 B
C++
34 lines
565 B
C++
// CommandDecoder.h
|
|
|
|
#ifndef _COMMANDDECODER_h
|
|
#define _COMMANDDECODER_h
|
|
|
|
#if defined(ARDUINO) && ARDUINO >= 100
|
|
#include "arduino.h"
|
|
#else
|
|
#include "WProgram.h"
|
|
#endif
|
|
|
|
#include "GlobalDatas.h"
|
|
|
|
class CommandDecoder
|
|
{
|
|
private:
|
|
byte cmd[8] = { 0 };
|
|
private:
|
|
byte _CheckSUM(byte main, byte data1, byte data2, byte data3);
|
|
public:
|
|
CommandDecoder();
|
|
CommandDecoder(byte* arr);
|
|
CommandDecoder(const CommandDecoder& obj) = delete;
|
|
public:
|
|
bool CommandValidate();
|
|
public:
|
|
byte GetDevice();
|
|
byte GetMainCommand();
|
|
byte GetDataBit(byte num); //1 - 3
|
|
};
|
|
|
|
#endif
|
|
|