alarm added

This commit is contained in:
Wolfgang Hottgenroth
2016-09-08 23:03:10 +02:00
parent f22b300c01
commit 20dd4d587b
3 changed files with 18 additions and 1 deletions

View File

@ -12,9 +12,11 @@
#include "eggTimer.h" #include "eggTimer.h"
#include "displayMuxer.h" #include "displayMuxer.h"
#include "button.h" #include "button.h"
#include "gpio.h"
const uint32_t EGG_TIMER_CYCLE = 1000; const uint32_t EGG_TIMER_CYCLE = 1000;
const uint32_t LED_CYCLE = 250;
const uint8_t COOKING_TIME = 120; const uint8_t COOKING_TIME = 120;
uint8_t restCookingTime; uint8_t restCookingTime;
@ -29,6 +31,10 @@ void eggTimerStart(void *handleArg) {
} }
} }
void eggTimerAlarm(void *handleArg) {
gpioTogglePin(LED_1);
}
void eggTimerInit(void *handleArg) { void eggTimerInit(void *handleArg) {
restCookingTime = COOKING_TIME; restCookingTime = COOKING_TIME;
timerRunning = false; timerRunning = false;
@ -42,6 +48,7 @@ void eggTimerExec(void *handleArg) {
displayMuxerSetValue(restCookingTime, true, TIMER_MUX); displayMuxerSetValue(restCookingTime, true, TIMER_MUX);
if (restCookingTime == 0) { if (restCookingTime == 0) {
// activate alarm // activate alarm
schAdd(eggTimerAlarm, NULL, 0, LED_CYCLE);
timerRunning = false; timerRunning = false;
} }
} }

View File

@ -77,6 +77,15 @@ void gpioSetPin(tPin p, tPinState v) {
} }
} }
void gpioTogglePin(tPin p) {
tPinCfg pin = pinCfg[p];
if (pin.portId == PORT1) {
P1OUT ^= pin.bit;
} else if (pin.portId == PORT2) {
P2OUT ^= pin.bit;
}
}
tPinState gpioGetPin(tPin p) { tPinState gpioGetPin(tPin p) {
tPinCfg pin = pinCfg[p]; tPinCfg pin = pinCfg[p];
uint16_t pinValue = 0; uint16_t pinValue = 0;

View File

@ -50,12 +50,13 @@ typedef enum {
DIGIT_0, DIGIT_0,
DIGIT_1, DIGIT_1,
BUTTON_1, BUTTON_1,
TESTPIN1, LED_1,
PINS_END PINS_END
} tPin; } tPin;
void gpioInitPins(); void gpioInitPins();
void gpioSetPin(tPin p, tPinState v); void gpioSetPin(tPin p, tPinState v);
void gpioTogglePin(tPin p);
tPinState gpioGetPin(tPin p); tPinState gpioGetPin(tPin p);