[PHY] Pass mode config by reference

This commit is contained in:
jgromes 2025-02-03 20:31:58 +01:00
parent d6b6a0bf51
commit 7ec456dad4
3 changed files with 6 additions and 7 deletions

View file

@ -919,7 +919,7 @@ int16_t LoRaWANNode::activateOTAA(uint8_t joinDr, LoRaWANJoinEvent_t *joinEvent)
modeCfg.transmit.data = joinRequestMsg;
modeCfg.transmit.len = RADIOLIB_LORAWAN_JOIN_REQUEST_LEN;
modeCfg.transmit.addr = 0;
state = this->phyLayer->stageMode(RADIOLIB_RADIO_MODE_TX, modeCfg);
state = this->phyLayer->stageMode(RADIOLIB_RADIO_MODE_TX, &modeCfg);
RADIOLIB_ASSERT(state);
// if requested, delay until transmitting JoinRequest
@ -1334,7 +1334,7 @@ int16_t LoRaWANNode::transmitUplink(const LoRaWANChannel_t* chnl, uint8_t* in, u
modeCfg.transmit.data = in;
modeCfg.transmit.len = len;
modeCfg.transmit.addr = 0;
state = this->phyLayer->stageMode(RADIOLIB_RADIO_MODE_TX, modeCfg);
state = this->phyLayer->stageMode(RADIOLIB_RADIO_MODE_TX, &modeCfg);
RADIOLIB_ASSERT(state);
// if requested, wait until transmitting uplink
@ -1431,7 +1431,7 @@ int16_t LoRaWANNode::receiveCommon(uint8_t dir, const LoRaWANChannel_t* dlChanne
modeCfg.receive.irqFlags = RADIOLIB_IRQ_RX_DEFAULT_FLAGS;
modeCfg.receive.irqMask = RADIOLIB_IRQ_RX_DEFAULT_MASK;
modeCfg.receive.len = 0;
state = this->phyLayer->stageMode(RADIOLIB_RADIO_MODE_RX, modeCfg);
state = this->phyLayer->stageMode(RADIOLIB_RADIO_MODE_RX, &modeCfg);
RADIOLIB_ASSERT(state);
// wait for the start of the Rx window

View file

@ -537,7 +537,7 @@ int16_t PhysicalLayer::getModem(ModemType_t* modem) {
return(RADIOLIB_ERR_UNSUPPORTED);
}
int16_t PhysicalLayer::stageMode(RadioModeType_t mode, RadioModeConfig_t cfg) {
int16_t PhysicalLayer::stageMode(RadioModeType_t mode, RadioModeConfig_t* cfg) {
(void)mode;
(void)cfg;
return(RADIOLIB_ERR_UNSUPPORTED);

View file

@ -737,10 +737,10 @@ class PhysicalLayer {
/*!
\brief Stage mode of the radio to be launched later using launchMode.
\param mode Radio mode to prepare.
\param cfg Confioguration of this mode (mode-dependent).
\param cfg Configuration of this mode (mode-dependent).
\returns \ref status_codes
*/
virtual int16_t stageMode(RadioModeType_t mode, RadioModeConfig_t cfg);
virtual int16_t stageMode(RadioModeType_t mode, RadioModeConfig_t* cfg);
/*!
\brief Launch previously staged mode.
@ -770,7 +770,6 @@ class PhysicalLayer {
#endif
uint32_t irqMap[10] = { 0 };
RadioModeType_t stagedMode = RADIOLIB_RADIO_MODE_NONE;
RadioModeConfig_t stagedConfig = { .standby = { .mode = 0 } };
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
void updateDirectBuffer(uint8_t bit);