paolo della vedova
/
interrupt_test_stm32_nucle
interrupt test EXTI stm32 nucleo
Diff: main.cpp
- Revision:
- 1:d049e15030ca
- Parent:
- 0:c5e2a50f0d5d
- Child:
- 2:70bfc841a60f
diff -r c5e2a50f0d5d -r d049e15030ca main.cpp --- a/main.cpp Sun Oct 25 10:32:26 2015 +0000 +++ b/main.cpp Mon Oct 26 10:12:47 2015 +0000 @@ -1,31 +1,30 @@ - #include "mbed.h" #include "stm32f4xx.h" #include "stm32f4xx_hal_tim_ex.h" #include "stm32f4xx_hal_conf.h" - - - + + + int16_t count1 = 10; - - + + void EXTI0_IRQHandler(void) { HAL_NVIC_ClearPendingIRQ(EXTI0_IRQn); HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_0); } - + void HAL_GPIO_EXTI_Callback (uint16_t GPIO_Pin) { if (GPIO_Pin == GPIO_PIN_0) { count1 = 0; } } - + int main() { HAL_Init(); - + GPIO_InitTypeDef GPIO_InitStruct; __GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_0; //PA0 as interrupt test @@ -33,18 +32,18 @@ GPIO_InitStruct.Pull = GPIO_PULLDOWN; GPIO_InitStruct.Speed = GPIO_SPEED_FAST; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); - HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); - HAL_NVIC_SetPriority(SysTick_IRQn, 0, 1); HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 1); HAL_NVIC_EnableIRQ(EXTI0_IRQn); - - + + while (1) { - + printf("loop%d\r\n", count1); wait(1); - - + + } - -} \ No newline at end of file + +} + +