中断函数如下:
- void EXTI9_5_IRQHandler(void)
- {
- BaseType_t xHigherPriorityTaskWoken = pdFALSE;
-
-
- if(EXTI_GetITStatus(EXTI_Line9) != RESET)
- {
- debug("%d",GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_9));
- debug("%d",GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_9));
- debug("%d",GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_9));
- if(GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_9) != 0)
- {
- debug("relay power on, device_power_on is 1");
- xTaskNotifyFromISR( xTaskHandleLoadDatatoServerBuf, g_flag_event[RELAY_POWER_ON], eSetBits, &xHigherPriorityTaskWoken );
- g_data_info.power_on = 1;
- }else
- {
- debug("relay power off, device_power_on is 0");
- xTaskNotifyFromISR( xTaskHandleLoadDatatoServerBuf, g_flag_event[RELAY_POWER_OFF], eSetBits, &xHigherPriorityTaskWoken );
- g_data_info.power_on = 0;
- }
- EXTI_ClearITPendingBit(EXTI_Line9);
- }
- portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
- }
|