mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
cpu/sam0_common/periph_gpio_ll: fix gpio_query_conf()
For the other MCUs, we take the input register state instead of the
output register state when the pin is configured as input. Let's do
the same here, as this is a lot more useful and intuitive.
(cherry picked from commit 0222b8c54c
)
This commit is contained in:
parent
cd84ea5ff2
commit
779aaedcc5
@ -204,7 +204,12 @@ gpio_conf_t gpio_ll_query_conf(gpio_port_t port, uint8_t pin)
|
||||
}
|
||||
}
|
||||
|
||||
result.initial_value = iobus->OUT.reg & pin_mask;
|
||||
if (result.state == GPIO_INPUT) {
|
||||
result.initial_value = (gpio_ll_read(port) >> pin) & 1UL;
|
||||
}
|
||||
else {
|
||||
result.initial_value = (gpio_ll_read_output(port) >> pin) & 1UL;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user