Implemented a clone of the Tellstick Duo firmware that will wotrk on a Arduino.
So far only supports the Archtech Self Learning protocol. Former-commit-id: 705f787fc30459a9d55dc571632dc4d01e7198f0
This commit is contained in:
parent
3c5da7baaf
commit
e269faec13
11 changed files with 441 additions and 0 deletions
26
arduino/ArduinoTellstickDuo/buffer.cpp
Normal file
26
arduino/ArduinoTellstickDuo/buffer.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#include "buffer.h"
|
||||
|
||||
uint8_t RF_rxBuffer[512]; //must have and even number of elements
|
||||
uint8_t* RF_rxBufferStartP = &RF_rxBuffer[0];
|
||||
uint8_t* RF_rxBufferEndP = &RF_rxBuffer[511];
|
||||
volatile uint8_t* bufferWriteP = RF_rxBufferStartP;
|
||||
|
||||
uint16_t calculateBufferPointerDistance(uint8_t* bufStartP, uint8_t* bufEndP) {
|
||||
if (bufStartP <= bufEndP) {
|
||||
return bufEndP - bufStartP + 1;
|
||||
} else {
|
||||
return (RF_rxBufferEndP - bufStartP) + (bufEndP - RF_rxBufferStartP) + 2;
|
||||
}
|
||||
}; //end calculateBufferPointerDistance
|
||||
|
||||
uint8_t* getNextBufferPointer(uint8_t* p) {
|
||||
if ( p + 1 > RF_rxBufferEndP) {
|
||||
return RF_rxBufferStartP;
|
||||
} else {
|
||||
return p + 1;
|
||||
}
|
||||
}; //end getNextBufferPointer
|
||||
|
||||
void stepBufferPointer(uint8_t** p) {
|
||||
*p = getNextBufferPointer(*p);
|
||||
}; //end stepBufferPointer
|
||||
Loading…
Add table
Add a link
Reference in a new issue