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