Skip to content

Commit f027717

Browse files
[openthread] update radio channel setter
prior radio channel set method did not call config commit resulting in the radio configuration not being updated
1 parent 9a1b6d2 commit f027717

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

libopenthread/platform/radio.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
#define ACK_SIZE 3
1313

14+
returncode_t ieee802154_set_channel_and_commit(uint8_t channel);
15+
1416
static uint8_t tx_mPsdu[OT_RADIO_FRAME_MAX_SIZE];
1517
static otRadioFrame transmitFrame = {
1618
.mPsdu = tx_mPsdu,
@@ -51,6 +53,15 @@ void reset_pending_tx_done_callback(void) {
5153
pending_tx_done_callback.flag = false;
5254
}
5355

56+
// Helper method for setting radio channel and calling config commit.
57+
returncode_t ieee802154_set_channel_and_commit(uint8_t channel) {
58+
returncode_t retCode = libtock_ieee802154_set_channel(channel);
59+
if (retCode != RETURNCODE_SUCCESS) {
60+
return retCode;
61+
}
62+
return libtock_ieee802154_config_commit();
63+
}
64+
5465
void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64) {
5566
OT_UNUSED_VARIABLE(aInstance);
5667
uint64_t eui64;
@@ -137,7 +148,7 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) {
137148
otPlatRadioEnable(aInstance);
138149
}
139150

140-
int retCode = libtock_ieee802154_set_channel(aChannel);
151+
int retCode = ieee802154_set_channel_and_commit(aChannel);
141152
if (retCode != RETURNCODE_SUCCESS) {
142153
return OT_ERROR_FAILED;
143154
}
@@ -156,7 +167,7 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) {
156167
// final two bytes.
157168
aFrame->mLength = aFrame->mLength - 2;
158169

159-
int retCode = libtock_ieee802154_set_channel(aFrame->mChannel);
170+
int retCode = ieee802154_set_channel_and_commit(aFrame->mChannel);
160171
if (retCode != RETURNCODE_SUCCESS) {
161172
return OT_ERROR_FAILED;
162173
}

0 commit comments

Comments
 (0)