[diag] add gpio diag command support (#8316)

This commit is contained in:
Zhanglong Xia
2022-10-31 17:05:20 -07:00
committed by GitHub
parent 1d1e5d16e0
commit 11a24d111f
14 changed files with 369 additions and 23 deletions
+29
View File
@@ -166,6 +166,13 @@ static otMacKeyMaterial sCurrKey;
static otMacKeyMaterial sNextKey;
static otRadioKeyType sKeyType;
enum
{
SIM_GPIO = 0,
};
static bool sGpioValue = false;
static int8_t GetRssi(uint16_t aChannel);
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
@@ -1399,3 +1406,25 @@ void parseFromEnvAsUint16(const char *aEnvName, uint16_t *aValue)
}
}
}
otError otPlatDiagGpioSet(uint32_t aGpio, bool aValue)
{
otError error = OT_ERROR_NONE;
otEXPECT_ACTION(aGpio == SIM_GPIO, error = OT_ERROR_INVALID_ARGS);
sGpioValue = aValue;
exit:
return error;
}
otError otPlatDiagGpioGet(uint32_t aGpio, bool *aValue)
{
otError error = OT_ERROR_NONE;
otEXPECT_ACTION((aGpio == SIM_GPIO) && (aValue != NULL), error = OT_ERROR_INVALID_ARGS);
*aValue = sGpioValue;
exit:
return error;
}