mirror of
https://github.com/espressif/openthread.git
synced 2026-07-29 23:27:46 +00:00
[nrf528xx] add support for reading state of an output pin (#4302)
This commit is contained in:
committed by
Jonathan Hui
parent
e98de3f358
commit
7cd4ffcc2c
@@ -256,12 +256,22 @@ static void processGpio(otInstance *aInstance, int argc, char *argv[], char *aOu
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
uint32_t value;
|
||||
uint32_t value;
|
||||
nrf_gpio_pin_dir_t pindir;
|
||||
|
||||
error = parseLong(argv[0], &pinnum);
|
||||
otEXPECT(error == OT_ERROR_NONE);
|
||||
|
||||
value = nrf_gpio_pin_read(pinnum);
|
||||
pindir = nrf_gpio_pin_dir_get(pinnum);
|
||||
|
||||
if (pindir == NRF_GPIO_PIN_DIR_INPUT)
|
||||
{
|
||||
value = nrf_gpio_pin_read(pinnum);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = nrf_gpio_pin_out_read(pinnum);
|
||||
}
|
||||
|
||||
snprintf(aOutput, aOutputMaxLen, "gpio %d = %d\r\n", (uint8_t)pinnum, (uint8_t)value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user