Skip to content

Commit

Permalink
net: openthread: radio: Add setting channel in diag mode
Browse files Browse the repository at this point in the history
Add possibility to set channel in diag mode by implementing
`platformRadioChannelSet` API.

Signed-off-by: Maciej Baczmanski <[email protected]>
  • Loading branch information
maciejbaczmanski authored and kartben committed Jan 9, 2025
1 parent b46f720 commit 712da72
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/openthread/platform/diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ bool otPlatDiagModeGet(void)

void otPlatDiagChannelSet(uint8_t aChannel)
{
ARG_UNUSED(aChannel);
sChannel = aChannel;
platformRadioChannelSet(aChannel);
}

void otPlatDiagTxPowerSet(int8_t aTxPower)
Expand Down
10 changes: 10 additions & 0 deletions modules/openthread/platform/platform-zephyr.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ void platformUartPanic(void);
*/
uint16_t platformRadioChannelGet(otInstance *aInstance);

#if defined(CONFIG_OPENTHREAD_DIAG)
/**
* Set channel on radio driver.
*
* @param[in] aChannel The channel that the radio driver should use for operation.
*
*/
void platformRadioChannelSet(uint8_t aChannel);
#endif /* CONFIG_OPENTHREAD_DIAG */

#if defined(CONFIG_IEEE802154_CARRIER_FUNCTIONS)
/**
* Start/stop continuous carrier wave transmission.
Expand Down
7 changes: 7 additions & 0 deletions modules/openthread/platform/radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,13 @@ uint16_t platformRadioChannelGet(otInstance *aInstance)
return channel;
}

#if defined(CONFIG_OPENTHREAD_DIAG)
void platformRadioChannelSet(uint8_t aChannel)
{
channel = aChannel;
}
#endif

void otPlatRadioSetPanId(otInstance *aInstance, uint16_t aPanId)
{
ARG_UNUSED(aInstance);
Expand Down

0 comments on commit 712da72

Please sign in to comment.