diff --git a/src/STM32LoRaWAN.cpp b/src/STM32LoRaWAN.cpp index 2160a0d..ecf506a 100644 --- a/src/STM32LoRaWAN.cpp +++ b/src/STM32LoRaWAN.cpp @@ -124,6 +124,20 @@ void STM32LoRaWAN::maintainUntilIdle() } while(busy()); } +bool STM32LoRaWAN::continuousWave(uint32_t frequency, int8_t powerdBm, + uint16_t timeout) { + MlmeReq_t mlmeReq; + mlmeReq.Type = MLME_TXCW_1; + mlmeReq.Req.TxCw.Frequency = frequency; + mlmeReq.Req.TxCw.Power = powerdBm; + mlmeReq.Req.TxCw.Timeout = timeout; + LoRaMacStatus_t res = LoRaMacMlmeRequest(&mlmeReq); + if (res != LORAMAC_STATUS_OK) + return failure("Failed to enable CW mode: %s\r\n", toString(res)); + + return true; +} + bool STM32LoRaWAN::joinOTAAAsync() { clear_rx(); diff --git a/src/STM32LoRaWAN.h b/src/STM32LoRaWAN.h index 3a14fde..e7431e7 100644 --- a/src/STM32LoRaWAN.h +++ b/src/STM32LoRaWAN.h @@ -791,6 +791,19 @@ class STM32LoRaWAN : public Stream { /// @} + /** + * Set the radio into continuous wave (CW) mode. In this mode radio outputs + * a signal at the specified frequency and power for the specified duration. + * + * Used only for compliance testing and antenna testing. + * + * \param frequency Frequency in Hz. + * \param powerdBm transmit power in dBm. + * \param timeout Duration in seconds. + * \returns true if CW mode was activated successfully. + */ + + bool continuousWave(uint32_t frequency, int8_t powerdBm, uint16_t timeout); /** * @name Dummy implementations