[PHY] Added channel scan methods to common interface

This commit is contained in:
jgromes 2023-08-12 18:42:37 +02:00
parent b48567722b
commit 58da2a28ac
2 changed files with 52 additions and 0 deletions

View file

@ -289,6 +289,19 @@ float PhysicalLayer::getSNR() {
return(RADIOLIB_ERR_UNSUPPORTED); return(RADIOLIB_ERR_UNSUPPORTED);
} }
uint32_t PhysicalLayer::getTimeOnAir(size_t len) {
(void)len;
return(0);
}
int16_t PhysicalLayer::startChannelScan() {
return(RADIOLIB_ERR_UNSUPPORTED);
}
int16_t PhysicalLayer::getChannelScanResult() {
return(RADIOLIB_ERR_UNSUPPORTED);
}
int16_t PhysicalLayer::scanChannel() { int16_t PhysicalLayer::scanChannel() {
return(RADIOLIB_ERR_UNSUPPORTED); return(RADIOLIB_ERR_UNSUPPORTED);
} }
@ -441,6 +454,14 @@ void PhysicalLayer::clearPacketSentAction() {
} }
void PhysicalLayer::setChannelScanAction(void (*func)(void)) {
(void)func;
}
void PhysicalLayer::clearChannelScanAction() {
}
#if defined(RADIOLIB_INTERRUPT_TIMING) #if defined(RADIOLIB_INTERRUPT_TIMING)
void PhysicalLayer::setInterruptSetup(void (*func)(uint32_t)) { void PhysicalLayer::setInterruptSetup(void (*func)(uint32_t)) {
Module* mod = getMod(); Module* mod = getMod();

View file

@ -302,6 +302,26 @@ class PhysicalLayer {
*/ */
virtual float getSNR(); virtual float getSNR();
/*!
\brief Get expected time-on-air for a given size of payload
\param len Payload length in bytes.
\returns Expected time-on-air in microseconds.
*/
virtual uint32_t getTimeOnAir(size_t len);
/*!
\brief Interrupt-driven channel activity detection method. interrupt will be activated
when packet is detected. Must be implemented in module class.
\returns \ref status_codes
*/
virtual int16_t startChannelScan();
/*!
\brief Read the channel scan result
\returns \ref status_codes
*/
virtual int16_t getChannelScanResult();
/*! /*!
\brief Check whether the current communication channel is free or occupied. Performs CAD for LoRa modules, \brief Check whether the current communication channel is free or occupied. Performs CAD for LoRa modules,
or RSSI measurement for FSK modules. or RSSI measurement for FSK modules.
@ -409,6 +429,17 @@ class PhysicalLayer {
\brief Clears interrupt service routine to call when a packet is sent. \brief Clears interrupt service routine to call when a packet is sent.
*/ */
virtual void clearPacketSentAction(); virtual void clearPacketSentAction();
/*!
\brief Sets interrupt service routine to call when a channel scan is finished.
\param func ISR to call.
*/
virtual void setChannelScanAction(void (*func)(void));
/*!
\brief Clears interrupt service routine to call when a channel scan is finished.
*/
virtual void clearChannelScanAction();
#if defined(RADIOLIB_INTERRUPT_TIMING) #if defined(RADIOLIB_INTERRUPT_TIMING)