alarm added
This commit is contained in:
@ -12,9 +12,11 @@
|
||||
#include "eggTimer.h"
|
||||
#include "displayMuxer.h"
|
||||
#include "button.h"
|
||||
#include "gpio.h"
|
||||
|
||||
|
||||
const uint32_t EGG_TIMER_CYCLE = 1000;
|
||||
const uint32_t LED_CYCLE = 250;
|
||||
|
||||
const uint8_t COOKING_TIME = 120;
|
||||
uint8_t restCookingTime;
|
||||
@ -29,6 +31,10 @@ void eggTimerStart(void *handleArg) {
|
||||
}
|
||||
}
|
||||
|
||||
void eggTimerAlarm(void *handleArg) {
|
||||
gpioTogglePin(LED_1);
|
||||
}
|
||||
|
||||
void eggTimerInit(void *handleArg) {
|
||||
restCookingTime = COOKING_TIME;
|
||||
timerRunning = false;
|
||||
@ -42,6 +48,7 @@ void eggTimerExec(void *handleArg) {
|
||||
displayMuxerSetValue(restCookingTime, true, TIMER_MUX);
|
||||
if (restCookingTime == 0) {
|
||||
// activate alarm
|
||||
schAdd(eggTimerAlarm, NULL, 0, LED_CYCLE);
|
||||
timerRunning = false;
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
tPinCfg pin = pinCfg[p];
|
||||
uint16_t pinValue = 0;
|
||||
|
@ -50,12 +50,13 @@ typedef enum {
|
||||
DIGIT_0,
|
||||
DIGIT_1,
|
||||
BUTTON_1,
|
||||
TESTPIN1,
|
||||
LED_1,
|
||||
PINS_END
|
||||
} tPin;
|
||||
|
||||
void gpioInitPins();
|
||||
void gpioSetPin(tPin p, tPinState v);
|
||||
void gpioTogglePin(tPin p);
|
||||
tPinState gpioGetPin(tPin p);
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user