This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Use GPIO for key ,I want to use interrput but isn't work

//key port init 

void zclLightControlTouchPanelEnable(void)
{

P0SEL &= ~BV(4); //普通I/O口
P0DIR &= ~BV(4); //输入
//P0INP &= ~BV(4);
P0IEN |= BV(4); //使能中断

P0SEL &= ~BV(5);
P0DIR &= ~BV(5);
//P0INP &= ~BV(5);
P0IEN |= BV(5);

P0SEL &= ~BV(6);
//P0DIR &= ~BV(6);
P0INP &= ~BV(6);
P0IEN |= BV(6);

P0SEL &= ~BV(7);
P0DIR &= ~BV(7);
//P0INP &= ~BV(7);
P0IEN |= BV(7);

PICTL |= (0x1 << 0);
IEN1 |= (0x1 << 5);

P0IF = 0;
P0IFG = 0;
EA = 1;

LIGHT_TURN_OFF_LIGHT0();
LIGHT_TURN_OFF_LIGHT1();
LIGHT_TURN_OFF_LIGHT2();
LIGHT_TURN_OFF_LIGHT3();
}

//interrput 


HAL_ISR_FUNCTION(zclLightControlPort0Isr, P0INT_VECTOR)
{
HAL_ENTER_ISR();
osal_start_timerEx(zclOnOffLight_TaskID,
ZCL_DEVICE_EXIT_NETWORK_EVENT,
3000);
zcl_interruptNo = 0;
if (P0IFG & 0x4) {
P0IEN &= ~BV(4);
zcl_interruptNo |= 1;
//zcl_interruptCont ++;
}
if (P0IFG & 0x5) {
P0IEN &= ~BV(5);
P0_5 = ~P0_5;
zcl_interruptNo |= 2;
// zcl_interruptCont ++;
}
if (P0IFG & 0x7) {
P0IEN &= ~BV(7);
zcl_interruptNo |= 3;
// zcl_interruptCont ++;
}if (P0IFG & 0x6) {
P0IEN &= ~BV(6);
zcl_interruptNo |= 4;
//zcl_interruptCont ++;
}
if( zcl_interruptNo ) {
zcl_factoryReset = 0;
osal_start_timerEx(zclOnOffLight_TaskID,
ZCL_DEVICE_TOUCHPANEL_EVENT,
20);
}

P0IFG = 0;
P0IF = 0;
//zcl_interruptCont ++;
//osal_start_timerEx(zclOnOffLight_TaskID,
// ZCL_DEVICE_EXIT_NETWORK_EVENT,
// 3000);
CLEAR_SLEEP_MODE();
HAL_EXIT_ISR();
}

this code can't goto HAL_ISR_FUNCTION.