1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +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.
This commit is contained in:
Marian Buschsieweke 2024-11-18 14:27:14 +01:00
parent 72d0b2b180
commit 0222b8c54c
No known key found for this signature in database
GPG Key ID: 758BD52517F79C41

View File

@ -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;
}