update rc-switch (#313)
This commit is contained in:
1 parent
469bb48d52
commit
5d01071e43
2 files changed
+321
-53
No files matched your search
@@ -58,7 +58,8 @@
|
||||
|
||||
// Number of maximum high/Low changes per packet.
|
||||
// We can handle up to (unsigned long) => 32 bit * 2 H/L changes per bit + 2 for sync
|
||||
#define RCSWITCH_MAX_CHANGES 67
|
||||
// Для keeloq нужно увеличить RCSWITCH_MAX_CHANGES до 23+1+66*2+1=157
|
||||
#define RCSWITCH_MAX_CHANGES 157 // default 67
|
||||
|
||||
class RCSwitch {
|
||||
|
||||
@@ -77,7 +78,7 @@ class RCSwitch {
|
||||
void switchOff(char sGroup, int nDevice);
|
||||
|
||||
void sendTriState(const char* sCodeWord);
|
||||
void send(unsigned long code, unsigned int length);
|
||||
void send(unsigned long long code, unsigned int length);
|
||||
void send(const char* sCodeWord);
|
||||
|
||||
#if not defined( RCSwitchDisableReceiving )
|
||||
@@ -87,7 +88,7 @@ class RCSwitch {
|
||||
bool available();
|
||||
void resetAvailable();
|
||||
|
||||
unsigned long getReceivedValue();
|
||||
unsigned long long getReceivedValue();
|
||||
unsigned int getReceivedBitlength();
|
||||
unsigned int getReceivedDelay();
|
||||
unsigned int getReceivedProtocol();
|
||||
@@ -120,8 +121,11 @@ class RCSwitch {
|
||||
struct Protocol {
|
||||
/** base pulse length in microseconds, e.g. 350 */
|
||||
uint16_t pulseLength;
|
||||
uint8_t PreambleFactor;
|
||||
HighLow Preamble;
|
||||
uint8_t HeaderFactor;
|
||||
HighLow Header;
|
||||
|
||||
HighLow syncFactor;
|
||||
HighLow zero;
|
||||
HighLow one;
|
||||
|
||||
@@ -142,6 +146,7 @@ class RCSwitch {
|
||||
* FOO.low*pulseLength microseconds.
|
||||
*/
|
||||
bool invertedSignal;
|
||||
uint16_t Guard;
|
||||
};
|
||||
|
||||
void setProtocol(Protocol protocol);
|
||||
@@ -167,7 +172,7 @@ class RCSwitch {
|
||||
|
||||
#if not defined( RCSwitchDisableReceiving )
|
||||
static int nReceiveTolerance;
|
||||
volatile static unsigned long nReceivedValue;
|
||||
volatile static unsigned long long nReceivedValue;
|
||||
volatile static unsigned int nReceivedBitlength;
|
||||
volatile static unsigned int nReceivedDelay;
|
||||
volatile static unsigned int nReceivedProtocol;
|
||||
@@ -176,9 +181,25 @@ class RCSwitch {
|
||||
* timings[0] contains sync timing, followed by a number of bits
|
||||
*/
|
||||
static unsigned int timings[RCSWITCH_MAX_CHANGES];
|
||||
// буфер длительностей последних четырех пакетов, [0] - последний
|
||||
static unsigned int buftimings[4];
|
||||
#endif
|
||||
|
||||
|
||||
};
|
||||
|
||||
class Keeloq {
|
||||
public:
|
||||
Keeloq();
|
||||
void SetKey(unsigned long keyHigh, unsigned long keyLow);
|
||||
unsigned long GetKey(bool HighLow);
|
||||
unsigned long Encrypt(unsigned long data);
|
||||
unsigned long Decrypt(unsigned long data);
|
||||
void NormLearn(unsigned long FixSN);
|
||||
unsigned long ReflectPack(unsigned long PackSrc);
|
||||
private:
|
||||
unsigned long _keyHigh;
|
||||
unsigned long _keyLow;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user