send sucess message if command is processed sucessfully
This commit is contained in:
51
train.h
51
train.h
@ -8,61 +8,62 @@
|
||||
class Train
|
||||
{
|
||||
public:
|
||||
static const uint8_t M_DELTA = 0;
|
||||
static const uint8_t M_DIGITAL = 1;
|
||||
|
||||
static const uint8_t HIGH = 2;
|
||||
static const uint8_t LOW = 1;
|
||||
static const uint8_t OFF = 0;
|
||||
static constexpr uint8_t HIGH = 2;
|
||||
static constexpr uint8_t LOW = 1;
|
||||
static constexpr uint8_t OFF = 0;
|
||||
|
||||
private:
|
||||
|
||||
static constexpr unsigned char _pinHighA = PD5;
|
||||
static constexpr unsigned char _pinLowA = PD4;
|
||||
static constexpr unsigned char _pinHighB = PD2;
|
||||
static constexpr unsigned char _pinLowB = PD3;
|
||||
|
||||
uint8_t _address;
|
||||
uint8_t _function = 0;
|
||||
uint8_t _functionmask;
|
||||
uint8_t _speed = 0;
|
||||
|
||||
static const unsigned char _pinHighA = PD5;
|
||||
static const unsigned char _pinLowA = PD4;
|
||||
static const unsigned char _pinHighB = PD2;
|
||||
static const unsigned char _pinLowB = PD3;
|
||||
bool _direction = false;
|
||||
|
||||
static const uint8_t SEND_COUNT = 2;
|
||||
|
||||
uint8_t _protocol = M_DIGITAL;
|
||||
|
||||
uint16_t lastDataPacket = 0;
|
||||
int8_t functionTimer = -1;
|
||||
|
||||
inline static void off();
|
||||
void sendBit(const bool bit);
|
||||
void sendAddress();
|
||||
void functionClear();
|
||||
static void sendBit(const bool bit);
|
||||
static void sendAddress(uint8_t address);
|
||||
uint16_t packetAddSpeed();
|
||||
uint16_t packetAddDirection();
|
||||
uint16_t packetAddFunction(const uint8_t function);
|
||||
uint16_t assemblePacket();
|
||||
|
||||
public:
|
||||
|
||||
static void setOutput(const uint8_t state);
|
||||
|
||||
Train(const uint8_t address, uint8_t protocol = M_DIGITAL);
|
||||
Train(const uint8_t address, uint8_t functionmask = 0b1111);
|
||||
Train();
|
||||
|
||||
|
||||
void resendData();
|
||||
|
||||
void reverse();
|
||||
|
||||
void stop();
|
||||
|
||||
bool isActive();
|
||||
bool isActive() {return _speed || _function;}
|
||||
|
||||
uint8_t getAddress();
|
||||
|
||||
uint16_t getLastPacket();
|
||||
|
||||
uint8_t getProtocol();
|
||||
|
||||
void setSpeed(uint8_t speed);
|
||||
|
||||
uint8_t getSpeed();
|
||||
|
||||
void setProtocol(const uint8_t protocol);
|
||||
void setFunctionMask(uint8_t functionmask) {_functionmask = functionmask;}
|
||||
|
||||
uint8_t getFunctions();
|
||||
|
||||
uint8_t getFunctionMask();
|
||||
|
||||
void setAddress(const uint8_t address);
|
||||
|
||||
@ -70,4 +71,6 @@ public:
|
||||
|
||||
void sendRaw(const uint16_t data);
|
||||
|
||||
static void sendRawAddr(const uint16_t address, const uint16_t data);
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user