diff --git a/cpu/sam0_common/periph/gpio_ll.c b/cpu/sam0_common/periph/gpio_ll.c index a8a7c137133a..d375faeda9db 100644 --- a/cpu/sam0_common/periph/gpio_ll.c +++ b/cpu/sam0_common/periph/gpio_ll.c @@ -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; }