[PHY] Reworked macro configuration system
This commit is contained in:
parent
074b707924
commit
395101ec20
2 changed files with 14 additions and 14 deletions
|
@ -4,7 +4,7 @@
|
||||||
PhysicalLayer::PhysicalLayer(float step, size_t maxLen) {
|
PhysicalLayer::PhysicalLayer(float step, size_t maxLen) {
|
||||||
this->freqStep = step;
|
this->freqStep = step;
|
||||||
this->maxPacketLength = maxLen;
|
this->maxPacketLength = maxLen;
|
||||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||||
this->bufferBitPos = 0;
|
this->bufferBitPos = 0;
|
||||||
this->bufferWritePos = 0;
|
this->bufferWritePos = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,7 +24,7 @@ int16_t PhysicalLayer::transmit(__FlashStringHelper* fstr, uint8_t addr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// dynamically allocate memory
|
// dynamically allocate memory
|
||||||
#if defined(RADIOLIB_STATIC_ONLY)
|
#if RADIOLIB_STATIC_ONLY
|
||||||
char str[RADIOLIB_STATIC_ARRAY_SIZE];
|
char str[RADIOLIB_STATIC_ARRAY_SIZE];
|
||||||
#else
|
#else
|
||||||
char* str = new char[len];
|
char* str = new char[len];
|
||||||
|
@ -38,7 +38,7 @@ int16_t PhysicalLayer::transmit(__FlashStringHelper* fstr, uint8_t addr) {
|
||||||
|
|
||||||
// transmit string
|
// transmit string
|
||||||
int16_t state = transmit(str, addr);
|
int16_t state = transmit(str, addr);
|
||||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
#if !RADIOLIB_STATIC_ONLY
|
||||||
delete[] str;
|
delete[] str;
|
||||||
#endif
|
#endif
|
||||||
return(state);
|
return(state);
|
||||||
|
@ -68,7 +68,7 @@ int16_t PhysicalLayer::receive(String& str, size_t len) {
|
||||||
size_t length = len;
|
size_t length = len;
|
||||||
|
|
||||||
// build a temporary buffer
|
// build a temporary buffer
|
||||||
#if defined(RADIOLIB_STATIC_ONLY)
|
#if RADIOLIB_STATIC_ONLY
|
||||||
uint8_t data[RADIOLIB_STATIC_ARRAY_SIZE + 1];
|
uint8_t data[RADIOLIB_STATIC_ARRAY_SIZE + 1];
|
||||||
#else
|
#else
|
||||||
uint8_t* data = NULL;
|
uint8_t* data = NULL;
|
||||||
|
@ -101,7 +101,7 @@ int16_t PhysicalLayer::receive(String& str, size_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// deallocate temporary buffer
|
// deallocate temporary buffer
|
||||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
#if !RADIOLIB_STATIC_ONLY
|
||||||
delete[] data;
|
delete[] data;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ int16_t PhysicalLayer::readData(String& str, size_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// build a temporary buffer
|
// build a temporary buffer
|
||||||
#if defined(RADIOLIB_STATIC_ONLY)
|
#if RADIOLIB_STATIC_ONLY
|
||||||
uint8_t data[RADIOLIB_STATIC_ARRAY_SIZE + 1];
|
uint8_t data[RADIOLIB_STATIC_ARRAY_SIZE + 1];
|
||||||
#else
|
#else
|
||||||
uint8_t* data = new uint8_t[length + 1];
|
uint8_t* data = new uint8_t[length + 1];
|
||||||
|
@ -198,7 +198,7 @@ int16_t PhysicalLayer::readData(String& str, size_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// deallocate temporary buffer
|
// deallocate temporary buffer
|
||||||
#if !defined(RADIOLIB_STATIC_ONLY)
|
#if !RADIOLIB_STATIC_ONLY
|
||||||
delete[] data;
|
delete[] data;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -366,7 +366,7 @@ int16_t PhysicalLayer::startDirect() {
|
||||||
return(state);
|
return(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||||
int16_t PhysicalLayer::available() {
|
int16_t PhysicalLayer::available() {
|
||||||
return(this->bufferWritePos);
|
return(this->bufferWritePos);
|
||||||
}
|
}
|
||||||
|
@ -477,7 +477,7 @@ void PhysicalLayer::clearChannelScanAction() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(RADIOLIB_INTERRUPT_TIMING)
|
#if RADIOLIB_INTERRUPT_TIMING
|
||||||
void PhysicalLayer::setInterruptSetup(void (*func)(uint32_t)) {
|
void PhysicalLayer::setInterruptSetup(void (*func)(uint32_t)) {
|
||||||
Module* mod = getMod();
|
Module* mod = getMod();
|
||||||
mod->TimerSetupCb = func;
|
mod->TimerSetupCb = func;
|
||||||
|
|
|
@ -380,7 +380,7 @@ class PhysicalLayer {
|
||||||
*/
|
*/
|
||||||
int16_t startDirect();
|
int16_t startDirect();
|
||||||
|
|
||||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||||
/*!
|
/*!
|
||||||
\brief Set sync word to be used to determine start of packet in direct reception mode.
|
\brief Set sync word to be used to determine start of packet in direct reception mode.
|
||||||
\param syncWord Sync word bits.
|
\param syncWord Sync word bits.
|
||||||
|
@ -463,7 +463,7 @@ class PhysicalLayer {
|
||||||
*/
|
*/
|
||||||
virtual void clearChannelScanAction();
|
virtual void clearChannelScanAction();
|
||||||
|
|
||||||
#if defined(RADIOLIB_INTERRUPT_TIMING)
|
#if RADIOLIB_INTERRUPT_TIMING
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Set function to be called to set up the timing interrupt.
|
\brief Set function to be called to set up the timing interrupt.
|
||||||
|
@ -480,18 +480,18 @@ class PhysicalLayer {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||||
protected:
|
protected:
|
||||||
void updateDirectBuffer(uint8_t bit);
|
void updateDirectBuffer(uint8_t bit);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(RADIOLIB_GODMODE)
|
#if !RADIOLIB_GODMODE
|
||||||
private:
|
private:
|
||||||
#endif
|
#endif
|
||||||
float freqStep;
|
float freqStep;
|
||||||
size_t maxPacketLength;
|
size_t maxPacketLength;
|
||||||
|
|
||||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||||
uint8_t bufferBitPos;
|
uint8_t bufferBitPos;
|
||||||
uint8_t bufferWritePos;
|
uint8_t bufferWritePos;
|
||||||
uint8_t bufferReadPos;
|
uint8_t bufferReadPos;
|
||||||
|
|
Loading…
Add table
Reference in a new issue