diff options
author | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-07-04 23:19:59 +0000 |
---|---|---|
committer | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-07-04 23:19:59 +0000 |
commit | 66f63ed1f30dc55cce19f2883d8ebe66dd7fb91e (patch) | |
tree | 0069f942928564b5216301ec2623b1f102d46fb5 /nuttx/configs/stm3210e-eval/src/up_idle.c | |
parent | cc30d1b9de0b83ef8a4ebe03aa209ebed9007672 (diff) | |
download | px4-firmware-66f63ed1f30dc55cce19f2883d8ebe66dd7fb91e.tar.gz px4-firmware-66f63ed1f30dc55cce19f2883d8ebe66dd7fb91e.tar.bz2 px4-firmware-66f63ed1f30dc55cce19f2883d8ebe66dd7fb91e.zip |
STM32 PM update
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4908 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/configs/stm3210e-eval/src/up_idle.c')
-rw-r--r-- | nuttx/configs/stm3210e-eval/src/up_idle.c | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/nuttx/configs/stm3210e-eval/src/up_idle.c b/nuttx/configs/stm3210e-eval/src/up_idle.c index 27784056b..456a92db8 100644 --- a/nuttx/configs/stm3210e-eval/src/up_idle.c +++ b/nuttx/configs/stm3210e-eval/src/up_idle.c @@ -53,11 +53,12 @@ #include "stm32_pm.h" #include "stm32_rcc.h" #include "up_internal.h" +#include "stm3210e-internal.h" /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ - +/* Configuration ************************************************************/ /* Does the board support an IDLE LED to indicate that the board is in the * IDLE state? */ @@ -70,6 +71,22 @@ # define END_IDLE() #endif +/* Values for the RTC Alarm to wake up from the PM_STANDBY mode */ + +#ifndef CONFIG_PM_ALARM_SEC +# define CONFIG_PM_ALARM_SEC 1 +#endif + +#ifndef CONFIG_PM_ALARM_NSEC +# define CONFIG_PM_ALARM_NSEC 0 +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static void up_alarmcb(void); + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -85,11 +102,12 @@ #ifdef CONFIG_PM static void up_idlepm(void) { + struct timespec alarmtime; static enum pm_state_e oldstate = PM_NORMAL; enum pm_state_e newstate; irqstate_t flags; int ret; - + /* Decide, which power saving level can be obtained */ newstate = pm_checkstate(); @@ -150,6 +168,18 @@ static void up_idlepm(void) up_pmbuttons(); + /* Configure the RTC alarm to Auto Wake the system */ + + alarmtime.tv_sec = CONFIG_PM_ALARM_SEC; + alarmtime.tv_nsec = CONFIG_PM_ALARM_NSEC; + + ret = up_rtc_setalarm(&alarmtime, &up_alarmcb); + if (ret < 0) + { + lldbg("The alarm is already set to %d seconds \n", + alarmtime.tv_sec); + } + /* Call the STM32 stop mode */ stm32_pmstop(true); @@ -173,6 +203,19 @@ static void up_idlepm(void) # define up_idlepm() #endif + +/************************************************************************************ + * Name: up_alarmcb + * + * Description: + * RTC alarm service routine + * + ************************************************************************************/ + +static void up_alarmcb(void) +{ +} + /**************************************************************************** * Public Functions ****************************************************************************/ |