working with delta only
This commit is contained in:
48
train.h
48
train.h
@ -7,26 +7,34 @@
|
||||
|
||||
class Train
|
||||
{
|
||||
private:
|
||||
uint8_t _address;
|
||||
|
||||
static const unsigned char _pinHigh = PD3;
|
||||
static const unsigned char _pinLow = PD2;
|
||||
|
||||
static const uint8_t SEND_COUNT = 4;
|
||||
|
||||
uint8_t lastSpeed = 0;
|
||||
|
||||
void sendBit(const bool bit);
|
||||
void sendAddress();
|
||||
void sendData(const uint8_t data);
|
||||
|
||||
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;
|
||||
|
||||
private:
|
||||
uint8_t _address;
|
||||
|
||||
static const unsigned char _pinHighA = PD5;
|
||||
static const unsigned char _pinLowA = PD4;
|
||||
static const unsigned char _pinHighB = PD2;
|
||||
static const unsigned char _pinLowB = PD3;
|
||||
|
||||
static const uint8_t SEND_COUNT = 4;
|
||||
|
||||
uint8_t _protocol = M_DIGITAL;
|
||||
|
||||
uint16_t lastdatapacket = 0;
|
||||
|
||||
inline static void off();
|
||||
void sendBit(const bool bit);
|
||||
void sendAddress();
|
||||
|
||||
public:
|
||||
|
||||
static void setOutput(const uint8_t state);
|
||||
|
||||
Train(const uint8_t address);
|
||||
@ -34,16 +42,22 @@ public:
|
||||
|
||||
void resendSpeed();
|
||||
|
||||
void setSpeed(uint8_t speed);
|
||||
|
||||
void reverse();
|
||||
|
||||
uint8_t getAddress();
|
||||
|
||||
uint8_t getSpeed();
|
||||
|
||||
uint8_t getProtocol();
|
||||
|
||||
void setSpeed(uint8_t speed);
|
||||
|
||||
void setProtocol(const uint8_t protocol);
|
||||
|
||||
void setAddress(const uint8_t address);
|
||||
|
||||
void sendFunction(const uint8_t function);
|
||||
void sendFunction(const uint16_t function);
|
||||
|
||||
void sendRaw(const uint16_t data);
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user