[efr32] radio: fix otPlatRadioGetTransmitPower (#5932)

The efr32 platform shows the following behavior:

> txpower -10
Done
>
> txpower
-113 dBm
Done

The bug is caused by the C promotion rules during the division of
int16_t by unsigned in otPlatRadioGetTransmitPower. This commit fixes
the issue.
This commit is contained in:
Diego Ismirlian
2020-12-10 07:59:56 -08:00
committed by GitHub
parent e2856b9111
commit d23f3581ea
+2 -2
View File
@@ -1126,7 +1126,7 @@ otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
// RAIL_GetTxPowerDbm() returns power in deci-dBm (0.1dBm)
// Divide by 10 because aPower is supposed be in units dBm
*aPower = RAIL_GetTxPowerDbm(gRailHandle) / 10U;
*aPower = RAIL_GetTxPowerDbm(gRailHandle) / 10;
exit:
return error;
@@ -1140,7 +1140,7 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
// RAIL_SetTxPowerDbm() takes power in units of deci-dBm (0.1dBm)
// Divide by 10 because aPower is supposed be in units dBm
status = RAIL_SetTxPowerDbm(gRailHandle, ((RAIL_TxPower_t)aPower) * 10U);
status = RAIL_SetTxPowerDbm(gRailHandle, ((RAIL_TxPower_t)aPower) * 10);
assert(status == RAIL_STATUS_NO_ERROR);
return OT_ERROR_NONE;