mirror of
https://github.com/espressif/openthread.git
synced 2026-08-26 20:19:53 +00:00
[radio] handle CCA ED threshold property configuration (#4246)
Changes: - Radio interface simply passes calls to platform functions - Platform implementation for nRF52840 and nRF52833 - Placeholders for other platforms (resulting with OT_ERROR_NOT_IMPLEMENTED) - Spinel property configuration handlers
This commit is contained in:
committed by
Jonathan Hui
parent
3f2c2290ac
commit
fb14009916
@@ -1327,6 +1327,28 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function documented in platform/radio.h
|
||||
*/
|
||||
otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function documented in platform/radio.h
|
||||
*/
|
||||
otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function documented in platform/radio.h
|
||||
*/
|
||||
|
||||
@@ -1162,6 +1162,22 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
@@ -1283,6 +1283,28 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function documented in platform/radio.h
|
||||
*/
|
||||
otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function documented in platform/radio.h
|
||||
*/
|
||||
otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function documented in platform/radio.h
|
||||
*/
|
||||
|
||||
@@ -1307,6 +1307,28 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function documented in platform/radio.h
|
||||
*/
|
||||
otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function documented in platform/radio.h
|
||||
*/
|
||||
otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function documented in platform/radio.h
|
||||
*/
|
||||
|
||||
@@ -966,6 +966,22 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
@@ -941,6 +941,22 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
@@ -350,6 +350,22 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
@@ -515,6 +515,22 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
@@ -74,7 +74,8 @@
|
||||
|
||||
enum
|
||||
{
|
||||
NRF528XX_RECEIVE_SENSITIVITY = -100, // dBm
|
||||
NRF528XX_RECEIVE_SENSITIVITY = -100, // dBm
|
||||
NRF528XX_MIN_CCA_ED_THRESHOLD = -94, // dBm
|
||||
};
|
||||
|
||||
static bool sDisabled;
|
||||
@@ -560,6 +561,51 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
otError error = OT_ERROR_NONE;
|
||||
nrf_802154_cca_cfg_t ccaConfig;
|
||||
|
||||
if (aThreshold == NULL)
|
||||
{
|
||||
error = OT_ERROR_INVALID_ARGS;
|
||||
}
|
||||
else
|
||||
{
|
||||
nrf_802154_cca_cfg_get(&ccaConfig);
|
||||
// The radio driver has no function to convert ED threshold to dBm
|
||||
*aThreshold = (int8_t)ccaConfig.ed_threshold + NRF528XX_MIN_CCA_ED_THRESHOLD;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
otError error = OT_ERROR_NONE;
|
||||
nrf_802154_cca_cfg_t ccaConfig;
|
||||
|
||||
// The minimum value of ED threshold for radio driver is -94 dBm
|
||||
if (aThreshold < NRF528XX_MIN_CCA_ED_THRESHOLD)
|
||||
{
|
||||
error = OT_ERROR_INVALID_ARGS;
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(&ccaConfig, 0, sizeof(ccaConfig));
|
||||
ccaConfig.mode = NRF_RADIO_CCA_MODE_ED;
|
||||
ccaConfig.ed_threshold = nrf_802154_ccaedthres_from_dbm_calculate(aThreshold);
|
||||
|
||||
nrf_802154_cca_cfg_set(&ccaConfig);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
void nrf5RadioProcess(otInstance *aInstance)
|
||||
{
|
||||
bool isEventPending = false;
|
||||
|
||||
@@ -109,6 +109,7 @@ static otPanId sPanid;
|
||||
static bool sPromiscuous = false;
|
||||
static bool sTxWait = false;
|
||||
static int8_t sTxPower = 0;
|
||||
static int8_t sCcaEdThresh = -74;
|
||||
|
||||
static bool sSrcMatchEnabled = false;
|
||||
|
||||
@@ -800,6 +801,24 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
|
||||
{
|
||||
assert(aInstance != NULL);
|
||||
|
||||
*aThreshold = sCcaEdThresh;
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
|
||||
{
|
||||
assert(aInstance != NULL);
|
||||
|
||||
sCcaEdThresh = aThreshold;
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
|
||||
{
|
||||
assert(aInstance != NULL);
|
||||
|
||||
@@ -327,6 +327,20 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
@@ -652,6 +652,22 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aThreshold);
|
||||
|
||||
return OT_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
@@ -381,6 +381,32 @@ otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower);
|
||||
*/
|
||||
otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower);
|
||||
|
||||
/**
|
||||
* Get the radio's CCA ED threshold in dBm.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[out] aThreshold The CCA ED threshold in dBm.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully retrieved the CCA ED threshold.
|
||||
* @retval OT_ERROR_INVALID_ARGS @p aThreshold was NULL.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED CCA ED threshold configuration via dBm is not implemented.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold);
|
||||
|
||||
/**
|
||||
* Set the radio's CCA ED threshold in dBm.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aThreshold The CCA ED threshold in dBm.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the transmit power.
|
||||
* @retval OT_ERROR_INVALID_ARGS Given threshold is out of range.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED CCA ED threshold configuration via dBm is not implemented.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold);
|
||||
|
||||
/**
|
||||
* Get the status of promiscuous mode.
|
||||
*
|
||||
|
||||
@@ -288,6 +288,34 @@ public:
|
||||
*/
|
||||
otError SetTransmitPower(int8_t aPower) { return otPlatRadioSetTransmitPower(GetInstance(), aPower); }
|
||||
|
||||
/**
|
||||
* This method gets the radio's CCA ED threshold in dBm.
|
||||
*
|
||||
* @param[in] aThreshold The CCA ED threshold in dBm.
|
||||
*
|
||||
* @retval OT_ERROR_NONE A reference to output the CCA ED threshold in dBm.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED CCA ED threshold configuration via dBm is not implemented.
|
||||
*
|
||||
*/
|
||||
otError GetCcaEnergyDetectThreshold(int8_t &aThreshold)
|
||||
{
|
||||
return otPlatRadioGetCcaEnergyDetectThreshold(GetInstance(), &aThreshold);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method sets the radio's CCA ED threshold in dBm.
|
||||
*
|
||||
* @param[in] aThreshold The CCA ED threshold in dBm.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the CCA ED threshold.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED CCA ED threshold configuration via dBm is not implemented.
|
||||
*
|
||||
*/
|
||||
otError SetCcaEnergyDetectThreshold(int8_t &aThreshold)
|
||||
{
|
||||
return otPlatRadioSetCcaEnergyDetectThreshold(GetInstance(), aThreshold);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method gets the status of promiscuous mode.
|
||||
*
|
||||
|
||||
@@ -2074,6 +2074,37 @@ template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_PHY_RX_SENSITIVITY>(v
|
||||
return mEncoder.WriteInt8(otPlatRadioGetReceiveSensitivity(mInstance));
|
||||
}
|
||||
|
||||
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_PHY_CCA_THRESHOLD>(void)
|
||||
{
|
||||
int8_t threshold;
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
error = otPlatRadioGetCcaEnergyDetectThreshold(mInstance, &threshold);
|
||||
|
||||
if (error == OT_ERROR_NONE)
|
||||
{
|
||||
error = mEncoder.WriteInt8(threshold);
|
||||
}
|
||||
else
|
||||
{
|
||||
error = mEncoder.OverwriteWithLastStatusError(ThreadErrorToSpinelStatus(error));
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_PHY_CCA_THRESHOLD>(void)
|
||||
{
|
||||
int8_t threshold = 0;
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
SuccessOrExit(error = mDecoder.ReadInt8(threshold));
|
||||
error = otPlatRadioSetCcaEnergyDetectThreshold(mInstance, threshold);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_PHY_TX_POWER>(void)
|
||||
{
|
||||
int8_t power;
|
||||
|
||||
@@ -86,6 +86,9 @@ NcpBase::PropertyHandler NcpBase::FindGetPropertyHandler(spinel_prop_key_t aKey)
|
||||
case SPINEL_PROP_PHY_RX_SENSITIVITY:
|
||||
handler = &NcpBase::HandlePropertyGet<SPINEL_PROP_PHY_RX_SENSITIVITY>;
|
||||
break;
|
||||
case SPINEL_PROP_PHY_CCA_THRESHOLD:
|
||||
handler = &NcpBase::HandlePropertyGet<SPINEL_PROP_PHY_CCA_THRESHOLD>;
|
||||
break;
|
||||
case SPINEL_PROP_PHY_TX_POWER:
|
||||
handler = &NcpBase::HandlePropertyGet<SPINEL_PROP_PHY_TX_POWER>;
|
||||
break;
|
||||
@@ -693,6 +696,9 @@ NcpBase::PropertyHandler NcpBase::FindSetPropertyHandler(spinel_prop_key_t aKey)
|
||||
case SPINEL_PROP_UNSOL_UPDATE_FILTER:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_UNSOL_UPDATE_FILTER>;
|
||||
break;
|
||||
case SPINEL_PROP_PHY_CCA_THRESHOLD:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_PHY_CCA_THRESHOLD>;
|
||||
break;
|
||||
case SPINEL_PROP_PHY_TX_POWER:
|
||||
handler = &NcpBase::HandlePropertySet<SPINEL_PROP_PHY_TX_POWER>;
|
||||
break;
|
||||
|
||||
@@ -886,6 +886,14 @@ otError RadioSpinel::GetTransmitPower(int8_t &aPower)
|
||||
return error;
|
||||
}
|
||||
|
||||
otError RadioSpinel::GetCcaEnergyDetectThreshold(int8_t &aThreshold)
|
||||
{
|
||||
otError error = Get(SPINEL_PROP_PHY_CCA_THRESHOLD, SPINEL_DATATYPE_INT8_S, &aThreshold);
|
||||
|
||||
LogIfFail("Get CCA ED threshold failed", error);
|
||||
return error;
|
||||
}
|
||||
|
||||
int8_t RadioSpinel::GetRssi(void)
|
||||
{
|
||||
int8_t rssi = OT_RADIO_RSSI_INVALID;
|
||||
@@ -957,6 +965,13 @@ otError RadioSpinel::SetTransmitPower(int8_t aPower)
|
||||
return error;
|
||||
}
|
||||
|
||||
otError RadioSpinel::SetCcaEnergyDetectThreshold(int8_t aThreshold)
|
||||
{
|
||||
otError error = Set(SPINEL_PROP_PHY_CCA_THRESHOLD, SPINEL_DATATYPE_INT8_S, aThreshold);
|
||||
LogIfFail("Set CCA ED threshold failed", error);
|
||||
return error;
|
||||
}
|
||||
|
||||
otError RadioSpinel::EnergyScan(uint8_t aScanChannel, uint16_t aScanDuration)
|
||||
{
|
||||
otError error;
|
||||
@@ -1681,6 +1696,19 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
|
||||
return sRadioSpinel.SetTransmitPower(aPower);
|
||||
}
|
||||
|
||||
otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
|
||||
{
|
||||
assert(aThreshold != NULL);
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
return sRadioSpinel.GetTransmitPower(*aThreshold);
|
||||
}
|
||||
|
||||
otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
return sRadioSpinel.GetCcaEnergyDetectThreshold(aThreshold);
|
||||
}
|
||||
|
||||
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
@@ -162,6 +162,30 @@ public:
|
||||
*/
|
||||
otError SetTransmitPower(int8_t aPower);
|
||||
|
||||
/**
|
||||
* This method gets the radio's CCA ED threshold in dBm.
|
||||
*
|
||||
* @param[out] aThreshold The CCA ED threshold in dBm.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Succeeded.
|
||||
* @retval OT_ERROR_BUSY Failed due to another operation is on going.
|
||||
* @retval OT_ERROR_RESPONSE_TIMEOUT Failed due to no response received from the transceiver.
|
||||
*
|
||||
*/
|
||||
otError GetCcaEnergyDetectThreshold(int8_t &aThreshold);
|
||||
|
||||
/**
|
||||
* This method sets the radio's CCA ED threshold in dBm.
|
||||
*
|
||||
* @param[in] aThreshold The CCA ED threshold in dBm.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Succeeded.
|
||||
* @retval OT_ERROR_BUSY Failed due to another operation is on going.
|
||||
* @retval OT_ERROR_RESPONSE_TIMEOUT Failed due to no response received from the transceiver.
|
||||
*
|
||||
*/
|
||||
otError SetCcaEnergyDetectThreshold(int8_t aThreshold);
|
||||
|
||||
/**
|
||||
* This method returns the radio sw version string.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user