60 lines
1.3 KiB
C++
60 lines
1.3 KiB
C++
#ifndef _HMICLASS_H_
|
|
#define _HMICLASS_H_
|
|
#include "arduino.h"
|
|
|
|
#define hmiSerial Serial1
|
|
#define dbgSerial Serial
|
|
|
|
class HmiClass
|
|
{
|
|
public:
|
|
|
|
void Setup();
|
|
void Update();
|
|
void SendIOStatus();
|
|
void SendSetupInfo();
|
|
void SendMessage(String message, bool isError);
|
|
bool SendValue(char msg, uint32_t value);
|
|
bool showDebug = false;
|
|
|
|
private:
|
|
|
|
void ClearTempBuffer0();
|
|
void ClearTempBuffer1();
|
|
byte Tempbuffer0[100];
|
|
byte Tempbuffer1[100];
|
|
byte bufferIndex0 = 0;
|
|
byte bufferIndex1 = 0;
|
|
|
|
unsigned long updatetime = 100; //데이터 전송 간격 측정을 위한 변수
|
|
|
|
void CheckReceiveS0(); //Serial0
|
|
void CheckReceiveS1(); //Serial1
|
|
|
|
char incomingByte0; //수신버퍼에서 읽은 데이터를 임시 저장
|
|
char incomingByte1; //수신버퍼에서 읽은 데이터를 임시 저장
|
|
|
|
//String buffer = ""; //수신버퍼 임시 저장 공간
|
|
//String Tempbuffer1 = "";
|
|
bool STX1S0 = false;
|
|
bool STX2S0 = false;
|
|
bool ETX1S0 = false;
|
|
|
|
bool STX1S1 = false;
|
|
bool STX2S1 = false;
|
|
bool ETX1S1 = false;
|
|
|
|
byte LEN1;
|
|
byte CHK1;
|
|
|
|
byte LEN0;
|
|
byte CHK0;
|
|
|
|
unsigned long hmimessagerepeat=0;
|
|
unsigned long hmimessagetime =0;
|
|
String hmimessage="";
|
|
void Parser(byte bufferIndex);
|
|
};
|
|
extern HmiClass hmi;
|
|
#endif
|