原子的待机唤醒例程里面哪里表示退出待机模式啊,中断处理EXTI0_IRQnHandler那里吗?那不是显示进入待机模式吗?
void Sys_Enter_Standby(void)
{
RCC_AHB1PeriphResetCmd(0X01FF,ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
PWR_ClearFlag(PWR_FLAG_WU);
PWR_WakeUpPinCmd(ENABLE);
PWR_EnterSTANDBYMode();//???????ú????
}
u8 Check_WKUP(void)
{
u8 t=0;
u8 tx=0;
LED0=0;
while(1)
{
if(WKUP_KD)
{
t++;
tx=0;
}else
{
tx++;
if(tx>3)
{
LED0=1;
return 0;
}
}
delay_ms(30);
if(t>=100)
{
LED0=0;
return 1;
}
}
}
void EXTI0_IRQHandler(void)
{
EXTI_ClearITPendingBit(EXTI_Line0);
if(Check_WKUP())
{
Sys_Enter_Standby();
}
}
void WKUP_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
EXTI_InitTypeDef EXTI_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
GPIO_Init(GPIOA, &GPIO_InitStructure);
if(Check_WKUP()==0)
{
Sys_Enter_Standby();
}
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource0);
EXTI_InitStructure.EXTI_Line = EXTI_Line0;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x02;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x02;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
---------------------------------
明白了,十分感谢。。。
但是为什么我用原子哥的例程的时候,KEY_UP 按键好多秒后,LCD还是没有显示,DS0灯也没有闪烁啊?你有用原子哥的例程试过吗
一周热门 更多>