change in new branch

This commit is contained in:
Wolfgang
2016-09-10 18:19:52 +02:00
parent 811c9a5aba
commit 0a8e7f5b0b
7 changed files with 42 additions and 3 deletions

View File

@ -7,6 +7,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <msp430g2553.h>
#include "PontCoopScheduler.h" #include "PontCoopScheduler.h"

View File

@ -18,7 +18,7 @@ extern const uint32_t EGG_TIMER_CYCLE;
void eggTimerInit(void *handleArg); void eggTimerInit(void *handleArg);
void eggTimerExec(void *handleArg); void eggTimerExec(void *handleArg);
void eggTimerStart(void *handleArg); void eggTimerStart(void *handleArg);
void eggTimerAlarm(void *handleArg);
#endif /* EGGTIMER_H_ */ #endif /* EGGTIMER_H_ */

View File

@ -19,6 +19,13 @@ extern tPinCfg pinCfg[];
void gpioInitPins() { void gpioInitPins() {
P1OUT = 0;
P1DIR = 0;
P1REN = 0;
P2OUT = 0;
P2DIR = 0;
P2REN = 0;
for (tPin p = PINS_FIRST; p < PINS_END; p += 1) { for (tPin p = PINS_FIRST; p < PINS_END; p += 1) {
tPinCfg pin = pinCfg[p]; tPinCfg pin = pinCfg[p];
if (pin.portId == PORT1) { if (pin.portId == PORT1) {

View File

@ -51,6 +51,7 @@ typedef enum {
DIGIT_1, DIGIT_1,
BUTTON_1, BUTTON_1,
LED_1, LED_1,
POWER,
PINS_END PINS_END
} tPin; } tPin;

View File

@ -19,5 +19,6 @@ tPinCfg pinCfg[PINS_END] = {
{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, BIT0, PIN_IN_PULLUP, LOW}, // BUTTON_1 {PORT1, BIT0, PIN_IN_PULLUP, LOW}, // BUTTON_1
{PORT1, BIT1, PIN_OUT, LOW}, //TESTPIN1 {PORT1, BIT1, PIN_OUT, LOW}, // LED_1
{PORT1, BIT2, PIN_OUT, HIGH}, // POWER
}; };

View File

@ -19,9 +19,23 @@
#include "measure.h" #include "measure.h"
#include "eggTimer.h" #include "eggTimer.h"
#include "button.h" #include "button.h"
#include "gpio.h"
void powerDown(void *handleArg) {
P1OUT = 0;
P1DIR = 0xff;
P1REN = 0;
P2OUT = 0;
P2DIR = 0xff;
P2REN = 0;
ADC10CTL0 = 0;
LPM4;
while (1);
}
int main() { int main() {
WDTCTL = WDTPW | WDTHOLD; WDTCTL = WDTPW | WDTHOLD;
@ -36,6 +50,18 @@ int main() {
timeInit(); timeInit();
schInit(); schInit();
schAdd(eggTimerAlarm, NULL, 0, 37);
schAdd(powerDown, NULL, 5000, 0);
#if 0
// interrupts are required for delay function in displayInit(); // interrupts are required for delay function in displayInit();
__enable_interrupt(); __enable_interrupt();
displayInit(NULL); displayInit(NULL);
@ -52,11 +78,12 @@ int main() {
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);
#endif
__enable_interrupt(); __enable_interrupt();
while (1) { while (1) {
schExec(); schExec();
LPM3;
// 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

View File

@ -16,6 +16,7 @@
volatile uint32_t timestamp; volatile uint32_t timestamp;
ISR(TIMER0_A0, TA0_ISR) { ISR(TIMER0_A0, TA0_ISR) {
LPM3_EXIT;
timestamp++; timestamp++;
schUpdate(); schUpdate();
} }