works so far
This commit is contained in:
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define MAX_NUM_OF_TASKS 6
|
#define MAX_NUM_OF_TASKS 8
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -21,6 +21,14 @@ uint8_t restCookingTime;
|
|||||||
bool timerRunning;
|
bool timerRunning;
|
||||||
bool timerStarted;
|
bool timerStarted;
|
||||||
|
|
||||||
|
|
||||||
|
void eggTimerStart(void *handleArg) {
|
||||||
|
if (! timerStarted) {
|
||||||
|
timerRunning = true;
|
||||||
|
timerStarted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void eggTimerInit(void *handleArg) {
|
void eggTimerInit(void *handleArg) {
|
||||||
restCookingTime = COOKING_TIME;
|
restCookingTime = COOKING_TIME;
|
||||||
timerRunning = false;
|
timerRunning = false;
|
||||||
@ -39,11 +47,5 @@ void eggTimerExec(void *handleArg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void eggTimerStart(void *handleArg) {
|
|
||||||
if (! timerStarted) {
|
|
||||||
timerRunning = true;
|
|
||||||
timerStarted = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ void gpioInitPins() {
|
|||||||
P1SEL &= ~pin.bit;
|
P1SEL &= ~pin.bit;
|
||||||
P1SEL2 &= ~pin.bit;
|
P1SEL2 &= ~pin.bit;
|
||||||
P1REN |= pin.bit;
|
P1REN |= pin.bit;
|
||||||
|
P1OUT |= pin.bit;
|
||||||
}
|
}
|
||||||
} else if (pin.portId == PORT2) {
|
} else if (pin.portId == PORT2) {
|
||||||
if (pin.direction == PIN_OUT) {
|
if (pin.direction == PIN_OUT) {
|
||||||
@ -52,6 +53,7 @@ void gpioInitPins() {
|
|||||||
P2SEL &= ~pin.bit;
|
P2SEL &= ~pin.bit;
|
||||||
P2SEL2 &= ~pin.bit;
|
P2SEL2 &= ~pin.bit;
|
||||||
P2REN |= pin.bit;
|
P2REN |= pin.bit;
|
||||||
|
P2OUT |= pin.bit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gpioSetPin(p, pin.defaultOut);
|
gpioSetPin(p, pin.defaultOut);
|
||||||
|
@ -50,6 +50,7 @@ typedef enum {
|
|||||||
DIGIT_0,
|
DIGIT_0,
|
||||||
DIGIT_1,
|
DIGIT_1,
|
||||||
BUTTON_1,
|
BUTTON_1,
|
||||||
|
TESTPIN1,
|
||||||
PINS_END
|
PINS_END
|
||||||
} tPin;
|
} tPin;
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
* Author: wn
|
* Author: wn
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <msp430g2553.h>
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
|
|
||||||
tPinCfg pinCfg[PINS_END] = {
|
tPinCfg pinCfg[PINS_END] = {
|
||||||
@ -17,5 +18,6 @@ tPinCfg pinCfg[PINS_END] = {
|
|||||||
{PORT2, BIT2, PIN_OUT, LOW}, //G
|
{PORT2, BIT2, PIN_OUT, LOW}, //G
|
||||||
{PORT2, BIT0, PIN_OUT, HIGH}, //0
|
{PORT2, BIT0, PIN_OUT, HIGH}, //0
|
||||||
{PORT1, BIT5, PIN_OUT, HIGH}, //1
|
{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
|
||||||
};
|
};
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <intrinsics.h>
|
#include <intrinsics.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
@ -42,15 +43,16 @@ int main() {
|
|||||||
|
|
||||||
measureInit(NULL);
|
measureInit(NULL);
|
||||||
displayMuxerInit(NULL);
|
displayMuxerInit(NULL);
|
||||||
eggTimerInit(NULL);
|
|
||||||
buttonInit(NULL);
|
buttonInit(NULL);
|
||||||
|
eggTimerInit(NULL);
|
||||||
|
|
||||||
// schAdd(displayExec, NULL, 0, DISPLAY_CYCLE);
|
schAdd(displayExec, NULL, 0, DISPLAY_CYCLE);
|
||||||
schAdd(measureStartConversion, NULL, 0, MEASURE_CYCLE);
|
schAdd(measureStartConversion, NULL, 0, MEASURE_CYCLE);
|
||||||
schAdd(displayMuxerExec, NULL, 0, DISPLAY_MUXER_CYCLE);
|
schAdd(displayMuxerExec, NULL, 0, DISPLAY_MUXER_CYCLE);
|
||||||
schAdd(eggTimerExec, NULL, 0, EGG_TIMER_CYCLE);
|
schAdd(eggTimerExec, NULL, 0, EGG_TIMER_CYCLE);
|
||||||
schAdd(buttonExec, NULL, 0, BUTTON_CYCLE);
|
schAdd(buttonExec, NULL, 0, BUTTON_CYCLE);
|
||||||
|
|
||||||
|
|
||||||
__enable_interrupt();
|
__enable_interrupt();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -59,7 +61,7 @@ int main() {
|
|||||||
// put it into the idle loop, it is not time critical
|
// put it into the idle loop, it is not time critical
|
||||||
// but should get as much time as possible to avoid
|
// but should get as much time as possible to avoid
|
||||||
// flicker
|
// flicker
|
||||||
displayExec(NULL);
|
//displayExec(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user