diff --git a/src/modules/SX126x/SX126x.cpp b/src/modules/SX126x/SX126x.cpp index 63b5ebc8..cbe356fb 100644 --- a/src/modules/SX126x/SX126x.cpp +++ b/src/modules/SX126x/SX126x.cpp @@ -1130,6 +1130,13 @@ uint32_t SX126x::getTimeOnAir(size_t len) { } } +float SX126x::getRSSIInst() { + uint8_t data[3] = {0, 0, 0}; // RssiInst, Status, RFU + SPIreadCommand(SX126X_CMD_GET_RSSI_INST, data, 3); + + return (float)data[0] / (-2.0); +} + int16_t SX126x::implicitHeader(size_t len) { return(setHeaderType(SX126X_LORA_HEADER_IMPLICIT, len)); } diff --git a/src/modules/SX126x/SX126x.h b/src/modules/SX126x/SX126x.h index 46b510f8..ee99a27f 100644 --- a/src/modules/SX126x/SX126x.h +++ b/src/modules/SX126x/SX126x.h @@ -806,6 +806,13 @@ class SX126x: public PhysicalLayer { */ uint32_t getTimeOnAir(size_t len); + /*! + \brief Get instantaneous RSSI value during recption of the packet. Should switch to FSK receive mode for LBT implementation. + + \returns Instantaneous RSSI value in dBm, in steps of 0.5dBm + */ + float getRSSIInst(); + /*! \brief Set implicit header mode for future reception/transmission.