Skip to content

Commit 2eda5e7

Browse files
committed
openthread: platform: Add temporary API migration code
The transmit functions will return an error code, instead of a boolean value. To prepare for this, the API calls are temporarily implemented in two variants, for old and new API declarations. The presence of new API will be detected by the use of NRF_802154_TX_FUNCTIONS_RETURN_ERROR_CODE macro, which will be unconditionally defined by a newer nrf-802154 driver. Signed-off-by: Rafał Kuźnia <[email protected]>
1 parent 7ba854f commit 2eda5e7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

modules/openthread/platform/radio_nrf5.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,13 @@ static bool nrf5_tx(const otRadioFrame *frame, uint8_t *payload, bool cca)
680680
},
681681
};
682682

683+
#ifdef NRF_802154_TX_FUNCTIONS_RETURN_ERROR_CODE
684+
nrf_802154_tx_error_t result = nrf_802154_transmit_raw(payload, &metadata);
685+
686+
return result == NRF_802154_TX_ERROR_NONE;
687+
#else
683688
return nrf_802154_transmit_raw(payload, &metadata);
689+
#endif
684690
}
685691

686692
#if NRF_802154_CSMA_CA_ENABLED
@@ -702,7 +708,14 @@ static bool nrf5_tx_csma_ca(otRadioFrame *frame, uint8_t *payload)
702708
};
703709

704710
nrf_802154_csma_ca_max_backoffs_set(frame->mInfo.mTxInfo.mMaxCsmaBackoffs);
711+
712+
#ifdef NRF_802154_TX_FUNCTIONS_RETURN_ERROR_CODE
713+
nrf_802154_tx_error_t result = nrf_802154_transmit_csma_ca_raw(payload, &metadata);
714+
715+
return result == NRF_802154_TX_ERROR_NONE;
716+
#else
705717
return nrf_802154_transmit_csma_ca_raw(payload, &metadata);
718+
#endif
706719
}
707720
#endif
708721

@@ -738,7 +751,13 @@ static bool nrf5_tx_at(otRadioFrame *frame, uint8_t *payload)
738751
nrf5_data.tx.frame.mInfo.mTxInfo.mTxDelay) /
739752
NSEC_PER_USEC);
740753

754+
#ifdef NRF_802154_TX_FUNCTIONS_RETURN_ERROR_CODE
755+
nrf_802154_tx_error_t result = nrf_802154_transmit_raw_at(payload, tx_at, &metadata);
756+
757+
return result == NRF_802154_TX_ERROR_NONE;
758+
#else
741759
return nrf_802154_transmit_raw_at(payload, tx_at, &metadata);
760+
#endif
742761
}
743762

744763
static void handle_frame_received(otInstance *aInstance)

0 commit comments

Comments
 (0)