From f22b300c018f1ca4f4e6720c83c02e07284dbbbe Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Thu, 8 Sep 2016 22:51:15 +0200 Subject: [PATCH] works so far --- src/PontCoopScheduler.h | 2 +- src/eggTimer.c | 14 ++++++++------ src/gpio.c | 2 ++ src/gpio.h | 1 + src/gpioCfg.c | 4 +++- src/main.c | 8 +++++--- 6 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/PontCoopScheduler.h b/src/PontCoopScheduler.h index e3369b9..6dbef16 100644 --- a/src/PontCoopScheduler.h +++ b/src/PontCoopScheduler.h @@ -13,7 +13,7 @@ -#define MAX_NUM_OF_TASKS 6 +#define MAX_NUM_OF_TASKS 8 typedef struct { diff --git a/src/eggTimer.c b/src/eggTimer.c index 31c7ffb..ffb503b 100644 --- a/src/eggTimer.c +++ b/src/eggTimer.c @@ -21,6 +21,14 @@ 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; @@ -39,11 +47,5 @@ void eggTimerExec(void *handleArg) { } } -void eggTimerStart(void *handleArg) { - if (! timerStarted) { - timerRunning = true; - timerStarted = true; - } -} diff --git a/src/gpio.c b/src/gpio.c index 8f61dbb..46d5812 100644 --- a/src/gpio.c +++ b/src/gpio.c @@ -36,6 +36,7 @@ void gpioInitPins() { P1SEL &= ~pin.bit; P1SEL2 &= ~pin.bit; P1REN |= pin.bit; + P1OUT |= pin.bit; } } else if (pin.portId == PORT2) { if (pin.direction == PIN_OUT) { @@ -52,6 +53,7 @@ void gpioInitPins() { P2SEL &= ~pin.bit; P2SEL2 &= ~pin.bit; P2REN |= pin.bit; + P2OUT |= pin.bit; } } gpioSetPin(p, pin.defaultOut); diff --git a/src/gpio.h b/src/gpio.h index 6aa1f3e..4bef9ea 100644 --- a/src/gpio.h +++ b/src/gpio.h @@ -50,6 +50,7 @@ typedef enum { DIGIT_0, DIGIT_1, BUTTON_1, + TESTPIN1, PINS_END } tPin; diff --git a/src/gpioCfg.c b/src/gpioCfg.c index adb86a0..31797e3 100644 --- a/src/gpioCfg.c +++ b/src/gpioCfg.c @@ -5,6 +5,7 @@ * Author: wn */ +#include #include "gpio.h" tPinCfg pinCfg[PINS_END] = { @@ -17,5 +18,6 @@ tPinCfg pinCfg[PINS_END] = { {PORT2, BIT2, PIN_OUT, LOW}, //G {PORT2, BIT0, PIN_OUT, HIGH}, //0 {PORT1, BIT5, PIN_OUT, HIGH}, //1 - {PORT1, BIT1, PIN_IN, LOW}, // BUTTON_1 + {PORT1, BIT0, PIN_IN_PULLUP, LOW}, // BUTTON_1 + {PORT1, BIT1, PIN_OUT, LOW}, //TESTPIN1 }; diff --git a/src/main.c b/src/main.c index 23af023..d953f43 100644 --- a/src/main.c +++ b/src/main.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "gpio.h" #include "time.h" @@ -42,15 +43,16 @@ int main() { measureInit(NULL); displayMuxerInit(NULL); - eggTimerInit(NULL); buttonInit(NULL); + eggTimerInit(NULL); - // schAdd(displayExec, NULL, 0, DISPLAY_CYCLE); + schAdd(displayExec, NULL, 0, DISPLAY_CYCLE); schAdd(measureStartConversion, NULL, 0, MEASURE_CYCLE); schAdd(displayMuxerExec, NULL, 0, DISPLAY_MUXER_CYCLE); schAdd(eggTimerExec, NULL, 0, EGG_TIMER_CYCLE); schAdd(buttonExec, NULL, 0, BUTTON_CYCLE); + __enable_interrupt(); while (1) { @@ -59,7 +61,7 @@ int main() { // put it into the idle loop, it is not time critical // but should get as much time as possible to avoid // flicker - displayExec(NULL); + //displayExec(NULL); } }