summaryrefslogtreecommitdiff
path: root/nuttx/configs/vsn/src/power.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-26 01:04:10 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-26 01:04:10 +0000
commit54150a8f62d57bd3af5efce1439ba3c29e20f07f (patch)
tree4c791787398c9f76ccd9c8a56e1dd139c2a4e8e4 /nuttx/configs/vsn/src/power.c
parentc62abcf9c8c26757ac5e6fbf0fd9813f1ba087a6 (diff)
downloadpx4-nuttx-54150a8f62d57bd3af5efce1439ba3c29e20f07f.tar.gz
px4-nuttx-54150a8f62d57bd3af5efce1439ba3c29e20f07f.tar.bz2
px4-nuttx-54150a8f62d57bd3af5efce1439ba3c29e20f07f.zip
Incorporate changes from Uros Platise
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3419 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs/vsn/src/power.c')
-rw-r--r--nuttx/configs/vsn/src/power.c59
1 files changed, 37 insertions, 22 deletions
diff --git a/nuttx/configs/vsn/src/power.c b/nuttx/configs/vsn/src/power.c
index 2e5ed1d13..9cbcfaac8 100644
--- a/nuttx/configs/vsn/src/power.c
+++ b/nuttx/configs/vsn/src/power.c
@@ -35,6 +35,11 @@
*
****************************************************************************/
+/** \file
+ * \author Uros Platise
+ * \brief VSN Power
+ */
+
#include <nuttx/config.h>
#include <arch/board/board.h>
@@ -44,50 +49,60 @@
#include <stdbool.h>
#include <debug.h>
-#include "stm32_gpio.h"
#include "vsn.h"
-#include "up_arch.h"
+/****************************************************************************
+ * Declarations and Structures
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
void board_power_register(void);
void board_power_adjust(void);
void board_power_status(void);
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
void board_power_init(void)
{
- stm32_configgpio(GPIO_PVS);
- stm32_configgpio(GPIO_PST);
- stm32_configgpio(GPIO_XPWR);
- stm32_configgpio(GPIO_SCTC);
- stm32_configgpio(GPIO_PCLR);
+ stm32_configgpio(GPIO_PVS);
+ stm32_configgpio(GPIO_PST);
+ stm32_configgpio(GPIO_XPWR);
+ stm32_configgpio(GPIO_SCTC);
+ stm32_configgpio(GPIO_PCLR);
}
void board_power_reboot(void)
{
- // low-level board reset (not just MCU reset)
- // if external power is present, stimulate power-off as board
- // will wake-up immediatelly, if power is not present, set an alarm
- // before power off the board.
+ // low-level board reset (not just MCU reset)
+ // if external power is present, stimulate power-off as board
+ // will wake-up immediatelly, if power is not present, set an alarm
+ // before power off the board.
}
void board_power_off(void)
{
- // Check if external supply is not present, otherwise return
- // notifying that it is not possible to power-off the board
+ // Check if external supply is not present, otherwise return
+ // notifying that it is not possible to power-off the board
- // \todo
-
- // stop background processes
- irqsave();
+ // \todo
+
+ // stop background processes
+ irqsave();
- // switch to internal HSI and get the PD0 and PD1 as GPIO
- sysclock_select_hsi();
+ // switch to internal HSI and get the PD0 and PD1 as GPIO
+ sysclock_select_hsi();
- // trigger shutdown with pull-up resistor (not push-pull!) and wait.
- stm32_gpiowrite(GPIO_PCLR, true);
- for(;;);
+ // trigger shutdown with pull-up resistor (not push-pull!) and wait.
+ stm32_gpiowrite(GPIO_PCLR, true);
+ for(;;);
}