From 9fa48b54a847f9182df202e2bb4a95cace40c4d1 Mon Sep 17 00:00:00 2001 From: Kamil Sroka Date: Tue, 16 Apr 2019 17:22:29 +0200 Subject: [PATCH] [nrf528xx] don't return OT_ERROR_FAILED from otPlatRadioTransmit (#3757) --- examples/platforms/nrf52811/radio.c | 14 ++++++-------- examples/platforms/nrf52840/radio.c | 14 ++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/examples/platforms/nrf52811/radio.c b/examples/platforms/nrf52811/radio.c index 48e2c3d7a..66f31411f 100644 --- a/examples/platforms/nrf52811/radio.c +++ b/examples/platforms/nrf52811/radio.c @@ -333,7 +333,7 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) { - otError result = OT_ERROR_NONE; + bool result = true; aFrame->mPsdu[-1] = aFrame->mLength; @@ -345,20 +345,18 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) } else { - if (!nrf_802154_transmit_raw(&aFrame->mPsdu[-1], false)) - { - result = OT_ERROR_FAILED; - } + result = nrf_802154_transmit_raw(&aFrame->mPsdu[-1], false); } clearPendingEvents(); + otPlatRadioTxStarted(aInstance, aFrame); - if (result == OT_ERROR_NONE) + if (!result) { - otPlatRadioTxStarted(aInstance, aFrame); + setPendingEvent(kPendingEventChannelAccessFailure); } - return result; + return OT_ERROR_NONE; } otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance) diff --git a/examples/platforms/nrf52840/radio.c b/examples/platforms/nrf52840/radio.c index 8d013c6a9..a513dd00e 100644 --- a/examples/platforms/nrf52840/radio.c +++ b/examples/platforms/nrf52840/radio.c @@ -333,7 +333,7 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel) otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) { - otError result = OT_ERROR_NONE; + bool result = true; aFrame->mPsdu[-1] = aFrame->mLength; @@ -345,20 +345,18 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) } else { - if (!nrf_802154_transmit_raw(&aFrame->mPsdu[-1], false)) - { - result = OT_ERROR_FAILED; - } + result = nrf_802154_transmit_raw(&aFrame->mPsdu[-1], false); } clearPendingEvents(); + otPlatRadioTxStarted(aInstance, aFrame); - if (result == OT_ERROR_NONE) + if (!result) { - otPlatRadioTxStarted(aInstance, aFrame); + setPendingEvent(kPendingEventChannelAccessFailure); } - return result; + return OT_ERROR_NONE; } otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)