TI中文支持网
TI专业的中文技术问题搜集分享网站

TM4C123x 程序小练 休眠模式的设置

#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

赞(0)
未经允许不得转载:TI中文支持网 » TM4C123x 程序小练 休眠模式的设置
分享到: 更多 (0)