Skip to content

Commit 78c83b3

Browse files
authored
Merge pull request #1236 from zhang-peter/patch-1
stm32f10x enters external interrupt handler forever
2 parents b9c2acb + d3cb747 commit 78c83b3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

bsp/stm32f10x/drivers/gpio.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121

2222
#define STM32F10X_PIN_NUMBERS 100 //[48, 64, 100, 144 ]
2323

24-
#define __STM32_PIN(index, rcc, gpio, gpio_index) { 0, RCC_##rcc##Periph_GPIO##gpio, GPIO##gpio, GPIO_Pin_##gpio_index}
25-
#define __STM32_PIN_DEFAULT {-1, 0, 0, 0}
24+
#define __STM32_PIN(index, rcc, gpio, gpio_index) { 0, RCC_##rcc##Periph_GPIO##gpio, GPIO##gpio, GPIO_Pin_##gpio_index, GPIO_PortSourceGPIO##gpio, GPIO_PinSource##gpio_index}
25+
#define __STM32_PIN_DEFAULT {-1, 0, 0, 0, 0, 0}
2626

2727
/* STM32 GPIO driver */
2828
struct pin_index
@@ -31,6 +31,8 @@ struct pin_index
3131
uint32_t rcc;
3232
GPIO_TypeDef *gpio;
3333
uint32_t pin;
34+
uint8_t port_source;
35+
uint8_t pin_source;
3436
};
3537

3638
static const struct pin_index pins[] =
@@ -695,6 +697,7 @@ rt_err_t stm32_pin_irq_enable(struct rt_device *device, rt_base_t pin,
695697
NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE;
696698
NVIC_Init(&NVIC_InitStructure);
697699

700+
GPIO_EXTILineConfig(index->port_source, index->pin_source);
698701
EXTI_InitStructure.EXTI_Line = irqmap->irqbit;
699702
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
700703
switch(pin_irq_hdr_tab[irqindex].mode)

0 commit comments

Comments
 (0)