#include "stm32f10x_it.h"
#include "bsp_led.h"
#include "bsp_exti.h"
extern char i;
//中断服务函数
void KEY1_IRQHandler(void)
{
if(EXTI_GetITStatus(KEY1_INT_EXTI_LINE) != RESET)
{
switch(i)
{
case 0: LED_RED; break; //红
case 1: LED_GREEN; break; //绿
case 2: LED_BLUE; break; //蓝
case 3: LED_YELLOW; break; //黄(红+绿)
case 4: LED_PURPLE; break; //紫(红+蓝)
case 5: LED_CYAN; break; //青(绿+蓝)
case 6: LED_WHITE; break; //白(红+绿+蓝)
default: LED_RGBOFF; break; //黑(全部关闭)
}
i=(i++)%7;
EXTI_ClearITPendingBit(KEY1_INT_EXTI_LINE);
}
} |