From 3ea5cd0bdbe882bb63925302210cd0e4f2d328b6 Mon Sep 17 00:00:00 2001 From: uestczyh222 Date: Fri, 9 Feb 2018 17:03:41 +0800 Subject: [PATCH] =?UTF-8?q?[Bsp]=E5=A2=9E=E5=BC=BAF10x=5FHAL=E7=9A=84GPIO?= =?UTF-8?q?=E4=B8=AD=E6=96=AD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/stm32f10x-HAL/drivers/drv_gpio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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);