Skip to content

Commit 677246a

Browse files
bjarki-andreasenjfischer-no
authored andcommitted
[nrf fromtree] drivers: gpio: gpio_nrfx: store init output val for get_config
The nRF GPIO hardware does not store the initial output value set resulting from gpio_pin_configure() and thus, when gpio_get_config() is used, the initial value is not returned. This commit just reads the output value and sets the INIT value to match in gpio_get_config(). Signed-off-by: Bjarki Arge Andreasen <[email protected]> (cherry picked from commit 08269963370be2188a7c1898066f0fd6a3c8cbeb)
1 parent 62dade7 commit 677246a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/gpio/gpio_nrfx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,9 @@ static int gpio_nrfx_pin_get_config(const struct device *port, gpio_pin_t pin,
254254

255255
if (dir == NRF_GPIO_PIN_DIR_OUTPUT) {
256256
*flags |= GPIO_OUTPUT;
257+
*flags |= nrf_gpio_pin_out_read(abs_pin)
258+
? GPIO_OUTPUT_INIT_HIGH
259+
: GPIO_OUTPUT_INIT_LOW;
257260
}
258261

259262
nrf_gpio_pin_input_t input = nrf_gpio_pin_input_get(abs_pin);

0 commit comments

Comments
 (0)