这是中断配置
void EXTI_config()
{
GPIO_Init(GPIOB, GPIO_Pin_0, GPIO_Mode_In_FL_IT); //KEY3
GPIO_Init(GPIOB, GPIO_Pin_1, GPIO_Mode_In_FL_IT); //KEY1
GPIO_Init(GPIOD, GPIO_Pin_3, GPIO_Mode_In_FL_IT); //KEY5
GPIO_Init(GPIOD, GPIO_Pin_4, GPIO_Mode_In_FL_IT); //KEY7
GPIO_Init(GPIOD, GPIO_Pin_5, GPIO_Mode_In_FL_IT); //KEY2
GPIO_Init(GPIOD, GPIO_Pin_6, GPIO_Mode_In_FL_IT); //KEY4
GPIO_Init(GPIOD, GPIO_Pin_7, GPIO_Mode_In_FL_IT); //KEY6
GPIO_Init(GPIOF, GPIO_Pin_0, GPIO_Mode_In_FL_IT); //SCRAM
EXTI_SetPinSensitivity(EXTI_Pin_0, EXTI_Trigger_Falling_Low);
EXTI_SetPinSensitivity(EXTI_Pin_1, EXTI_Trigger_Falling_Low);
EXTI_SetPinSensitivity(EXTI_Pin_3, EXTI_Trigger_Falling_Low);
EXTI_SetPinSensitivity(EXTI_Pin_4, EXTI_Trigger_Falling_Low);
EXTI_SetPinSensitivity(EXTI_Pin_5, EXTI_Trigger_Falling_Low);
EXTI_SetPinSensitivity(EXTI_Pin_6, EXTI_Trigger_Falling_Low);
EXTI_SetPinSensitivity(EXTI_Pin_7, EXTI_Trigger_Falling_Low);
ITC_SetSoftwarePriority(EXTI4_IRQn, ITC_PriorityLevel_1); //关机键的优先级
ITC_SetSoftwarePriority(EXTI0_IRQn, ITC_PriorityLevel_2); //功能键和急停的优先级
ITC_SetSoftwarePriority(EXTI6_IRQn, ITC_PriorityLevel_2);
ITC_SetSoftwarePriority(EXTI3_IRQn, ITC_PriorityLevel_2);
ITC_SetSoftwarePriority(EXTI7_IRQn, ITC_PriorityLevel_2);
ITC_SetSoftwarePriority(EXTI1_IRQn, ITC_PriorityLevel_3); //加键的优先级
ITC_SetSoftwarePriority(EXTI5_IRQn, ITC_PriorityLevel_3); //减键的优先级
enableInterrupts();
} |