From af8e58e0635d98662e49c544319e81336f12c099 Mon Sep 17 00:00:00 2001 From: Salvatore Pitrulli Date: Wed, 13 Apr 2011 18:14:12 +0200 Subject: [PATCH] Set LED pins to output when MB851 is in sleep mode. This reduces power consumption. --- cpu/stm32w108/leds-arch.c | 10 ++++++++-- platform/mb851/board-mb851.c | 6 +++++- platform/mb851/contiki-conf.h | 11 +++++------ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/cpu/stm32w108/leds-arch.c b/cpu/stm32w108/leds-arch.c index b3e65220d..5ef2ce481 100644 --- a/cpu/stm32w108/leds-arch.c +++ b/cpu/stm32w108/leds-arch.c @@ -40,15 +40,21 @@ */ /*---------------------------------------------------------------------------*/ +#include PLATFORM_HEADER +#include BOARD_HEADER #include "contiki-conf.h" #include "dev/leds.h" +#include "hal/micro/micro-common.h" +#include "hal/micro/cortexm3/micro-common.h" +#define LEDS_PORT *((volatile int32u *)(GPIO_PxOUT_BASE+(GPIO_Px_OFFSET*(LEDS_CONF_PORT/8)))) /*---------------------------------------------------------------------------*/ void leds_arch_init(void) { - LED_CONFIG(); + halGpioConfig(PORTx_PIN(LEDS_CONF_PORT,LEDS_CONF_RED_PIN),GPIOCFG_OUT); + halGpioConfig(PORTx_PIN(LEDS_CONF_PORT,LEDS_CONF_GREEN_PIN),GPIOCFG_OUT); LEDS_PORT |= (LEDS_CONF_RED | LEDS_CONF_GREEN); } @@ -69,4 +75,4 @@ leds_arch_set(unsigned char leds) | ((leds & LEDS_GREEN) ? 0 : LEDS_CONF_GREEN); } -/*---------------------------------------------------------------------------*/ \ No newline at end of file +/*---------------------------------------------------------------------------*/ diff --git a/platform/mb851/board-mb851.c b/platform/mb851/board-mb851.c index e801b4c2e..4a8529869 100644 --- a/platform/mb851/board-mb851.c +++ b/platform/mb851/board-mb851.c @@ -1,5 +1,7 @@ #include PLATFORM_HEADER #include BOARD_HEADER +#include "hal/micro/micro-common.h" +#include "hal/micro/cortexm3/micro-common.h" #include "dev/button-sensor.h" #include "dev/temperature-sensor.h" @@ -20,7 +22,7 @@ static uint8_t sensors_status; void halBoardPowerDown(void) { - /* Set everything to input value */ + /* Set everything to input value except LEDs */ GPIO_PACFGL = (GPIOCFG_IN <