Set LED pins to output when MB851 is in sleep mode.
This reduces power consumption.
This commit is contained in:
parent
6655c876f2
commit
af8e58e063
3 changed files with 18 additions and 9 deletions
|
@ -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);
|
||||
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
|
@ -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 <<PA0_CFG_BIT)|
|
||||
(GPIOCFG_IN <<PA1_CFG_BIT)|
|
||||
(GPIOCFG_IN <<PA2_CFG_BIT)|
|
||||
|
@ -46,6 +48,8 @@ void halBoardPowerDown(void)
|
|||
(GPIOCFG_IN <<PC6_CFG_BIT)| /* OSC32K */
|
||||
(GPIOCFG_IN <<PC7_CFG_BIT); /* OSC32K */
|
||||
|
||||
leds_init();
|
||||
|
||||
}
|
||||
|
||||
/* Remember state of sensors (if active or not), in order to
|
||||
|
|
|
@ -143,12 +143,11 @@ typedef unsigned long long rtimer_clock_t;
|
|||
#define RTIMER_CLOCK_LT(a,b) ((signed short)((a)-(b)) < 0)
|
||||
|
||||
/* LEDs ports MB851 */
|
||||
#define LEDS_CONF_RED 0x20
|
||||
#define LEDS_CONF_GREEN 0x40
|
||||
#define LEDS_PORT GPIO_PBOUT
|
||||
// Open drain
|
||||
#define LED_CONFIG() GPIO_PBCFGH |= 0x0550; \
|
||||
GPIO_PBCFGH &= 0xf55f
|
||||
#define LEDS_CONF_RED_PIN 5
|
||||
#define LEDS_CONF_GREEN_PIN 6
|
||||
#define LEDS_CONF_PORT PORTB
|
||||
#define LEDS_CONF_RED (1<<LEDS_CONF_RED_PIN)
|
||||
#define LEDS_CONF_GREEN (1<<LEDS_CONF_GREEN_PIN)
|
||||
|
||||
|
||||
#define UIP_ARCH_ADD32 1
|
||||
|
|
Loading…
Reference in a new issue