power down after two minutes
This commit is contained in:
@ -9,14 +9,18 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <msp430g2553.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user