MxDb.Version=DB.5.0.20
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false
+NVIC.EXTI0_IRQn=true\:0\:0\:false\:false\:true\:true\:true
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.MemoryManagement_IRQn=true\:0\:0\:true\:false\:true\:false\:false
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false
-NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
+NVIC.PriorityGroup=NVIC_PRIORITYGROUP_2
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
PA7.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
PA7.Locked=true
PA7.Signal=GPIO_Output
-PC0.GPIOParameters=GPIO_Label
+PC0.GPIOParameters=GPIO_Label,GPIO_ModeDefaultEXTI
PC0.GPIO_Label=KEY1
+PC0.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING
PC0.Locked=true
-PC0.Signal=GPIO_Input
+PC0.Signal=GPXTI0
PCC.Checker=false
PCC.Line=STM32F103
PCC.MCU=STM32F103R(C-D-E)Tx
RCC.TimSysFreq_Value=72000000
RCC.USBFreq_Value=72000000
RCC.VCOOutput2Freq_Value=12000000
+SH.GPXTI0.0=GPIO_EXTI0
+SH.GPXTI0.ConfNb=1
VP_SYS_VS_Systick.Mode=SysTick
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
board=custom
/* Private defines -----------------------------------------------------------*/\r
#define KEY1_Pin GPIO_PIN_0\r
#define KEY1_GPIO_Port GPIOC\r
+#define KEY1_EXTI_IRQn EXTI0_IRQn\r
#define LED1_Pin GPIO_PIN_4\r
#define LED1_GPIO_Port GPIOA\r
#define LED2_Pin GPIO_PIN_5\r
void DebugMon_Handler(void);\r
void PendSV_Handler(void);\r
void SysTick_Handler(void);\r
+void EXTI0_IRQHandler(void);\r
/* USER CODE BEGIN EFP */\r
\r
/* USER CODE END EFP */\r
\r
/*Configure GPIO pin : PtPin */\r
GPIO_InitStruct.Pin = KEY1_Pin;\r
- GPIO_InitStruct.Mode = GPIO_MODE_INPUT;\r
+ GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;\r
GPIO_InitStruct.Pull = GPIO_NOPULL;\r
HAL_GPIO_Init(KEY1_GPIO_Port, &GPIO_InitStruct);\r
\r
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;\r
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);\r
\r
+ /* EXTI interrupt init*/\r
+ HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 0);\r
+ HAL_NVIC_EnableIRQ(EXTI0_IRQn);\r
+\r
}\r
\r
/* USER CODE BEGIN 2 */\r
-\r
+void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {\r
+ HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, SET);\r
+}\r
/* USER CODE END 2 */\r
\r
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
/* USER CODE BEGIN WHILE */\r
while (1)\r
{\r
- HAL_GPIO_TogglePin(LED1_GPIO_Port, LED1_Pin);\r
+ HAL_GPIO_TogglePin(LED2_GPIO_Port, LED2_Pin);\r
HAL_Delay(100);\r
/* USER CODE END WHILE */\r
\r
__HAL_RCC_AFIO_CLK_ENABLE();\r
__HAL_RCC_PWR_CLK_ENABLE();\r
\r
+ HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_2);\r
+\r
/* System interrupt init*/\r
\r
/** NOJTAG: JTAG-DP Disabled and SW-DP Enabled \r
/* please refer to the startup file (startup_stm32f1xx.s). */\r
/******************************************************************************/\r
\r
+/**\r
+ * @brief This function handles EXTI line0 interrupt.\r
+ */\r
+void EXTI0_IRQHandler(void)\r
+{\r
+ /* USER CODE BEGIN EXTI0_IRQn 0 */\r
+\r
+ /* USER CODE END EXTI0_IRQn 0 */\r
+ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_0);\r
+ /* USER CODE BEGIN EXTI0_IRQn 1 */\r
+\r
+ /* USER CODE END EXTI0_IRQn 1 */\r
+}\r
+\r
/* USER CODE BEGIN 1 */\r
\r
/* USER CODE END 1 */\r