diff options
author | David Barksdale <amatus@amatus.name> | 2015-10-03 11:28:41 -0500 |
---|---|---|
committer | David Barksdale <amatus@amatus.name> | 2015-10-03 11:28:41 -0500 |
commit | 9705acb3f0f8fac57e2aba2df3c05321fac1a268 (patch) | |
tree | 78b3f6d6c91fe78488d458f72631a6f6e5541adc /laser-tag software | |
parent | 3b09a7e53170964dd8914d8baa3c9491c6313f50 (diff) |
Power usage now < 1mA
It doesn't even register on my meter anymore!
Diffstat (limited to 'laser-tag software')
-rwxr-xr-x | laser-tag software/main.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/laser-tag software/main.c b/laser-tag software/main.c index 3cfcf45..1914feb 100755 --- a/laser-tag software/main.c +++ b/laser-tag software/main.c @@ -91,6 +91,12 @@ static const clock_manager_user_config_t g_defaultClockConfigRun = { } }; +/* Idle the CPU in Very Low Power Wait (VLPW) */ +/* This should be the lowest power mode where the PIT still functions. */ +static const smc_power_mode_config_t g_idlePowerMode = { + .powerModeName = kPowerModeVlpw, +}; + // LCD backlight GPIO pin static const gpio_output_pin_user_config_t g_lcdBacklight = { .pinName = GPIO_MAKE_PIN(GPIOE_IDX, 31U), @@ -135,7 +141,7 @@ int main (void) SMC_HAL_SetProtection(SMC, kAllowPowerModeAll); /* Set system clock configuration. */ - CLOCK_SYS_SetConfiguration(&g_defaultClockConfigRun); + CLOCK_SYS_SetConfiguration(&g_defaultClockConfigVlpr); /* Initialize LPTMR */ lptmr_state_t lptmrState; @@ -154,8 +160,10 @@ int main (void) /* Start LPTMR */ LPTMR_DRV_Start(LPTMR0_IDX); - // TODO: low power mode? - for(;;); + /* We're done, everything else is triggered through interrupts */ + for(;;) { + SMC_HAL_SetMode(SMC, &g_idlePowerMode); + } } /* vim: set expandtab ts=4 sw=4: */ |