项目中需要多个中断,画的时候没注意,都使用了Pin00,但一个是PortB,一个是PortD,先初始化了PortB的Pin00,再初始化的PortD Pin00结果初始化后只有PortB的响应,PortD的不响应。哪位大神帮我改改,谢谢!
void Key1_callback()
{
NVIC_ClearPendingIRQ(Int010_IRQn);
}
void Init_intruppt1()
{
stc_exint_config_t stcExtiConfig; /* 外部中断配置结构体 */
stc_irq_regi_conf_t stcIrqRegiConf; /*irq配置结构体 */
stc_port_init_t stcPortInit; /*管脚配置结构体 */
/* configuration structure initialization */
MEM_ZERO_STRUCT(stcExtiConfig);
MEM_ZERO_STRUCT(stcIrqRegiConf);
MEM_ZERO_STRUCT(stcPortInit);
/* Set PD06 as External Int Ch.6 input */
stcPortInit.enExInt = Enable;
stcPortInit.enPinMode = Pin_Mode_In;
stcPortInit.enInvert=Enable;
PORT_Init(PortB, Pin00, &stcPortInit);
stcExtiConfig.enExitCh = ExtiCh00;
stcExtiConfig.enFilterEn = Enable;
stcExtiConfig.enFltClk = Pclk3Div8;
stcExtiConfig.enExtiLvl = ExIntRisingEdge;
EXINT_Init(&stcExtiConfig);
stcIrqRegiConf.enIntSrc = INT_PORT_EIRQ0;
stcIrqRegiConf.enIRQn = Int010_IRQn;
stcIrqRegiConf.pfnCallback = &Key1_callback;
enIrqRegistration(&stcIrqRegiConf);
/* Clear Pending */
NVIC_ClearPendingIRQ(stcIrqRegiConf.enIRQn);
/* 配置优先级 */
NVIC_SetPriority(stcIrqRegiConf.enIRQn, DDL_IRQ_PRIORITY_15);
/* 使能 NVIC */
NVIC_EnableIRQ(stcIrqRegiConf.enIRQn);
}
void Fan_speedcount()
{
Fan_Speed[0]++;
NVIC_ClearPendingIRQ(Int020_IRQn);
}
void Init_FanSpeed1()
{
stc_exint_config_t stcExtiConfig; /* 外部中断配置结构体 */
stc_irq_regi_conf_t stcIrqRegiConf; /*irq配置结构体 */
stc_port_init_t stcPortInit; /*管脚配置结构体 */
/* configuration structure initialization */
MEM_ZERO_STRUCT(stcExtiConfig);
MEM_ZERO_STRUCT(stcIrqRegiConf);
MEM_ZERO_STRUCT(stcPortInit);
stcPortInit.enExInt = Enable;
stcPortInit.enPinMode = Pin_Mode_In;
stcPortInit.enInvert=Enable;
PORT_Init(PortD, Pin00, &stcPortInit);
stcExtiConfig.enExitCh = ExtiCh00;
stcExtiConfig.enFilterEn = Enable;
stcExtiConfig.enFltClk = Pclk3Div8;
stcExtiConfig.enExtiLvl = ExIntRisingEdge;
EXINT_Init(&stcExtiConfig);
stcIrqRegiConf.enIntSrc = INT_PORT_EIRQ0;
stcIrqRegiConf.enIRQn = Int020_IRQn;
stcIrqRegiConf.pfnCallback = &Fan_speedcount;
enIrqRegistration(&stcIrqRegiConf);
/* Clear Pending */
NVIC_ClearPendingIRQ(stcIrqRegiConf.enIRQn);
/* 配置优先级 */
NVIC_SetPriority(stcIrqRegiConf.enIRQn, DDL_IRQ_PRIORITY_15);
/* 使能 NVIC */
NVIC_EnableIRQ(stcIrqRegiConf.enIRQn);
} |