Merge pull request #700 from gasagna/master
add functions to PhysicalLayer interface
This commit is contained in:
commit
fb6bbee4fa
2 changed files with 72 additions and 0 deletions
|
@ -110,6 +110,10 @@ int16_t PhysicalLayer::receive(uint8_t* data, size_t len) {
|
|||
return(RADIOLIB_ERR_UNSUPPORTED);
|
||||
}
|
||||
|
||||
int16_t PhysicalLayer::sleep() {
|
||||
return(RADIOLIB_ERR_UNSUPPORTED);
|
||||
}
|
||||
|
||||
int16_t PhysicalLayer::standby() {
|
||||
return(standby(RADIOLIB_STANDBY_DEFAULT));
|
||||
}
|
||||
|
@ -119,6 +123,13 @@ int16_t PhysicalLayer::standby(uint8_t mode) {
|
|||
return(RADIOLIB_ERR_UNSUPPORTED);
|
||||
}
|
||||
|
||||
int16_t PhysicalLayer::startReceive(uint32_t timeout, uint16_t irqFlags, uint16_t irqMask) {
|
||||
(void)timeout;
|
||||
(void)irqFlags;
|
||||
(void)irqMask;
|
||||
return(RADIOLIB_ERR_UNSUPPORTED);
|
||||
}
|
||||
|
||||
int16_t PhysicalLayer::startTransmit(String& str, uint8_t addr) {
|
||||
return(startTransmit(str.c_str(), addr));
|
||||
}
|
||||
|
@ -230,6 +241,14 @@ size_t PhysicalLayer::getPacketLength(bool update) {
|
|||
return(0);
|
||||
}
|
||||
|
||||
float PhysicalLayer::getRSSI() {
|
||||
return(RADIOLIB_ERR_UNSUPPORTED);
|
||||
}
|
||||
|
||||
float PhysicalLayer::getSNR() {
|
||||
return(RADIOLIB_ERR_UNSUPPORTED);
|
||||
}
|
||||
|
||||
int32_t PhysicalLayer::random(int32_t max) {
|
||||
if(max == 0) {
|
||||
return(0);
|
||||
|
@ -365,6 +384,13 @@ int16_t PhysicalLayer::setDIOMapping(RADIOLIB_PIN_TYPE pin, uint8_t value) {
|
|||
return(RADIOLIB_ERR_UNSUPPORTED);
|
||||
}
|
||||
|
||||
void PhysicalLayer::setDio1Action(void (*func)(void)) {
|
||||
(void)func;
|
||||
}
|
||||
|
||||
void PhysicalLayer::clearDio1Action() {
|
||||
}
|
||||
|
||||
#if defined(RADIOLIB_INTERRUPT_TIMING)
|
||||
void PhysicalLayer::setInterruptSetup(void (*func)(uint32_t)) {
|
||||
Module* mod = getMod();
|
||||
|
|
|
@ -84,6 +84,13 @@ class PhysicalLayer {
|
|||
*/
|
||||
int16_t receive(String& str, size_t len = 0);
|
||||
|
||||
/*!
|
||||
\brief Sets module to sleep.
|
||||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
virtual int16_t sleep();
|
||||
|
||||
/*!
|
||||
\brief Sets module to standby.
|
||||
|
||||
|
@ -98,6 +105,19 @@ class PhysicalLayer {
|
|||
*/
|
||||
virtual int16_t standby(uint8_t mode);
|
||||
|
||||
/*!
|
||||
\brief Interrupt-driven receive method. DIO1 will be activated when full packet is received.
|
||||
|
||||
\param timeout Raw timeout value.
|
||||
|
||||
\param irqFlags Sets the IRQ flags.
|
||||
|
||||
\param irqMask Sets the mask of IRQ flags that will trigger DIO1.
|
||||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
virtual int16_t startReceive(uint32_t timeout = 0, uint16_t irqFlags = 0, uint16_t irqMask = 0);
|
||||
|
||||
/*!
|
||||
\brief Binary receive method. Must be implemented in module class.
|
||||
|
||||
|
@ -258,6 +278,20 @@ class PhysicalLayer {
|
|||
*/
|
||||
virtual size_t getPacketLength(bool update = true);
|
||||
|
||||
/*!
|
||||
\brief Gets RSSI (Recorded Signal Strength Indicator) of the last received packet.
|
||||
|
||||
\returns RSSI of the last received packet in dBm.
|
||||
*/
|
||||
virtual float getRSSI();
|
||||
|
||||
/*!
|
||||
\brief Gets SNR (Signal to Noise Ratio) of the last received packet. Only available for LoRa modem.
|
||||
|
||||
\returns SNR of the last received packet in dB.
|
||||
*/
|
||||
virtual float getSNR();
|
||||
|
||||
/*!
|
||||
\brief Get truly random number in range 0 - max.
|
||||
|
||||
|
@ -351,6 +385,18 @@ class PhysicalLayer {
|
|||
*/
|
||||
virtual int16_t setDIOMapping(RADIOLIB_PIN_TYPE pin, uint8_t value);
|
||||
|
||||
/*!
|
||||
\brief Sets interrupt service routine to call when DIO1 activates.
|
||||
|
||||
\param func ISR to call.
|
||||
*/
|
||||
virtual void setDio1Action(void (*func)(void));
|
||||
|
||||
/*!
|
||||
\brief Clears interrupt service routine to call when DIO1 activates.
|
||||
*/
|
||||
virtual void clearDio1Action();
|
||||
|
||||
#if defined(RADIOLIB_INTERRUPT_TIMING)
|
||||
|
||||
/*!
|
||||
|
|
Loading…
Add table
Reference in a new issue