264264#define RADIOLIB_LR11X0_IRQ_PREAMBLE_DETECTED (0x01UL << 4) // 31 0 preamble detected
265265#define RADIOLIB_LR11X0_IRQ_SYNC_WORD_HEADER_VALID (0x01UL << 5) // 31 0 sync word or LoRa header valid
266266#define RADIOLIB_LR11X0_IRQ_HEADER_ERR (0x01UL << 6) // 31 0 LoRa header CRC error
267- #define RADIOLIB_LR11X0_IRQ_CRC_ERR (0x01UL << 7) // 31 0 packet CRC error
267+ #define RADIOLIB_LR11X0_IRQ_CRC_ERR (0x01UL << 7) // 31 0 packet CRC error
268268#define RADIOLIB_LR11X0_IRQ_CAD_DONE (0x01UL << 8) // 31 0 CAD completed
269269#define RADIOLIB_LR11X0_IRQ_CAD_DETECTED (0x01UL << 9) // 31 0 CAD detected
270270#define RADIOLIB_LR11X0_IRQ_TIMEOUT (0x01UL << 10) // 31 0 Rx or Tx timeout
443443#define RADIOLIB_LR11X0_GFSK_WHITENING_ENABLED (0x01UL << 0) // 7 0 enabled
444444
445445// RADIOLIB_LR11X0_CMD_SET_TX_PARAMS
446- #define RADIOLIB_LR11X0_PA_RAMP_48U (0x02UL << 0) // 7 0 PA ramp time: 48 us
446+ #define RADIOLIB_LR11X0_PA_RAMP_16U (0x00UL << 0) // 7 0 PA ramp time: 16 us
447+ #define RADIOLIB_LR11X0_PA_RAMP_32U (0x01UL << 0) // 7 0 32 us
448+ #define RADIOLIB_LR11X0_PA_RAMP_48U (0x02UL << 0) // 7 0 48 us
449+ #define RADIOLIB_LR11X0_PA_RAMP_64U (0x03UL << 0) // 7 0 64 us
450+ #define RADIOLIB_LR11X0_PA_RAMP_80U (0x04UL << 0) // 7 0 80 us
451+ #define RADIOLIB_LR11X0_PA_RAMP_96U (0x05UL << 0) // 7 0 96 us
452+ #define RADIOLIB_LR11X0_PA_RAMP_112U (0x06UL << 0) // 7 0 112 us
453+ #define RADIOLIB_LR11X0_PA_RAMP_128U (0x07UL << 0) // 7 0 128 us
454+ #define RADIOLIB_LR11X0_PA_RAMP_144U (0x08UL << 0) // 7 0 144 us
455+ #define RADIOLIB_LR11X0_PA_RAMP_160U (0x09UL << 0) // 7 0 160 us
456+ #define RADIOLIB_LR11X0_PA_RAMP_176U (0x0AUL << 0) // 7 0 176 us
457+ #define RADIOLIB_LR11X0_PA_RAMP_192U (0x0BUL << 0) // 7 0 192 us
458+ #define RADIOLIB_LR11X0_PA_RAMP_208U (0x0CUL << 0) // 7 0 208 us
459+ #define RADIOLIB_LR11X0_PA_RAMP_240U (0x0DUL << 0) // 7 0 240 us
460+ #define RADIOLIB_LR11X0_PA_RAMP_272U (0x0EUL << 0) // 7 0 272 us
461+ #define RADIOLIB_LR11X0_PA_RAMP_304U (0x0FUL << 0) // 7 0 304 us
447462
448463// RADIOLIB_LR11X0_CMD_SET_RX_TX_FALLBACK_MODE
449464#define RADIOLIB_LR11X0_FALLBACK_MODE_STBY_RC (0x01UL << 0) // 1 0 fallback mode after Rx/Tx: standby with RC
@@ -760,22 +775,22 @@ struct LR11x0VersionInfo_t {
760775
761776 /*! \brief Which device this is - one of RADIOLIB_LR11X0_DEVICE_* macros. */
762777 uint8_t device ;
763-
778+
764779 /*! \brief Major revision of the base firmware. */
765780 uint8_t fwMajor ;
766-
781+
767782 /*! \brief Minor revision of the base firmware. */
768783 uint8_t fwMinor ;
769784
770785 /*! \brief Major revision of the WiFi firmware. */
771786 uint8_t fwMajorWiFi ;
772-
787+
773788 /*! \brief Minor revision of the WiFi firmware. */
774789 uint8_t fwMinorWiFi ;
775790
776791 /*! \brief Revision of the GNSS firmware. */
777792 uint8_t fwGNSS ;
778-
793+
779794 /*! \brief Almanac revision of the GNSS firmware. */
780795 uint8_t almanacGNSS ;
781796};
@@ -787,7 +802,7 @@ struct LR11x0VersionInfo_t {
787802struct LR11x0GnssResult_t {
788803 /*! \brief Demodulator status. One of RADIOLIB_LR11X0_GNSS_DEMOD_STATUS_* */
789804 int8_t demodStat ;
790-
805+
791806 /*! \brief Number of satellites detected during the scan. */
792807 uint8_t numSatsDet ;
793808
@@ -913,7 +928,7 @@ class LR11x0: public PhysicalLayer {
913928 \brief Whether the module has an XTAL (true) or TCXO (false). Defaults to false.
914929 */
915930 bool XTAL ;
916-
931+
917932 /*!
918933 \brief Initialization method for LoRa modem.
919934 \param bw LoRa bandwidth in kHz.
@@ -1038,7 +1053,7 @@ class LR11x0: public PhysicalLayer {
10381053 \returns \ref status_codes
10391054 */
10401055 int16_t sleep (bool retainConfig , uint32_t sleepTime );
1041-
1056+
10421057 // interrupt methods
10431058
10441059 /*!
@@ -1103,7 +1118,7 @@ class LR11x0: public PhysicalLayer {
11031118 \returns \ref status_codes
11041119 */
11051120 int16_t readData (uint8_t * data , size_t len ) override ;
1106-
1121+
11071122 /*!
11081123 \brief Interrupt-driven channel activity detection method. IRQ1 will be activated
11091124 when LoRa preamble is detected, or upon timeout. Defaults to CAD parameter values recommended by AN1200.48.
@@ -1180,7 +1195,7 @@ class LR11x0: public PhysicalLayer {
11801195 \returns \ref status_codes
11811196 */
11821197 int16_t setRxBandwidth (float rxBw );
1183-
1198+
11841199 /*!
11851200 \brief Sets GFSK sync word in the form of array of up to 8 bytes.
11861201 \param syncWord GFSK sync word to be set.
@@ -1443,7 +1458,7 @@ class LR11x0: public PhysicalLayer {
14431458 \returns \ref status_codes
14441459 */
14451460 int16_t setLrFhssConfig (uint8_t bw , uint8_t cr , uint8_t hdrCount = 3 , uint16_t hopSeed = 0x13A );
1446-
1461+
14471462 /*!
14481463 \brief Start passive WiFi scan. BUSY pin will be de-activated when the scan is finished.
14491464 \param wifiType Type of WiFi (802.11) signals to scan, 'b', 'n', 'g' or '*' for all signals.
@@ -1488,7 +1503,7 @@ class LR11x0: public PhysicalLayer {
14881503 \returns \ref status_codes
14891504 */
14901505 int16_t getWifiScanResult (LR11x0WifiResult_t * result , uint8_t index , bool brief = false);
1491-
1506+
14921507 /*!
14931508 \brief Blocking WiFi scan method. Performs a full passive WiFi scan.
14941509 This method may block for several seconds!
@@ -1506,14 +1521,14 @@ class LR11x0: public PhysicalLayer {
15061521 \returns \ref status_codes
15071522 */
15081523 int16_t wifiScan (uint8_t wifiType , uint8_t * count , uint8_t mode = RADIOLIB_LR11X0_WIFI_ACQ_MODE_FULL_BEACON , uint16_t chanMask = RADIOLIB_LR11X0_WIFI_ALL_CHANNELS , uint8_t numScans = 16 , uint16_t timeout = 100 );
1509-
1524+
15101525 /*!
15111526 \brief Retrieve LR11x0 hardware, device and firmware version information.
15121527 \param info Pointer to LR11x0VersionInfo_t structure to populate.
15131528 \returns \ref status_codes
15141529 */
15151530 int16_t getVersionInfo (LR11x0VersionInfo_t * info );
1516-
1531+
15171532 /*!
15181533 \brief Method to upload new firmware image to the device.
15191534 The device will be automatically erased, a new firmware will be uploaded,
@@ -1525,7 +1540,7 @@ class LR11x0: public PhysicalLayer {
15251540 \returns \ref status_codes
15261541 */
15271542 int16_t updateFirmware (const uint32_t * image , size_t size , bool nonvolatile = true);
1528-
1543+
15291544 /*!
15301545 \brief Method to check whether the device is capable of performing a GNSS scan.
15311546 \returns \ref status_codes
@@ -1566,7 +1581,7 @@ class LR11x0: public PhysicalLayer {
15661581 \returns \ref status_codes
15671582 */
15681583 int16_t updateGnssAlmanac (uint8_t constellation );
1569-
1584+
15701585 /*!
15711586 \brief Get GNSS position. Called after gnssScan to retrieve the position calculated by the internal solver.
15721587 \param pos Pointer to LR11x0GnssPosition_t structure to populate.
@@ -1598,18 +1613,26 @@ class LR11x0: public PhysicalLayer {
15981613 \returns \ref status_codes
15991614 */
16001615 int16_t calibrateImageRejection (float freqMin , float freqMax );
1601-
1616+
16021617 /*! \copydoc PhysicalLayer::stageMode */
16031618 int16_t stageMode (RadioModeType_t mode , RadioModeConfig_t * cfg ) override ;
16041619
16051620 /*! \copydoc PhysicalLayer::launchMode */
16061621 int16_t launchMode () override ;
1607-
1622+
16081623#if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
16091624 protected :
16101625#endif
16111626 Module * getMod () override ;
16121627
1628+ // LR11x0 command helpers
1629+ /*!
1630+ \brief Round up a PA power ramp time to register value
1631+ \param rampTimeUs Ramp time in microseconds
1632+ \returns Register value of rounded ramp time
1633+ */
1634+ uint8_t roundRampTime (uint32_t rampTimeUs );
1635+
16131636 // LR11x0 SPI command implementations
16141637 int16_t writeRegMem32 (uint32_t addr , const uint32_t * data , size_t len );
16151638 int16_t readRegMem32 (uint32_t addr , uint32_t * data , size_t len );
@@ -1777,9 +1800,9 @@ class LR11x0: public PhysicalLayer {
17771800 int16_t bootGetPin (uint8_t * pin );
17781801 int16_t bootGetChipEui (uint8_t * eui );
17791802 int16_t bootGetJoinEui (uint8_t * eui );
1780-
1803+
17811804 int16_t SPIcommand (uint16_t cmd , bool write , uint8_t * data , size_t len , const uint8_t * out = NULL , size_t outLen = 0 );
1782-
1805+
17831806#if !RADIOLIB_GODMODE
17841807 protected :
17851808#endif
0 commit comments