36 lines
710 B
C++
36 lines
710 B
C++
#ifndef RF433_H
|
|
#define RF433_H
|
|
|
|
#include<util/delay.h>
|
|
#include"writepin.h"
|
|
|
|
class WirelessRelay
|
|
{
|
|
public:
|
|
static const uint16_t LARGE_TIME = 750;
|
|
static const uint8_t SMALL_TIME = 250;
|
|
|
|
static const uint16_t MAX_NAME_LENGTH = 16;
|
|
|
|
private:
|
|
bool _state = false;
|
|
uint16_t _id;
|
|
char _name[MAX_NAME_LENGTH];
|
|
void sendBit(const bool i);
|
|
void sync();
|
|
void sendId();
|
|
|
|
public:
|
|
WirelessRelay(const uint16_t id, char nameIn[]);
|
|
WirelessRelay();
|
|
void init(const uint16_t id, char nameIn[]);
|
|
void on();
|
|
void off();
|
|
char* getName();
|
|
void setName(char* name);
|
|
uint16_t getId();
|
|
bool getExpectedState();
|
|
void resend();
|
|
};
|
|
#endif
|