#include <stdint.h> #include <stdbool.h> #include "utils/ustdlib.h" #include "inc/hw_types.h" #include "inc/hw_memmap.h" #include "driverlib/sysctl.h" #include "driverlib/pin_map.h" #include "driverlib/debug.h" #include "driverlib/hibernate.h" #include "driverlib/gpio.h" int main(void) { SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3); GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0x08);//1000//使能低功耗模式 SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE); //Enables the Hibernation module for operation HibernateEnableExpClk(SysCtlClockGet()); //Enables GPIO retention(保留) after wake from hibernation. HibernateGPIORetentionEnable(); SysCtlDelay(64000000); //低功耗模式下唤醒引脚配置 //HibernateWakeSet(HIBERNATE_WAKE_PIN); HibernateRTCSet(0); HibernateRTCEnable(); HibernateRTCMatchSet(0,5);//RTC唤醒时间5s HibernateWakeSet(HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_RTC); GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_3, 0x01); HibernateRequest(); while(1) { } }
Maka Luo:
thanks for sharing