[PHY] Add PHY support for staged modes
This commit is contained in:
parent
4deec953e8
commit
61c5bdb831
2 changed files with 91 additions and 0 deletions
|
@ -537,6 +537,16 @@ int16_t PhysicalLayer::getModem(ModemType_t* modem) {
|
||||||
return(RADIOLIB_ERR_UNSUPPORTED);
|
return(RADIOLIB_ERR_UNSUPPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int16_t PhysicalLayer::stageMode(RadioModeType_t mode, RadioModeConfig_t cfg) {
|
||||||
|
(void)mode;
|
||||||
|
(void)cfg;
|
||||||
|
return(RADIOLIB_ERR_UNSUPPORTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
int16_t PhysicalLayer::launchMode() {
|
||||||
|
return(RADIOLIB_ERR_UNSUPPORTED);
|
||||||
|
}
|
||||||
|
|
||||||
#if RADIOLIB_INTERRUPT_TIMING
|
#if RADIOLIB_INTERRUPT_TIMING
|
||||||
void PhysicalLayer::setInterruptSetup(void (*func)(uint32_t)) {
|
void PhysicalLayer::setInterruptSetup(void (*func)(uint32_t)) {
|
||||||
Module* mod = getMod();
|
Module* mod = getMod();
|
||||||
|
|
|
@ -130,6 +130,58 @@ union ChannelScanConfig_t {
|
||||||
RSSIScanConfig_t rssi;
|
RSSIScanConfig_t rssi;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct StandbyConfig_t {
|
||||||
|
/*! \brief Module-specific standby mode configuration. */
|
||||||
|
uint8_t mode;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ReceiveConfig_t {
|
||||||
|
/*! \brief Raw timeout value. Some modules use this argument to specify operation mode (single vs. continuous receive). */
|
||||||
|
uint32_t timeout;
|
||||||
|
|
||||||
|
/*! \brief Sets the IRQ flags. */
|
||||||
|
RadioLibIrqFlags_t irqFlags;
|
||||||
|
|
||||||
|
/*! \brief Sets the mask of IRQ flags that will trigger the radio interrupt pin. */
|
||||||
|
RadioLibIrqFlags_t irqMask;
|
||||||
|
|
||||||
|
/*! \brief Packet length, needed for some modules under special circumstances (e.g. LoRa implicit header mode). */
|
||||||
|
size_t len;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TransmitConfig_t {
|
||||||
|
/*! \brief Binary data that will be transmitted. */
|
||||||
|
uint8_t* data;
|
||||||
|
|
||||||
|
/*! \brief Length of binary data to transmit (in bytes). */
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
/*! \brief Node address to transmit the packet to. Only used in FSK mode. */
|
||||||
|
uint8_t addr;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SleepConfig_t {
|
||||||
|
/*! \brief Module-specific sleep mode configuration. */
|
||||||
|
uint8_t mode;
|
||||||
|
};
|
||||||
|
|
||||||
|
union RadioModeConfig_t {
|
||||||
|
/*! \brief Interpretation for standby mode */
|
||||||
|
StandbyConfig_t standby;
|
||||||
|
|
||||||
|
/*! \brief Interpretation for Rx mode */
|
||||||
|
ReceiveConfig_t receive;
|
||||||
|
|
||||||
|
/*! \brief Interpretation for Tx mode */
|
||||||
|
TransmitConfig_t transmit;
|
||||||
|
|
||||||
|
/*! \brief Interpretation for scanning */
|
||||||
|
ChannelScanConfig_t scan;
|
||||||
|
|
||||||
|
/*! \brief Interpretation for sleep mode */
|
||||||
|
SleepConfig_t sleep;
|
||||||
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\enum ModemType_t
|
\enum ModemType_t
|
||||||
\brief Type of modem, used by setModem.
|
\brief Type of modem, used by setModem.
|
||||||
|
@ -140,6 +192,19 @@ enum ModemType_t {
|
||||||
RADIOLIB_MODEM_LRFHSS,
|
RADIOLIB_MODEM_LRFHSS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\enum RadioModeType_t
|
||||||
|
\brief Basic radio operating modes, used by stageMode.
|
||||||
|
*/
|
||||||
|
enum RadioModeType_t {
|
||||||
|
RADIOLIB_RADIO_MODE_NONE = 0,
|
||||||
|
RADIOLIB_RADIO_MODE_STANDBY,
|
||||||
|
RADIOLIB_RADIO_MODE_RX,
|
||||||
|
RADIOLIB_RADIO_MODE_TX,
|
||||||
|
RADIOLIB_RADIO_MODE_SCAN,
|
||||||
|
RADIOLIB_RADIO_MODE_SLEEP,
|
||||||
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class PhysicalLayer
|
\class PhysicalLayer
|
||||||
|
|
||||||
|
@ -669,6 +734,20 @@ class PhysicalLayer {
|
||||||
*/
|
*/
|
||||||
virtual int16_t getModem(ModemType_t* modem);
|
virtual int16_t getModem(ModemType_t* modem);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\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).
|
||||||
|
\returns \ref status_codes
|
||||||
|
*/
|
||||||
|
int16_t stageMode(RadioModeType_t mode, RadioModeConfig_t cfg);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Launch previously staged mode.
|
||||||
|
\returns \ref status_codes
|
||||||
|
*/
|
||||||
|
int16_t launchMode();
|
||||||
|
|
||||||
#if RADIOLIB_INTERRUPT_TIMING
|
#if RADIOLIB_INTERRUPT_TIMING
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -690,6 +769,8 @@ class PhysicalLayer {
|
||||||
protected:
|
protected:
|
||||||
#endif
|
#endif
|
||||||
uint32_t irqMap[10] = { 0 };
|
uint32_t irqMap[10] = { 0 };
|
||||||
|
RadioModeType_t stagedMode = RADIOLIB_RADIO_MODE_NONE;
|
||||||
|
RadioModeConfig_t stagedConfig = { .standby = { .mode = 0 } };
|
||||||
|
|
||||||
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||||
void updateDirectBuffer(uint8_t bit);
|
void updateDirectBuffer(uint8_t bit);
|
||||||
|
|
Loading…
Add table
Reference in a new issue