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);
|
|
|
|
void queueOnRequest();
|
|
|
|
void queueOffRequest();
|
|
|
|
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-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;
|
|
|
|
|