I configured gpio
and exti
handler configurations for 8 pins (PD8,PD9...PD15)
each has separate configuration functions and it's working well. Can i do the configurations at just one function? Some lines uses same irq channel, is that a problem? I want to use it like this (syntax is not important, you can just say its possible)
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 |
GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15);
GPIO_Init(GPIOD, &GPIO_InitStructure);
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOD,EXTI_PinSource8 | EXTI_PinSource9|
EXTI_PinSource10| EXTI_PinSource11|
EXTI_PinSource12| EXTI_PinSource13|
EXTI_PinSource14| EXTI_PinSource15);
/* Configure EXTI Line0 */
EXTI_InitStructure.EXTI_Line = EXTI_Line15;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_Init(&EXTI_InitStructure);
You can initialise all your GPIO pins in one line, that's safe. You cannot do all your calls to SYSCFG_EXTILineConfig
in one line, that's not allowed. The reason is that the EXTI_PinSourceN
values are numeric constants and not bitmasks. See stm32f4xx_syscfg.h
for reference.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.