根据上图所示只有如上三个IO可以做Standby唤醒脚。
代码如下
#include "main.h"
#include "Standby.h"
#include "n32l40x_pwr.h"
void Wakeup_Pin_Config(void)
{
GPIO_InitType GPIO_InitStructure;
GPIO_InitStruct(&GPIO_InitStructure);
RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_GPIOA, ENABLE);
GPIO_InitStructure.Pin = GPIO_PIN_0;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Input;
GPIO_InitStructure.GPIO_Pull = GPIO_Pull_Down;
GPIO_InitPeripheral(GPIOA, &GPIO_InitStructure);
}
void Wakeup_Config(void)
{
RCC_EnableAPB1PeriphClk(RCC_APB1_PERIPH_PWR, ENABLE);
PWR_WakeUpPinEnable(WAKEUP_PIN1,ENABLE);
if(PWR_GetFlagStatus(1,PWR_STBY_FLAG) != RESET)
{
PWR_ClearFlag(PWR_STBY_FLAG);
}
if(PWR_GetFlagStatus(1,PWR_WKUP1_FLAG) != RESET)
{
PWR_ClearFlag(PWR_WKUP1_FLAG);
}
printf("PWR_EnterSTANDBYMode \r\n");
PWR_EnterSTANDBYMode(PWR_STOPENTRY_WFI,PWR_CTRL3_RAM2RET);
}
————————————————
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/dailin2012/article/details/129495571
|