Skip to content

Commit

Permalink
[PHY] Use less generic modem names (#1294)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgromes committed Oct 29, 2024
1 parent 0096c11 commit 4564d87
Show file tree
Hide file tree
Showing 17 changed files with 58 additions and 58 deletions.
6 changes: 3 additions & 3 deletions src/modules/LLCC68/LLCC68.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ int16_t LLCC68::checkDataRate(DataRate_t dr) {

int16_t LLCC68::setModem(ModemType_t modem) {
switch(modem) {
case(ModemType_t::LoRa): {
case(ModemType_t::RADIOLIB_MODEM_LORA): {
return(this->begin());
} break;
case(ModemType_t::FSK): {
case(ModemType_t::RADIOLIB_MODEM_FSK): {
return(this->beginFSK());
} break;
case(ModemType_t::LRFHSS): {
case(ModemType_t::RADIOLIB_MODEM_LRFHSS): {
return(this->beginLRFHSS());
} break;
default:
Expand Down
6 changes: 3 additions & 3 deletions src/modules/LR11x0/LR1110.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ int16_t LR1110::checkOutputPower(int8_t power, int8_t* clipped, bool forceHighPo

int16_t LR1110::setModem(ModemType_t modem) {
switch(modem) {
case(ModemType_t::LoRa): {
case(ModemType_t::RADIOLIB_MODEM_LORA): {
return(this->begin());
} break;
case(ModemType_t::FSK): {
case(ModemType_t::RADIOLIB_MODEM_FSK): {
return(this->beginGFSK());
} break;
case(ModemType_t::LRFHSS): {
case(ModemType_t::RADIOLIB_MODEM_LRFHSS): {
return(this->beginLRFHSS());
} break;
}
Expand Down
6 changes: 3 additions & 3 deletions src/modules/LR11x0/LR1120.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,13 @@ int16_t LR1120::checkOutputPower(int8_t power, int8_t* clipped, bool forceHighPo

int16_t LR1120::setModem(ModemType_t modem) {
switch(modem) {
case(ModemType_t::LoRa): {
case(ModemType_t::RADIOLIB_MODEM_LORA): {
return(this->begin());
} break;
case(ModemType_t::FSK): {
case(ModemType_t::RADIOLIB_MODEM_FSK): {
return(this->beginGFSK());
} break;
case(ModemType_t::LRFHSS): {
case(ModemType_t::RADIOLIB_MODEM_LRFHSS): {
return(this->beginLRFHSS());
} break;
}
Expand Down
6 changes: 3 additions & 3 deletions src/modules/LR11x0/LR11x0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2038,13 +2038,13 @@ int16_t LR11x0::getModem(ModemType_t* modem) {

switch(packetType) {
case(RADIOLIB_LR11X0_PACKET_TYPE_LORA):
*modem = ModemType_t::LoRa;
*modem = ModemType_t::RADIOLIB_MODEM_LORA;
return(RADIOLIB_ERR_NONE);
case(RADIOLIB_LR11X0_PACKET_TYPE_GFSK):
*modem = ModemType_t::FSK;
*modem = ModemType_t::RADIOLIB_MODEM_FSK;
return(RADIOLIB_ERR_NONE);
case(RADIOLIB_LR11X0_PACKET_TYPE_LR_FHSS):
*modem = ModemType_t::LRFHSS;
*modem = ModemType_t::RADIOLIB_MODEM_LRFHSS;
return(RADIOLIB_ERR_NONE);
}

Expand Down
6 changes: 3 additions & 3 deletions src/modules/SX126x/SX1262.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ int16_t SX1262::checkOutputPower(int8_t power, int8_t* clipped) {

int16_t SX1262::setModem(ModemType_t modem) {
switch(modem) {
case(ModemType_t::LoRa): {
case(ModemType_t::RADIOLIB_MODEM_LORA): {
return(this->begin());
} break;
case(ModemType_t::FSK): {
case(ModemType_t::RADIOLIB_MODEM_FSK): {
return(this->beginFSK());
} break;
case(ModemType_t::LRFHSS): {
case(ModemType_t::RADIOLIB_MODEM_LRFHSS): {
return(this->beginLRFHSS());
} break;
default:
Expand Down
6 changes: 3 additions & 3 deletions src/modules/SX126x/SX1268.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ int16_t SX1268::checkOutputPower(int8_t power, int8_t* clipped) {

int16_t SX1268::setModem(ModemType_t modem) {
switch(modem) {
case(ModemType_t::LoRa): {
case(ModemType_t::RADIOLIB_MODEM_LORA): {
return(this->begin());
} break;
case(ModemType_t::FSK): {
case(ModemType_t::RADIOLIB_MODEM_FSK): {
return(this->beginFSK());
} break;
case(ModemType_t::LRFHSS): {
case(ModemType_t::RADIOLIB_MODEM_LRFHSS): {
return(this->beginLRFHSS());
} break;
default:
Expand Down
6 changes: 3 additions & 3 deletions src/modules/SX126x/SX126x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1682,13 +1682,13 @@ int16_t SX126x::getModem(ModemType_t* modem) {
uint8_t packetType = getPacketType();
switch(packetType) {
case(RADIOLIB_SX126X_PACKET_TYPE_LORA):
*modem = ModemType_t::LoRa;
*modem = ModemType_t::RADIOLIB_MODEM_LORA;
return(RADIOLIB_ERR_NONE);
case(RADIOLIB_SX126X_PACKET_TYPE_GFSK):
*modem = ModemType_t::FSK;
*modem = ModemType_t::RADIOLIB_MODEM_FSK;
return(RADIOLIB_ERR_NONE);
case(RADIOLIB_SX126X_PACKET_TYPE_LR_FHSS):
*modem = ModemType_t::LRFHSS;
*modem = ModemType_t::RADIOLIB_MODEM_LRFHSS;
return(RADIOLIB_ERR_NONE);
}

Expand Down
4 changes: 2 additions & 2 deletions src/modules/SX127x/SX1272.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,10 @@ void SX1272::errataFix(bool rx) {

int16_t SX1272::setModem(ModemType_t modem) {
switch(modem) {
case(ModemType_t::LoRa): {
case(ModemType_t::RADIOLIB_MODEM_LORA): {
return(this->begin());
} break;
case(ModemType_t::FSK): {
case(ModemType_t::RADIOLIB_MODEM_FSK): {
return(this->beginFSK());
} break;
default:
Expand Down
4 changes: 2 additions & 2 deletions src/modules/SX127x/SX1273.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ int16_t SX1273::checkDataRate(DataRate_t dr) {

int16_t SX1273::setModem(ModemType_t modem) {
switch(modem) {
case(ModemType_t::LoRa): {
case(ModemType_t::RADIOLIB_MODEM_LORA): {
return(this->begin());
} break;
case(ModemType_t::FSK): {
case(ModemType_t::RADIOLIB_MODEM_FSK): {
return(this->beginFSK());
} break;
default:
Expand Down
4 changes: 2 additions & 2 deletions src/modules/SX127x/SX1276.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ int16_t SX1276::setFrequency(float freq) {

int16_t SX1276::setModem(ModemType_t modem) {
switch(modem) {
case(ModemType_t::LoRa): {
case(ModemType_t::RADIOLIB_MODEM_LORA): {
return(this->begin());
} break;
case(ModemType_t::FSK): {
case(ModemType_t::RADIOLIB_MODEM_FSK): {
return(this->beginFSK());
} break;
default:
Expand Down
4 changes: 2 additions & 2 deletions src/modules/SX127x/SX1277.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ int16_t SX1277::checkDataRate(DataRate_t dr) {

int16_t SX1277::setModem(ModemType_t modem) {
switch(modem) {
case(ModemType_t::LoRa): {
case(ModemType_t::RADIOLIB_MODEM_LORA): {
return(this->begin());
} break;
case(ModemType_t::FSK): {
case(ModemType_t::RADIOLIB_MODEM_FSK): {
return(this->beginFSK());
} break;
default:
Expand Down
4 changes: 2 additions & 2 deletions src/modules/SX127x/SX1278.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,10 +707,10 @@ void SX1278::errataFix(bool rx) {

int16_t SX1278::setModem(ModemType_t modem) {
switch(modem) {
case(ModemType_t::LoRa): {
case(ModemType_t::RADIOLIB_MODEM_LORA): {
return(this->begin());
} break;
case(ModemType_t::FSK): {
case(ModemType_t::RADIOLIB_MODEM_FSK): {
return(this->beginFSK());
} break;
default:
Expand Down
4 changes: 2 additions & 2 deletions src/modules/SX127x/SX1279.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ int16_t SX1279::setFrequency(float freq) {

int16_t SX1279::setModem(ModemType_t modem) {
switch(modem) {
case(ModemType_t::LoRa): {
case(ModemType_t::RADIOLIB_MODEM_LORA): {
return(this->begin());
} break;
case(ModemType_t::FSK): {
case(ModemType_t::RADIOLIB_MODEM_FSK): {
return(this->beginFSK());
} break;
default:
Expand Down
4 changes: 2 additions & 2 deletions src/modules/SX127x/SX127x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1760,10 +1760,10 @@ int16_t SX127x::getModem(ModemType_t* modem) {
int16_t packetType = getActiveModem();
switch(packetType) {
case(RADIOLIB_SX127X_LORA):
*modem = ModemType_t::LoRa;
*modem = ModemType_t::RADIOLIB_MODEM_LORA;
return(RADIOLIB_ERR_NONE);
case(RADIOLIB_SX127X_FSK_OOK):
*modem = ModemType_t::FSK;
*modem = ModemType_t::RADIOLIB_MODEM_FSK;
return(RADIOLIB_ERR_NONE);
}

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 @@ -858,10 +858,10 @@ int16_t SX128x::checkOutputPower(int8_t pwr, int8_t* clipped) {

int16_t SX128x::setModem(ModemType_t modem) {
switch(modem) {
case(ModemType_t::LoRa): {
case(ModemType_t::RADIOLIB_MODEM_LORA): {
return(this->begin());
} break;
case(ModemType_t::FSK): {
case(ModemType_t::RADIOLIB_MODEM_FSK): {
return(this->beginGFSK());
} break;
default:
Expand All @@ -875,10 +875,10 @@ int16_t SX128x::getModem(ModemType_t* modem) {
uint8_t packetType = getPacketType();
switch(packetType) {
case(RADIOLIB_SX128X_PACKET_TYPE_LORA):
*modem = ModemType_t::LoRa;
*modem = ModemType_t::RADIOLIB_MODEM_LORA;
return(RADIOLIB_ERR_NONE);
case(RADIOLIB_SX128X_PACKET_TYPE_GFSK):
*modem = ModemType_t::FSK;
*modem = ModemType_t::RADIOLIB_MODEM_FSK;
return(RADIOLIB_ERR_NONE);
}

Expand Down
32 changes: 16 additions & 16 deletions src/protocols/LoRaWAN/LoRaWAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2776,11 +2776,11 @@ int16_t LoRaWANNode::setPhyProperties(const LoRaWANChannel_t* chnl, uint8_t dir,
// set modem-dependent functions
switch(this->band->dataRates[chnl->dr] & RADIOLIB_LORAWAN_DATA_RATE_MODEM) {
case(RADIOLIB_LORAWAN_DATA_RATE_LORA):
if(modem != ModemType_t::LoRa) {
state = this->phyLayer->setModem(ModemType_t::LoRa);
if(modem != ModemType_t::RADIOLIB_MODEM_LORA) {
state = this->phyLayer->setModem(ModemType_t::RADIOLIB_MODEM_LORA);
RADIOLIB_ASSERT(state);
}
modem = ModemType_t::LoRa;
modem = ModemType_t::RADIOLIB_MODEM_LORA;
// downlink messages are sent with inverted IQ
if(dir == RADIOLIB_LORAWAN_DOWNLINK) {
state = this->phyLayer->invertIQ(true);
Expand All @@ -2791,23 +2791,23 @@ int16_t LoRaWANNode::setPhyProperties(const LoRaWANChannel_t* chnl, uint8_t dir,
break;

case(RADIOLIB_LORAWAN_DATA_RATE_FSK):
if(modem != ModemType_t::FSK) {
state = this->phyLayer->setModem(ModemType_t::FSK);
if(modem != ModemType_t::RADIOLIB_MODEM_FSK) {
state = this->phyLayer->setModem(ModemType_t::RADIOLIB_MODEM_FSK);
RADIOLIB_ASSERT(state);
}
modem = ModemType_t::FSK;
modem = ModemType_t::RADIOLIB_MODEM_FSK;
state = this->phyLayer->setDataShaping(RADIOLIB_SHAPING_1_0);
RADIOLIB_ASSERT(state);
state = this->phyLayer->setEncoding(RADIOLIB_ENCODING_WHITENING);
RADIOLIB_ASSERT(state);
break;

case(RADIOLIB_LORAWAN_DATA_RATE_LR_FHSS):
if(modem != ModemType_t::LRFHSS) {
state = this->phyLayer->setModem(ModemType_t::LRFHSS);
if(modem != ModemType_t::RADIOLIB_MODEM_LRFHSS) {
state = this->phyLayer->setModem(ModemType_t::RADIOLIB_MODEM_LRFHSS);
RADIOLIB_ASSERT(state);
}
modem = ModemType_t::LRFHSS;
modem = ModemType_t::RADIOLIB_MODEM_LRFHSS;
break;

default:
Expand Down Expand Up @@ -2836,7 +2836,7 @@ int16_t LoRaWANNode::setPhyProperties(const LoRaWANChannel_t* chnl, uint8_t dir,
uint8_t syncWordLen = 0;
size_t preLen = 0;
switch(modem) {
case(ModemType_t::FSK): {
case(ModemType_t::RADIOLIB_MODEM_FSK): {
preLen = 8*RADIOLIB_LORAWAN_GFSK_PREAMBLE_LEN;
syncWord[0] = (uint8_t)(RADIOLIB_LORAWAN_GFSK_SYNC_WORD >> 16);
syncWord[1] = (uint8_t)(RADIOLIB_LORAWAN_GFSK_SYNC_WORD >> 8);
Expand All @@ -2846,15 +2846,15 @@ int16_t LoRaWANNode::setPhyProperties(const LoRaWANChannel_t* chnl, uint8_t dir,
dr.fsk.bitRate, dr.fsk.freqDev);
} break;

case(ModemType_t::LoRa): {
case(ModemType_t::RADIOLIB_MODEM_LORA): {
preLen = RADIOLIB_LORAWAN_LORA_PREAMBLE_LEN;
syncWord[0] = RADIOLIB_LORAWAN_LORA_SYNC_WORD;
syncWordLen = 1;
RADIOLIB_DEBUG_PROTOCOL_PRINTLN("LoRa: SF = %d, BW = %5.1f kHz, CR = 4/%d, IQ: %c",
dr.lora.spreadingFactor, dr.lora.bandwidth, dr.lora.codingRate, dir ? 'D' : 'U');
} break;

case(ModemType_t::LRFHSS): {
case(ModemType_t::RADIOLIB_MODEM_LRFHSS): {
syncWord[0] = (uint8_t)(RADIOLIB_LORAWAN_LR_FHSS_SYNC_WORD >> 24);
syncWord[1] = (uint8_t)(RADIOLIB_LORAWAN_LR_FHSS_SYNC_WORD >> 16);
syncWord[2] = (uint8_t)(RADIOLIB_LORAWAN_LR_FHSS_SYNC_WORD >> 8);
Expand All @@ -2875,7 +2875,7 @@ int16_t LoRaWANNode::setPhyProperties(const LoRaWANChannel_t* chnl, uint8_t dir,
if(pre) {
preLen = pre;
}
if(modem != ModemType_t::LRFHSS) {
if(modem != ModemType_t::RADIOLIB_MODEM_LRFHSS) {
state = this->phyLayer->setPreambleLength(preLen);
}
return(state);
Expand Down Expand Up @@ -3305,7 +3305,7 @@ int16_t LoRaWANNode::findDataRate(uint8_t dr, DataRate_t* dataRate) {

switch(dataRateBand & RADIOLIB_LORAWAN_DATA_RATE_MODEM) {
case(RADIOLIB_LORAWAN_DATA_RATE_LORA):
modemNew = ModemType_t::LoRa;
modemNew = ModemType_t::RADIOLIB_MODEM_LORA;
dataRate->lora.spreadingFactor = ((dataRateBand & RADIOLIB_LORAWAN_DATA_RATE_SF) >> 3) + 7;
switch(dataRateBand & RADIOLIB_LORAWAN_DATA_RATE_BW) {
case(RADIOLIB_LORAWAN_DATA_RATE_BW_125_KHZ):
Expand All @@ -3323,12 +3323,12 @@ int16_t LoRaWANNode::findDataRate(uint8_t dr, DataRate_t* dataRate) {
dataRate->lora.codingRate = 5;
break;
case(RADIOLIB_LORAWAN_DATA_RATE_FSK):
modemNew = ModemType_t::FSK;
modemNew = ModemType_t::RADIOLIB_MODEM_FSK;
dataRate->fsk.bitRate = 50;
dataRate->fsk.freqDev = 25;
break;
case(RADIOLIB_LORAWAN_DATA_RATE_LR_FHSS):
modemNew = ModemType_t::LRFHSS;
modemNew = ModemType_t::RADIOLIB_MODEM_LRFHSS;
switch(dataRateBand & RADIOLIB_LORAWAN_DATA_RATE_BW) {
case(RADIOLIB_LORAWAN_DATA_RATE_BW_137_KHZ):
dataRate->lrFhss.bw = 0x02; // specific encoding
Expand Down
6 changes: 3 additions & 3 deletions src/protocols/PhysicalLayer/PhysicalLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ union ChannelScanConfig_t {
\brief Type of modem, used by setModem.
*/
enum ModemType_t {
FSK = 0,
LoRa,
LRFHSS,
RADIOLIB_MODEM_FSK = 0,
RADIOLIB_MODEM_LORA,
RADIOLIB_MODEM_LRFHSS,
};

/*!
Expand Down

0 comments on commit 4564d87

Please sign in to comment.