Merge pull request #1219 from uestczyh222/master

[Bsp]增强F10x_HAL的GPIO中断逻辑
This commit is contained in:
Bernard Xiong 2018-02-09 17:21:29 +08:00 committed by GitHub
commit a30a52d78d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

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