diff --git a/bsp/stm32f10x-HAL/drivers/drv_gpio.c b/bsp/stm32f10x-HAL/drivers/drv_gpio.c index e0701e663..a61f5ab2a 100644 --- a/bsp/stm32f10x-HAL/drivers/drv_gpio.c +++ b/bsp/stm32f10x-HAL/drivers/drv_gpio.c @@ -772,18 +772,20 @@ rt_err_t stm32_pin_irq_enable(struct rt_device *device, rt_base_t pin, index->rcc(); /* Configure GPIO_InitStructure */ GPIO_InitStruct.Pin = index->pin; - GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; switch (pin_irq_hdr_tab[irqindex].mode) { case PIN_IRQ_MODE_RISING: GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING; + GPIO_InitStruct.Pull = GPIO_PULLDOWN; break; case PIN_IRQ_MODE_FALLING: GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING; + GPIO_InitStruct.Pull = GPIO_PULLUP; break; case PIN_IRQ_MODE_RISING_FALLING: GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING; + GPIO_InitStruct.Pull = GPIO_NOPULL; break; } HAL_GPIO_Init(index->gpio, &GPIO_InitStruct);