2018-09-23 06:31:09 +00:00
|
|
|
#include <Arduino.h>
|
2018-09-23 09:15:49 +00:00
|
|
|
#include "Protocol.h"
|
2018-09-23 06:31:09 +00:00
|
|
|
|
|
|
|
class CTxManage
|
|
|
|
{
|
2018-09-23 08:59:19 +00:00
|
|
|
const int m_nStartDelay = 20;
|
|
|
|
const int m_nFrameTime = 14;
|
|
|
|
const int m_nFrontPorch = 2;
|
|
|
|
|
2018-09-23 06:31:09 +00:00
|
|
|
public:
|
2018-10-20 07:11:23 +00:00
|
|
|
CTxManage(int TxGatePin, HardwareSerial& serial);
|
2018-11-07 10:31:00 +00:00
|
|
|
void queueOnRequest(bool set = true); // use false to remove repeating command
|
|
|
|
void queueOffRequest(bool set = true); // use false to remove repeating command
|
2018-11-06 09:43:54 +00:00
|
|
|
void queueRawCommand(unsigned char val);
|
2018-10-20 07:11:23 +00:00
|
|
|
void PrepareFrame(const CProtocol& Frame, bool isBTCmaster);
|
|
|
|
void Start(unsigned long timenow);
|
2018-09-23 08:59:19 +00:00
|
|
|
bool CheckTx(unsigned long timenow);
|
2018-09-23 06:31:09 +00:00
|
|
|
void begin();
|
2018-10-20 07:11:23 +00:00
|
|
|
const CProtocol& getFrame() const { return m_TxFrame; };
|
2018-09-23 06:31:09 +00:00
|
|
|
|
|
|
|
private:
|
2018-10-20 07:11:23 +00:00
|
|
|
CProtocol m_TxFrame;
|
2018-09-23 06:31:09 +00:00
|
|
|
bool m_bOnReq;
|
|
|
|
bool m_bOffReq;
|
|
|
|
bool m_bTxPending;
|
2018-10-20 07:11:23 +00:00
|
|
|
int m_nTxGatePin;
|
2018-11-06 09:43:54 +00:00
|
|
|
unsigned char _rawCommand;
|
2018-09-23 06:31:09 +00:00
|
|
|
unsigned long m_nStartTime;
|
2018-10-20 07:11:23 +00:00
|
|
|
HardwareSerial& m_BlueWireSerial;
|
2018-09-23 06:31:09 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2018-10-18 09:49:14 +00:00
|
|
|
extern CTxManage TxManage;
|
|
|
|
|