AB1601低功耗之IIC和PWM控制注意事项

2019-07-14 01:40发布

DRV_Uart_Flush(uart1_ins);


DoorIicDeInit();
DRV_OdGpio_IeSet(1<<0, 0);//这个地方非常重要,否则非常耗电
DRV_OdGpio_IeSet(1<<1, 0);


DoorRfPowDisable();//id card 电源关闭
SleepDeal();


DRV_OdGpio_IeSet(1<<0, 1);//这个地方非常重要,否则IIC死机
DRV_OdGpio_IeSet(1<<1, 1);
DoorIicInit();


DoorPwmNormalMode();//打开PWM
retFlag = TouchKeyPressChk();//读iic用来起延时的作用
if(retFlag == 1)
{
SetPowModeChangeFlag(1);//启动模式切换
goto END_OK;
}
for(i=0; i<100; i++)
{
retFlag = DoorGetRfPwmChkIoStateTest();//检测ID卡是否有效
if(retFlag == 1)
{
break;
}
}
if(retFlag == 1)
{
SetPowModeChangeFlag(1);//启动模式切换
}
else
{
DoorPwmLpMode();//关闭PWM
}




/*
DoorTimerB1Enable();
DoorTimerDelayUnitMs(20);
//DoorTimerDelayUnitMs(10);
//DoorTimerDelayUnitMs(5);
retFlag = DoorIdReadDetect();
if(retFlag == 1)
{
SetPowModeChangeFlag(1);
}
*/


END_OK:
if(GetPowModeChangeFlag() == 1)
{
DoorRfPowEnable();//id card 电源开启
}