void PortH_Init()
{
stc_exint_config_t stcExtiConfig;
stc_irq_regi_conf_t stcIrqRegiConf;
stc_port_init_t stcPortInit;
/* configuration structure initialization */
MEM_ZERO_STRUCT(stcExtiConfig);
MEM_ZERO_STRUCT(stcIrqRegiConf);
MEM_ZERO_STRUCT(stcPortInit);
/**************************************************************************/
/* External Int Ch.2 */
/**************************************************************************/
stcExtiConfig.enExitCh = ExtiCh02;
/* Filter setting */
stcExtiConfig.enFilterEn = Enable;
stcExtiConfig.enFltClk = Pclk3Div64;
stcExtiConfig.enExtiLvl = ExIntBothEdge;
EXINT_Init(&stcExtiConfig);
/* Set External Int */
MEM_ZERO_STRUCT(stcPortInit);
stcPortInit.enPullUp = Enable;
stcPortInit.enExInt = Enable;
PORT_Init(PortH,Pin02, &stcPortInit);
/* Select External Int Ch.2 */
stcIrqRegiConf.enIntSrc = INT_PORT_EIRQ2;
/* Register External Int to Vect.No.000 */
stcIrqRegiConf.enIRQn = Int015_IRQn;
/* Callback function */
stcIrqRegiConf.pfnCallback = &PORTH_PIN2_Callback;
/* Registration IRQ */
enIrqRegistration(&stcIrqRegiConf);
/* Clear pending */
NVIC_ClearPendingIRQ(stcIrqRegiConf.enIRQn);
/* Set priority */
NVIC_SetPriority(stcIrqRegiConf.enIRQn, DDL_IRQ_PRIORITY_DEFAULT);
/* Enable NVIC */
NVIC_EnableIRQ(stcIrqRegiConf.enIRQn);
}
void PORTH_PIN2_Callback()
{
if (Set == EXINT_Irq**Get(ExtiCh02))
{
EXINT_Irq**Clr(ExtiCh02);
}
}
中断号没有被其他中断用到,这样配置后,会一直进放回调函数,不知会什么?
搜索
复制
|