[PHY] Use compact Doxygen and stop using reserved format
This commit is contained in:
parent
767a2b006a
commit
78a576df12
2 changed files with 49 additions and 49 deletions
|
@ -1,12 +1,12 @@
|
||||||
#include "PhysicalLayer.h"
|
#include "PhysicalLayer.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
PhysicalLayer::PhysicalLayer(float freqStep, size_t maxPacketLength) {
|
PhysicalLayer::PhysicalLayer(float step, size_t maxLen) {
|
||||||
_freqStep = freqStep;
|
this->freqStep = step;
|
||||||
_maxPacketLength = maxPacketLength;
|
this->maxPacketLength = maxLen;
|
||||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||||
_bufferBitPos = 0;
|
this->bufferBitPos = 0;
|
||||||
_bufferWritePos = 0;
|
this->bufferWritePos = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ int16_t PhysicalLayer::receive(String& str, size_t len) {
|
||||||
#else
|
#else
|
||||||
uint8_t* data = NULL;
|
uint8_t* data = NULL;
|
||||||
if(length == 0) {
|
if(length == 0) {
|
||||||
data = new uint8_t[_maxPacketLength + 1];
|
data = new uint8_t[this->maxPacketLength + 1];
|
||||||
} else {
|
} else {
|
||||||
data = new uint8_t[length + 1];
|
data = new uint8_t[length + 1];
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ int16_t PhysicalLayer::setEncoding(uint8_t encoding) {
|
||||||
}
|
}
|
||||||
|
|
||||||
float PhysicalLayer::getFreqStep() const {
|
float PhysicalLayer::getFreqStep() const {
|
||||||
return(_freqStep);
|
return(this->freqStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t PhysicalLayer::getPacketLength(bool update) {
|
size_t PhysicalLayer::getPacketLength(bool update) {
|
||||||
|
@ -307,13 +307,13 @@ int16_t PhysicalLayer::startDirect() {
|
||||||
|
|
||||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||||
int16_t PhysicalLayer::available() {
|
int16_t PhysicalLayer::available() {
|
||||||
return(_bufferWritePos);
|
return(this->bufferWritePos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicalLayer::dropSync() {
|
void PhysicalLayer::dropSync() {
|
||||||
if(_directSyncWordLen > 0) {
|
if(this->directSyncWordLen > 0) {
|
||||||
_gotSync = false;
|
this->gotSync = false;
|
||||||
_syncBuffer = 0;
|
this->syncBuffer = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,21 +321,21 @@ uint8_t PhysicalLayer::read(bool drop) {
|
||||||
if(drop) {
|
if(drop) {
|
||||||
dropSync();
|
dropSync();
|
||||||
}
|
}
|
||||||
_bufferWritePos--;
|
this->bufferWritePos--;
|
||||||
return(_buffer[_bufferReadPos++]);
|
return(this->buffer[this->bufferReadPos++]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t PhysicalLayer::setDirectSyncWord(uint32_t syncWord, uint8_t len) {
|
int16_t PhysicalLayer::setDirectSyncWord(uint32_t syncWord, uint8_t len) {
|
||||||
if(len > 32) {
|
if(len > 32) {
|
||||||
return(RADIOLIB_ERR_INVALID_SYNC_WORD);
|
return(RADIOLIB_ERR_INVALID_SYNC_WORD);
|
||||||
}
|
}
|
||||||
_directSyncWordMask = 0xFFFFFFFF >> (32 - len);
|
this->directSyncWordMask = 0xFFFFFFFF >> (32 - len);
|
||||||
_directSyncWordLen = len;
|
this->directSyncWordLen = len;
|
||||||
_directSyncWord = syncWord;
|
this->directSyncWord = syncWord;
|
||||||
|
|
||||||
// override sync word matching when length is set to 0
|
// override sync word matching when length is set to 0
|
||||||
if(_directSyncWordLen == 0) {
|
if(this->directSyncWordLen == 0) {
|
||||||
_gotSync = true;
|
this->gotSync = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(RADIOLIB_ERR_NONE);
|
return(RADIOLIB_ERR_NONE);
|
||||||
|
@ -343,35 +343,35 @@ int16_t PhysicalLayer::setDirectSyncWord(uint32_t syncWord, uint8_t len) {
|
||||||
|
|
||||||
void PhysicalLayer::updateDirectBuffer(uint8_t bit) {
|
void PhysicalLayer::updateDirectBuffer(uint8_t bit) {
|
||||||
// check sync word
|
// check sync word
|
||||||
if(!_gotSync) {
|
if(!this->gotSync) {
|
||||||
_syncBuffer <<= 1;
|
this->syncBuffer <<= 1;
|
||||||
_syncBuffer |= bit;
|
this->syncBuffer |= bit;
|
||||||
|
|
||||||
RADIOLIB_VERBOSE_PRINTLN("S\t%X", _syncBuffer);
|
RADIOLIB_VERBOSE_PRINTLN("S\t%X", this->syncBuffer);
|
||||||
|
|
||||||
if((_syncBuffer & _directSyncWordMask) == _directSyncWord) {
|
if((this->syncBuffer & this->directSyncWordMask) == this->directSyncWord) {
|
||||||
_gotSync = true;
|
this->gotSync = true;
|
||||||
_bufferWritePos = 0;
|
this->bufferWritePos = 0;
|
||||||
_bufferReadPos = 0;
|
this->bufferReadPos = 0;
|
||||||
_bufferBitPos = 0;
|
this->bufferBitPos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// save the bit
|
// save the bit
|
||||||
if(bit) {
|
if(bit) {
|
||||||
_buffer[_bufferWritePos] |= 0x01 << _bufferBitPos;
|
this->buffer[this->bufferWritePos] |= 0x01 << this->bufferBitPos;
|
||||||
} else {
|
} else {
|
||||||
_buffer[_bufferWritePos] &= ~(0x01 << _bufferBitPos);
|
this->buffer[this->bufferWritePos] &= ~(0x01 << this->bufferBitPos);
|
||||||
}
|
}
|
||||||
_bufferBitPos++;
|
this->bufferBitPos++;
|
||||||
|
|
||||||
// check complete byte
|
// check complete byte
|
||||||
if(_bufferBitPos == 8) {
|
if(this->bufferBitPos == 8) {
|
||||||
_buffer[_bufferWritePos] = Module::flipBits(_buffer[_bufferWritePos]);
|
this->buffer[this->bufferWritePos] = Module::flipBits(this->buffer[this->bufferWritePos]);
|
||||||
RADIOLIB_VERBOSE_PRINTLN("R\t%X", _buffer[_bufferWritePos]);
|
RADIOLIB_VERBOSE_PRINTLN("R\t%X", this->buffer[this->bufferWritePos]);
|
||||||
|
|
||||||
_bufferWritePos++;
|
this->bufferWritePos++;
|
||||||
_bufferBitPos = 0;
|
this->bufferBitPos = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,10 @@ class PhysicalLayer {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Default constructor.
|
\brief Default constructor.
|
||||||
\param freqStep Frequency step of the synthesizer in Hz.
|
\param step Frequency step of the synthesizer in Hz.
|
||||||
\param maxPacketLength Maximum length of packet that can be received by the module.
|
\param maxLen Maximum length of packet that can be received by the module.
|
||||||
*/
|
*/
|
||||||
PhysicalLayer(float freqStep, size_t maxPacketLength);
|
PhysicalLayer(float step, size_t maxLen);
|
||||||
|
|
||||||
// basic methods
|
// basic methods
|
||||||
|
|
||||||
|
@ -356,19 +356,19 @@ class PhysicalLayer {
|
||||||
#if !defined(RADIOLIB_GODMODE)
|
#if !defined(RADIOLIB_GODMODE)
|
||||||
private:
|
private:
|
||||||
#endif
|
#endif
|
||||||
float _freqStep;
|
float freqStep;
|
||||||
size_t _maxPacketLength;
|
size_t maxPacketLength;
|
||||||
|
|
||||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||||
uint8_t _bufferBitPos;
|
uint8_t bufferBitPos;
|
||||||
uint8_t _bufferWritePos;
|
uint8_t bufferWritePos;
|
||||||
uint8_t _bufferReadPos;
|
uint8_t bufferReadPos;
|
||||||
uint8_t _buffer[RADIOLIB_STATIC_ARRAY_SIZE];
|
uint8_t buffer[RADIOLIB_STATIC_ARRAY_SIZE];
|
||||||
uint32_t _syncBuffer;
|
uint32_t syncBuffer;
|
||||||
uint32_t _directSyncWord;
|
uint32_t directSyncWord;
|
||||||
uint8_t _directSyncWordLen;
|
uint8_t directSyncWordLen;
|
||||||
uint32_t _directSyncWordMask;
|
uint32_t directSyncWordMask;
|
||||||
bool _gotSync;
|
bool gotSync;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual Module* getMod() = 0;
|
virtual Module* getMod() = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue