Skip to content

Commit

Permalink
[SX128x] Cleanup private/protected members
Browse files Browse the repository at this point in the history
  • Loading branch information
jgromes committed Jan 12, 2024
1 parent bbe407b commit b5d931e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
9 changes: 5 additions & 4 deletions src/modules/SX128x/SX1280.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ 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 = this->mod->hal->millis();
while(!this->mod->hal->digitalRead(this->mod->getIrq())) {
this->mod->hal->yield();
if(this->mod->hal->millis() - start > 10000) {
Module* mod = this->getMod();
uint32_t start = mod->hal->millis();
while(!mod->hal->digitalRead(mod->getIrq())) {
mod->hal->yield();
if(mod->hal->millis() - start > 10000) {
clearIrqStatus();
standby();
return(RADIOLIB_ERR_RANGING_TIMEOUT);
Expand Down
8 changes: 4 additions & 4 deletions src/modules/SX128x/SX128x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ SX128x::SX128x(Module* mod) : PhysicalLayer(RADIOLIB_SX128X_FREQUENCY_STEP_SIZE,
this->mod = mod;
}

Module* SX128x::getMod() {
return(this->mod);
}

int16_t SX128x::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t pwr, uint16_t preambleLength) {
// set module properties
this->mod->init();
Expand Down Expand Up @@ -1347,6 +1343,10 @@ void SX128x::readBit(uint32_t pin) {
}
#endif

Module* SX128x::getMod() {
return(this->mod);
}

uint8_t SX128x::getStatus() {
uint8_t data = 0;
this->mod->SPIreadStream(RADIOLIB_SX128X_CMD_GET_STATUS, &data, 0);
Expand Down
15 changes: 3 additions & 12 deletions src/modules/SX128x/SX128x.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,6 @@ class SX128x: public PhysicalLayer {
*/
SX128x(Module* mod);

Module* getMod();

// basic methods

/*!
Expand Down Expand Up @@ -782,11 +780,7 @@ class SX128x: public PhysicalLayer {
#if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
protected:
#endif
Module* mod;

#if !RADIOLIB_GODMODE
protected:
#endif
Module* getMod();

// cached LoRa parameters
float bandwidthKhz = 0;
Expand Down Expand Up @@ -814,19 +808,16 @@ class SX128x: public PhysicalLayer {
int16_t clearIrqStatus(uint16_t clearIrqParams = RADIOLIB_SX128X_IRQ_ALL);
int16_t setRangingRole(uint8_t role);
int16_t setPacketType(uint8_t type);

int16_t setHeaderType(uint8_t hdrType, size_t len = 0xFF);

#if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
#if !RADIOLIB_GODMODE
private:
#endif
Module* mod;

// common low-level SPI interface
static int16_t SPIparseStatus(uint8_t in);

#if !RADIOLIB_GODMODE
private:
#endif
// common parameters
uint8_t power = 0;

Expand Down

0 comments on commit b5d931e

Please sign in to comment.