[SX128x] General reformatting
This commit is contained in:
parent
d4365a3b1e
commit
76c654c0c1
6 changed files with 601 additions and 723 deletions
|
@ -12,10 +12,10 @@ int16_t SX1280::range(bool master, uint32_t addr, uint16_t calTable[3][6]) {
|
|||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// wait until ranging is finished
|
||||
uint32_t start = _mod->hal->millis();
|
||||
while(!_mod->hal->digitalRead(_mod->getIrq())) {
|
||||
_mod->hal->yield();
|
||||
if(_mod->hal->millis() - start > 10000) {
|
||||
uint32_t start = this->mod->hal->millis();
|
||||
while(!this->mod->hal->digitalRead(this->mod->getIrq())) {
|
||||
this->mod->hal->yield();
|
||||
if(this->mod->hal->millis() - start > 10000) {
|
||||
clearIrqStatus();
|
||||
standby();
|
||||
return(RADIOLIB_ERR_RANGING_TIMEOUT);
|
||||
|
@ -50,11 +50,11 @@ int16_t SX1280::startRanging(bool master, uint32_t addr, uint16_t calTable[3][6]
|
|||
}
|
||||
|
||||
// set modulation parameters
|
||||
state = setModulationParams(_sf, _bw, _cr);
|
||||
state = setModulationParams(this->spreadingFactor, this->bandwidth, this->codingRateLoRa);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// set packet parameters
|
||||
state = setPacketParamsLoRa(_preambleLengthLoRa, _headerType, _payloadLen, _crcLoRa);
|
||||
state = setPacketParamsLoRa(this->preambleLengthLoRa, this->headerType, this->payloadLen, this->crcLoRa);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// check all address bits
|
||||
|
@ -100,9 +100,9 @@ int16_t SX1280::startRanging(bool master, uint32_t addr, uint16_t calTable[3][6]
|
|||
}
|
||||
|
||||
// set calibration values
|
||||
uint8_t index = (_sf >> 4) - 5;
|
||||
uint8_t index = (this->spreadingFactor >> 4) - 5;
|
||||
uint16_t val = 0;
|
||||
switch(_bw) {
|
||||
switch(this->bandwidth) {
|
||||
case(RADIOLIB_SX128X_LORA_BW_406_25):
|
||||
val = calTbl[0][index];
|
||||
break;
|
||||
|
@ -176,7 +176,7 @@ float SX1280::getRangingResult() {
|
|||
|
||||
// calculate the real result
|
||||
uint32_t raw = ((uint32_t)data[0] << 16) | ((uint32_t)data[1] << 8) | data[2];
|
||||
return((float)raw * 150.0 / (4.096 * _bwKhz));
|
||||
return((float)raw * 150.0 / (4.096 * this->bandwidthKhz));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,47 +11,36 @@
|
|||
|
||||
/*!
|
||||
\class SX1280
|
||||
|
||||
\brief Derived class for %SX1280 modules.
|
||||
*/
|
||||
class SX1280: public SX1281 {
|
||||
public:
|
||||
/*!
|
||||
\brief Default constructor.
|
||||
|
||||
\param mod Instance of Module that will be used to communicate with the radio.
|
||||
*/
|
||||
SX1280(Module* mod);
|
||||
|
||||
/*!
|
||||
\brief Blocking ranging method.
|
||||
|
||||
\param master Whether to execute ranging in master mode (true) or slave mode (false).
|
||||
|
||||
\param addr Ranging address to be used.
|
||||
|
||||
\param calTable Ranging calibration table - set to NULL to use the default.
|
||||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t range(bool master, uint32_t addr, uint16_t calTable[3][6] = NULL);
|
||||
|
||||
/*!
|
||||
\brief Interrupt-driven ranging method.
|
||||
|
||||
\param master Whether to execute ranging in master mode (true) or slave mode (false).
|
||||
|
||||
\param addr Ranging address to be used.
|
||||
|
||||
\param calTable Ranging calibration table - set to NULL to use the default.
|
||||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t startRanging(bool master, uint32_t addr, uint16_t calTable[3][6] = NULL);
|
||||
|
||||
/*!
|
||||
\brief Gets ranging result of the last ranging exchange.
|
||||
|
||||
\returns Ranging result in meters.
|
||||
*/
|
||||
float getRangingResult();
|
||||
|
|
|
@ -10,14 +10,12 @@
|
|||
|
||||
/*!
|
||||
\class SX1281
|
||||
|
||||
\brief Derived class for %SX1281 modules.
|
||||
*/
|
||||
class SX1281: public SX128x {
|
||||
public:
|
||||
/*!
|
||||
\brief Default constructor.
|
||||
|
||||
\param mod Instance of Module that will be used to communicate with the radio.
|
||||
*/
|
||||
SX1281(Module* mod);
|
||||
|
|
|
@ -11,14 +11,12 @@
|
|||
|
||||
/*!
|
||||
\class SX1282
|
||||
|
||||
\brief Derived class for %SX1282 modules.
|
||||
*/
|
||||
class SX1282: public SX1280 {
|
||||
public:
|
||||
/*!
|
||||
\brief Default constructor.
|
||||
|
||||
\param mod Instance of Module that will be used to communicate with the radio.
|
||||
*/
|
||||
SX1282(Module* mod);
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue