本人想利用按键作为外部中断,通过中断服务程序打开定时器,使用定时器TIM1更新中断。再次发生外部中断时关闭定时器中断。按键触发的是EXTI线[15:10]中断,优先级低于TIM1更新中断,在设置优先级是使用库函数,在网上搜到了一段,如下:
// 选择使用优先级分组第1组
//NVIC_InitTypeDef NVIC_InitStructure;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
// 使能TIM1_UP_IRQChannel中断
NVIC_InitStructure.NVIC_IRQChannel = TIM1_UP_IRQChannel;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; // 指定抢占式优先级别1
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; // 指定响应优先级别0
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
// 使能EXTI15_10中断
NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQChannel;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; // 指定抢占式优先级别0
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; // 指定响应优先级别1
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
可是在调试的时候出现下面的错误:
Undefined symbol NVIC_Init(referred from main)
请教高手,那些库函数在哪里定义的??是不是忘记包涵了一个头文件???急求
NVIC_Init()一般在misc.c中定义,也可以自己写一个