call `HAL_GPIO_Init()` by default

This commit is contained in:
Diamond Rivero 2024-10-11 16:37:51 +08:00 committed by Rbb666
parent 6b0671b336
commit df36d1806c
1 changed files with 1 additions and 1 deletions

View File

@ -395,6 +395,7 @@ static rt_err_t stm32_pin_irq_enable(struct rt_device *device, rt_base_t pin,
rt_base_t level;
rt_int32_t irqindex = -1;
GPIO_InitTypeDef GPIO_InitStruct;
HAL_GPIO_Init(PIN_STPORT(pin), &GPIO_InitStruct);
if (PIN_PORT(pin) >= PIN_STPORT_MAX)
{
@ -437,7 +438,6 @@ static rt_err_t stm32_pin_irq_enable(struct rt_device *device, rt_base_t pin,
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
break;
}
HAL_GPIO_Init(PIN_STPORT(pin), &GPIO_InitStruct);
HAL_NVIC_SetPriority(irqmap->irqno, 5, 0);
HAL_NVIC_EnableIRQ(irqmap->irqno);