我参照库函数里面是这么写的,但一直都进不了掉电模式
void IDLEMode(uint8_t u8Type)
{
// ExternInitGPIOWakeupFunction();
// InitGPIOWakeupFunction();
UNLOCKREG();
DrvSYS_SetPowerDownWakeUpInt(1, PWRWU_CallBackfn, 1);
// if(ExternInitGPIOWakeupFunction()==1)
if(InitGPIOWakeupFunction()==1)
{
if (u8Type == 0)
{
/* For IDLE Mode */
SYSCLK->PWRCON.PD_WAIT_CPU = 0;
SYSCLK->PWRCON.PWR_DOWN_EN = 0;
/* Wait for interrupt and enter in IDLE mode */
DrvSYS_Delay(1000);
__WFI();
}else
if (u8Type == 1)
{
/* For PowerDown Mode */
SCB->SCR = 4;
DrvSYS_EnterPowerDown(E_SYS_WAIT_FOR_CPU);
/* Wait for interrupt and enter in Power Down mode */
DrvSYS_Delay(1000);
__WFI();
}else
if (u8Type == 2)
{
/* For PowerDown Mode */
SCB->SCR = 4;
DrvSYS_EnterPowerDown(E_SYS_IMMEDIATE);
/* Wait for interrupt and enter in Power Down mode */
DrvSYS_Delay(1000);
}
}
LOCKREG();
// UnInitGPIOWakeupFunction();
// DrvGPIO_DisableEINT1();
} |