/* * eggTimer.c * * Created on: 08.09.2016 * Author: dehottgw */ #include #include #include #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; } } }