arch/arm/nrf{52|53|91}: fix read GPIO state for outputs

when GPIO is configured as output, we have to read output
state instead of input register
This commit is contained in:
raiden00pl 2024-09-13 19:01:23 +02:00 committed by Xiang Xiao
parent e3bbd0cfd8
commit 65a3b5f524
3 changed files with 24 additions and 3 deletions

View File

@ -409,7 +409,14 @@ bool nrf52_gpio_read(nrf52_pinset_t pinset)
/* Get register address */
offset = nrf52_gpio_regget(port, NRF52_GPIO_IN_OFFSET);
if ((pinset & GPIO_FUNC_MASK) == GPIO_OUTPUT)
{
offset = nrf52_gpio_regget(port, NRF52_GPIO_OUTSET_OFFSET);
}
else
{
offset = nrf52_gpio_regget(port, NRF52_GPIO_IN_OFFSET);
}
/* Get register value */

View File

@ -468,7 +468,14 @@ bool nrf53_gpio_read(nrf53_pinset_t pinset)
/* Get register address */
offset = nrf53_gpio_regget(port, NRF53_GPIO_IN_OFFSET);
if ((pinset & GPIO_FUNC_MASK) == GPIO_OUTPUT)
{
offset = nrf53_gpio_regget(port, NRF53_GPIO_OUTSET_OFFSET);
}
else
{
offset = nrf53_gpio_regget(port, NRF53_GPIO_IN_OFFSET);
}
/* Get register value */

View File

@ -401,7 +401,14 @@ bool nrf91_gpio_read(nrf91_pinset_t pinset)
/* Get register address */
offset = nrf91_gpio_regget(port, NRF91_GPIO_IN_OFFSET);
if ((pinset & GPIO_FUNC_MASK) == GPIO_OUTPUT)
{
offset = nrf91_gpio_regget(port, NRF91_GPIO_OUTSET_OFFSET);
}
else
{
offset = nrf91_gpio_regget(port, NRF91_GPIO_IN_OFFSET);
}
/* Get register value */