diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-03-14 14:14:54 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-03-14 14:14:54 +0000 |
commit | ee2220174467b0e456446f5faaef1bd1660f786e (patch) | |
tree | 61937f54d7558e15f984b0450c2958e9ed45b5bd /nuttx/configs/vsn/src/power.c | |
parent | 38121cceb67b2408c5aab1d3e9998accef0d83c8 (diff) | |
download | px4-nuttx-ee2220174467b0e456446f5faaef1bd1660f786e.tar.gz px4-nuttx-ee2220174467b0e456446f5faaef1bd1660f786e.tar.bz2 px4-nuttx-ee2220174467b0e456446f5faaef1bd1660f786e.zip |
VSN/apps update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3378 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs/vsn/src/power.c')
-rw-r--r-- | nuttx/configs/vsn/src/power.c | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/nuttx/configs/vsn/src/power.c b/nuttx/configs/vsn/src/power.c index 2e23ed033..c7c73448a 100644 --- a/nuttx/configs/vsn/src/power.c +++ b/nuttx/configs/vsn/src/power.c @@ -1,6 +1,6 @@ /**************************************************************************** - * config/vsn/src/ramtron.c - * arch/arm/src/board/ramtron.c + * config/vsn/src/power.c + * arch/arm/src/board/power.c * * Copyright (C) 2011 Uros Platise. All rights reserved. * @@ -37,21 +37,57 @@ #include <nuttx/config.h> +#include <arch/board/board.h> +#include <arch/stm32/irq.h> + #include <stdint.h> #include <stdbool.h> #include <debug.h> -#include <arch/board/board.h> +#include "stm32_gpio.h" #include "vsn.h" +#include "up_arch.h" + void board_power_register(void); void board_power_adjust(void); void board_power_status(void); -void board_power_setbootvoltage(void) + + +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); +} + + +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. } -void board_power_reboot(void); -void board_power_off(void); + +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 + + // \todo + + // stop backgorund processes + irqsave(); + + // switch to internal HSI and get the PD0 and PD1 as GPIO + stm32_board_select_hsi(); + + // trigger shutdown with pull-up resistor (not push-pull!) and wait. + stm32_gpiowrite(GPIO_PCLR, true); + for(;;); +} |