Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a function to activate CW mode #16

Merged
merged 5 commits into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/STM32LoRaWAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,19 @@ void STM32LoRaWAN::maintainUntilIdle()
} while(busy());
}

bool STM32LoRaWAN::continuousWave(uint32_t frequency, int8_t power, uint16_t timeout) {
MlmeReq_t mlmeReq;
mlmeReq.Type = MLME_TXCW_1;
mlmeReq.Req.TxCw.Frequency = frequency;
mlmeReq.Req.TxCw.Power = power;
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();
Expand Down
13 changes: 13 additions & 0 deletions src/STM32LoRaWAN.h
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,19 @@ class STM32LoRaWAN : public Stream {

/// @}

/**
* Set the radion into continuous wave (CW) mode. In this mode radio outputs
Miceuz marked this conversation as resolved.
Show resolved Hide resolved
* 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 power TX power level [0-15].
* \param timeout Duration in seconds.
* \returns True if CW mode was activated successfully.
Miceuz marked this conversation as resolved.
Show resolved Hide resolved
*/

bool continuousWave(uint32_t frequency, int8_t power, uint16_t timeout);

/**
* @name Dummy implementations
Expand Down