Files
teathermotimerng/src/eggTimer.c
Wolfgang Hottgenroth f22b300c01 works so far
2016-09-08 22:51:15 +02:00

52 lines
940 B
C

/*
* eggTimer.c
*
* Created on: 08.09.2016
* Author: dehottgw
*/
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include "eggTimer.h"
#include "displayMuxer.h"
#include "button.h"
const uint32_t EGG_TIMER_CYCLE = 1000;
const uint8_t COOKING_TIME = 120;
uint8_t restCookingTime;
bool timerRunning;
bool timerStarted;
void eggTimerStart(void *handleArg) {
if (! timerStarted) {
timerRunning = true;
timerStarted = true;
}
}
void eggTimerInit(void *handleArg) {
restCookingTime = COOKING_TIME;
timerRunning = false;
timerStarted = false;
buttonRegister(eggTimerStart, NULL, BUTTON_START_TIMER);
}
void eggTimerExec(void *handleArg) {
if (timerRunning) {
restCookingTime--;
displayMuxerSetValue(restCookingTime, true, TIMER_MUX);
if (restCookingTime == 0) {
// activate alarm
timerRunning = false;
}
}
}