drivers: gpio: rpi_pico: fix call to gpio_set_dir
Ensure gpio_set_dir() receives GPIO_IN or GPIO_OUT by mapping INIT_{LOW,HIGH} flags explicitly, instead of passing raw bitmasks. Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This commit is contained in:
parent
d1fc8c7f29
commit
67b4055d57
1 changed files with 4 additions and 2 deletions
|
@ -161,11 +161,13 @@ static int gpio_rpi_configure(const struct device *dev,
|
|||
if (flags & GPIO_LINE_OPEN_DRAIN) {
|
||||
data->open_drain_mask |= BIT(pin);
|
||||
gpio_put(pin + offset, 0);
|
||||
gpio_set_dir(pin + offset, flags & GPIO_OUTPUT_INIT_LOW);
|
||||
gpio_set_dir(pin + offset,
|
||||
(flags & GPIO_OUTPUT_INIT_LOW) ? GPIO_OUT : GPIO_IN);
|
||||
} else {
|
||||
data->open_drain_mask &= ~(BIT(pin));
|
||||
gpio_put(pin + offset, 1);
|
||||
gpio_set_dir(pin + offset, flags & GPIO_OUTPUT_INIT_HIGH);
|
||||
gpio_set_dir(pin + offset,
|
||||
(flags & GPIO_OUTPUT_INIT_HIGH) ? GPIO_OUT : GPIO_IN);
|
||||
}
|
||||
} else {
|
||||
data->single_ended_mask &= ~(BIT(pin));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue