/*
* @name HAL_GPIO_EXTI_Callback
* @brief 外部中断回调函数
* @param GPIO_Pin:触发外部中断的引脚
* @retval None
*/
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
uint8_t i;
if(GPIO_Pin == KEY1_Pin)
{
printf("检测到按键1被按下\r\n");
LowPower.Enter_Sleep_Mode_Flag = TRUE;
LED.LED_Fun(LED2,LED_ON);
for(i=0;i<100;i++)
{
HAL_Delay(10);
if(HAL_GPIO_ReadPin(KEY1_GPIO_Port,KEY1_Pin) == GPIO_PIN_SET)
{
LowPower.Enter_Sleep_Mode_Flag = FALSE;
printf("按键1提前释放,系统正常运行\r\n");
break;
}
}
LED.LED_Fun(LED2,LED_OFF);
}
if(GPIO_Pin == KEY2_Pin)
{
printf("检测到按键2被按下\r\n");
LowPower.Enter_Stop_Mode_Flag = TRUE;
LED.LED_Fun(LED2,LED_ON);
for(i=0;i<100;i++)
{
HAL_Delay(10);
if(HAL_GPIO_ReadPin(KEY2_GPIO_Port,KEY2_Pin) == GPIO_PIN_SET)
{
LowPower.Enter_Stop_Mode_Flag = FALSE;
printf("按键2提前释放,系统正常运行\r\n");
break;
}
}
LED.LED_Fun(LED2,LED_OFF);
}
if(GPIO_Pin == KEY3_Pin)
{
printf("检测到按键3被按下\r\n");
LowPower.Enter_Standby_Mode_Flag = TRUE;
LED.LED_Fun(LED2,LED_ON);
for(i=0;i<100;i++)
{
HAL_Delay(10);
if(HAL_GPIO_ReadPin(KEY3_GPIO_Port,KEY3_Pin) == GPIO_PIN_SET)
{
LowPower.Enter_Standby_Mode_Flag = FALSE;
printf("按键3提前释放,系统正常运行\r\n");
break;
}
}
LED.LED_Fun(LED2,LED_OFF);
}
}
|