From e60b3b73eb82212e22930f0ee8f9e61193b1f97d Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Thu, 8 Sep 2016 23:28:32 +0200 Subject: [PATCH] power down after two minutes --- src/eggTimer.c | 13 +++++++++++++ src/time.c | 4 ---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/eggTimer.c b/src/eggTimer.c index d476500..93cc8c2 100644 --- a/src/eggTimer.c +++ b/src/eggTimer.c @@ -9,14 +9,18 @@ #include #include +#include + #include "eggTimer.h" #include "displayMuxer.h" #include "button.h" #include "gpio.h" +#include "PontCoopScheduler.h" const uint32_t EGG_TIMER_CYCLE = 1000; const uint32_t LED_CYCLE = 250; +const uint32_t POWER_DOWN_DELAY = 120000; const uint8_t COOKING_TIME = 120; uint8_t restCookingTime; @@ -24,6 +28,14 @@ bool timerRunning; bool timerStarted; +void eggTimerPowerDown(void *handleArg) { + P1DIR = 0; + P2DIR = 0; + P1OUT = 0; + P2OUT = 0; + LPM4; +} + void eggTimerStart(void *handleArg) { if (! timerStarted) { timerRunning = true; @@ -49,6 +61,7 @@ void eggTimerExec(void *handleArg) { if (restCookingTime == 0) { // activate alarm schAdd(eggTimerAlarm, NULL, 0, LED_CYCLE); + schAdd(eggTimerPowerDown, NULL, POWER_DOWN_DELAY, 0); timerRunning = false; } } diff --git a/src/time.c b/src/time.c index d15ad5a..a7fd15f 100644 --- a/src/time.c +++ b/src/time.c @@ -18,15 +18,11 @@ volatile uint32_t timestamp; ISR(TIMER0_A0, TA0_ISR) { timestamp++; schUpdate(); - - // P1OUT ^= BIT0; } void timeInit() { timestamp = 0; - // P1DIR |= BIT0; - TACCR0 = 32; TACCTL0 = CCIE; TACTL = MC_1 | ID_0 | TASSEL_1 | TACLR;