


根据上图所示只有如上三个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_
配置GPIO唤醒功能:PWR_STANDBYMode

该代码段展示了如何配置GPIOA的PIN0作为唤醒源进入STANDBY模式。首先初始化GPIO结构体,设置为输入模式并下拉拉低。然后启用PWRWakeUpPin1功能,并检查待机和唤醒标志。最后进入STANDBY模式,使用WFI指令并保留RAM2区域。
最低0.47元/天 解锁文章
641

被折叠的 条评论
为什么被折叠?



