Skip to content

Commit 8f8cdc1

Browse files
pabigotgalak
authored andcommitted
gpio: clean up flags related to logical initialization
The wrapper function detects when a logic-level initial value requires inverting the physical level initial value, and updates the flags to effect the necessary change. However where logical and physical levels are not inverted the flag requesting logic-level initialization was left in place and passed to a driver that got confused by it. Clear the flag after its purpose has been addressed. Signed-off-by: Peter Bigot <[email protected]>
1 parent 7699563 commit 8f8cdc1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

include/drivers/gpio.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,10 +572,11 @@ static inline int gpio_pin_configure(const struct device *port,
572572
if (((flags & GPIO_OUTPUT_INIT_LOGICAL) != 0)
573573
&& ((flags & (GPIO_OUTPUT_INIT_LOW | GPIO_OUTPUT_INIT_HIGH)) != 0)
574574
&& ((flags & GPIO_ACTIVE_LOW) != 0)) {
575-
flags ^= GPIO_OUTPUT_INIT_LOW | GPIO_OUTPUT_INIT_HIGH
576-
| GPIO_OUTPUT_INIT_LOGICAL;
575+
flags ^= GPIO_OUTPUT_INIT_LOW | GPIO_OUTPUT_INIT_HIGH;
577576
}
578577

578+
flags &= ~GPIO_OUTPUT_INIT_LOGICAL;
579+
579580
(void)cfg;
580581
__ASSERT((cfg->port_pin_mask & (gpio_port_pins_t)BIT(pin)) != 0U,
581582
"Unsupported pin");

0 commit comments

Comments
 (0)