mirror of
https://github.com/espressif/openthread.git
synced 2026-09-13 04:30:08 +00:00
[diag] add gpio diag command support (#8316)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user