Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 9 months ago.
STM32F469 - How to write interrupts for lines 5-15? Do I need to start using a library with EXTI?
I'm trying to program interrupts for the STM32F469 Discovery Board. I have successfully managed to code it for pin A5 (PA_4), with the following setup code:
- define WASHER_SIGNAL_PIN GPIO_PIN_4
- define WASHER_SIGNAL_GPIO_PORT GPIOA
- define WASHER_SIGNAL_GPIO_CLK_ENABLE() HAL_RCC_GPIOA_CLK_ENABLE()
- define WASHER_SIGNAL_GPIO_CLK_DISABLE() HAL_RCC_GPIOA_CLK_DISABLE()
- define WASHER_SIGNAL_EXTI_IRQn EXTI4_IRQn
void EwBspConfigWasherPin( TPinCallback aPinCallback ) { GPIO_InitTypeDef GPIO_InitStructure;
/* Enable GPIOC clock */ WASHER_SIGNAL_GPIO_CLK_ENABLE();
/* Configure washer signal pin as input floating */ GPIO_InitStructure.Mode = GPIO_MODE_IT_RISING_FALLING; GPIO_InitStructure.Pull = GPIO_NOPULL; GPIO_InitStructure.Pin = WASHER_SIGNAL_PIN; HAL_GPIO_Init( WASHER_SIGNAL_GPIO_PORT, &GPIO_InitStructure );
/* Enable and set EXTI lines 0 Interrupt to the lowest priority */ HAL_NVIC_SetPriority( WASHER_SIGNAL_EXTI_IRQn, 8, 0 ); HAL_NVIC_EnableIRQ( WASHER_SIGNAL_EXTI_IRQn );
WasherCallback = aPinCallback; }
This uses the HAL GPIO Library. But how can I use interrupts on pins 5-15? Do I need to start using a new library with the EXTI commands? Where is this library if so? If seems that the EXTI and GPIO commands are similar (i.e. mode, trigger, pin etc).
1 Answer
7 years, 9 months ago.
Hi,
Why don't you use the mbed HAL ?
For example:
InterruptIn extpin1(PA_4); InterruptIn extpin2(PB_5);
All the GPIO and EXTI configuration are managed for you.