11
11
12
12
#define ACK_SIZE 3
13
13
14
+ returncode_t ieee802154_set_channel_and_commit (uint8_t channel );
15
+
14
16
static uint8_t tx_mPsdu [OT_RADIO_FRAME_MAX_SIZE ];
15
17
static otRadioFrame transmitFrame = {
16
18
.mPsdu = tx_mPsdu ,
@@ -51,6 +53,15 @@ void reset_pending_tx_done_callback(void) {
51
53
pending_tx_done_callback .flag = false;
52
54
}
53
55
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
+
54
65
void otPlatRadioGetIeeeEui64 (otInstance * aInstance , uint8_t * aIeeeEui64 ) {
55
66
OT_UNUSED_VARIABLE (aInstance );
56
67
uint64_t eui64 ;
@@ -137,7 +148,7 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) {
137
148
otPlatRadioEnable (aInstance );
138
149
}
139
150
140
- int retCode = libtock_ieee802154_set_channel (aChannel );
151
+ int retCode = ieee802154_set_channel_and_commit (aChannel );
141
152
if (retCode != RETURNCODE_SUCCESS ) {
142
153
return OT_ERROR_FAILED ;
143
154
}
@@ -156,7 +167,7 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) {
156
167
// final two bytes.
157
168
aFrame -> mLength = aFrame -> mLength - 2 ;
158
169
159
- int retCode = libtock_ieee802154_set_channel (aFrame -> mChannel );
170
+ int retCode = ieee802154_set_channel_and_commit (aFrame -> mChannel );
160
171
if (retCode != RETURNCODE_SUCCESS ) {
161
172
return OT_ERROR_FAILED ;
162
173
}
0 commit comments