diff options
-rw-r--r-- | chip/stm32/gpio-stm32f100.c | 4 | ||||
-rw-r--r-- | chip/stm32/gpio-stm32l15x.c | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/chip/stm32/gpio-stm32f100.c b/chip/stm32/gpio-stm32f100.c index dd729eab82..8c071394e4 100644 --- a/chip/stm32/gpio-stm32f100.c +++ b/chip/stm32/gpio-stm32f100.c @@ -73,11 +73,11 @@ int gpio_set_flags(enum gpio_signal signal, int flags) } else { /* GPIOx_ODR determines which resistor to activate in * input mode, see Table 16 (datasheet rm0041) */ - if (flags & GPIO_PULL_UP) { + if ((flags & GPIO_PULL_UP) == GPIO_PULL_UP) { mask |= 0x88888888 & cnf; STM32_GPIO_BSRR_OFF(g->port) |= g->mask; gpio_set_level(signal, 1); - } else if (flags & GPIO_PULL_DOWN) { + } else if ((flags & GPIO_PULL_DOWN) == GPIO_PULL_DOWN) { mask |= 0x88888888 & cnf; gpio_set_level(signal, 0); } else { diff --git a/chip/stm32/gpio-stm32l15x.c b/chip/stm32/gpio-stm32l15x.c index c80e57604b..f5513dafb8 100644 --- a/chip/stm32/gpio-stm32l15x.c +++ b/chip/stm32/gpio-stm32l15x.c @@ -42,9 +42,11 @@ int gpio_pre_init(void) uint32_t val; val = STM32_GPIO_PUPDR_OFF(g->port) & ~mask2; - if (g->flags & GPIO_PULL_UP) /* Pull Up = 01 */ + if ((g->flags & GPIO_PULL_UP) == GPIO_PULL_UP) + /* Pull Up = 01 */ val |= 0x55555555 & mask2; - else if (g->flags & GPIO_PULL_DOWN) /* Pull Down = 10 */ + else if ((g->flags & GPIO_PULL_DOWN) == GPIO_PULL_DOWN) + /* Pull Down = 10 */ val |= 0xaaaaaaaa & mask2; STM32_GPIO_PUPDR_OFF(g->port) = val; |