Added oregon v2.1 support to ArduinoTellstick along with some code cleanup
Former-commit-id: d05ee71fa4f2f91afd6452e894385bbcd7020917
This commit is contained in:
parent
c2d03347ca
commit
1c23a7c360
11 changed files with 391 additions and 116 deletions
|
|
@ -3,13 +3,29 @@
|
|||
|
||||
#include "Arduino.h"
|
||||
|
||||
uint16_t calculateBufferPointerDistance(uint8_t* bufStartP, uint8_t* bufEndP);
|
||||
uint8_t* getNextBufferPointer(uint8_t* p);
|
||||
void stepBufferPointer(uint8_t** p);
|
||||
|
||||
extern uint8_t RF_rxBuffer[512]; //must have and even number of elements
|
||||
extern uint8_t* RF_rxBufferStartP;
|
||||
extern uint8_t* RF_rxBufferEndP;
|
||||
extern volatile uint8_t* bufferWriteP;
|
||||
|
||||
inline 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
|
||||
|
||||
inline uint8_t* getNextBufferPointer(uint8_t* p) {
|
||||
if ( p + 1 > RF_rxBufferEndP) {
|
||||
return RF_rxBufferStartP;
|
||||
} else {
|
||||
return p + 1;
|
||||
}
|
||||
}; //end getNextBufferPointer
|
||||
|
||||
inline void stepBufferPointer(uint8_t** p) {
|
||||
*p = getNextBufferPointer(*p);
|
||||
}; //end stepBufferPointer
|
||||
|
||||
#endif //BUFFER_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue