Compare commits

...

14 Commits

Author SHA1 Message Date
Wolfgang Hottgenroth
d2080e1db4 update origin of submodules 2017-04-12 10:00:04 +02:00
Wolfgang Hottgenroth
fe8fb9ce58 work on submodule integration 2016-09-18 17:04:47 +02:00
Wolfgang Hottgenroth
8f5d767d7e submodules added 2016-09-18 16:59:05 +02:00
Wolfgang Hottgenroth
d18f01704e removed submodule hottislib 2016-09-18 16:55:02 +02:00
Wolfgang Hottgenroth
6aa4ce84e4 hottislib imported as submodule 2016-09-18 15:30:36 +02:00
Wolfgang Hottgenroth
2a85a9a400 PontCoopScheduler migrated to HottisLib 2016-09-18 14:11:13 +02:00
Wolfgang Hottgenroth
56e23d237c simplify startup display pattern, extend default timeout 2016-09-12 10:56:08 +02:00
Wolfgang Hottgenroth
c0c7d2afd0 Added tag WORKS_2 for changeset 78b8b97f294d 2016-09-12 08:00:45 +02:00
Wolfgang Hottgenroth
75fee98f11 LPM3 is not working correctly, device is booting, disabled, now it is working 2016-09-12 07:59:34 +02:00
Wolfgang Hottgenroth
4ce993230f some changes with the loops 2016-09-11 22:06:38 +02:00
Wolfgang Hottgenroth
275779c0b3 hiding leading zeros doesn't work at the moment 2016-09-11 21:18:43 +02:00
Wolfgang Hottgenroth
63d3d29852 second edition nearly working 2016-09-11 20:33:38 +02:00
Wolfgang Hottgenroth
8ad6c780f7 change in new branch 2016-09-10 18:19:52 +02:00
Wolfgang Hottgenroth
5416467068 Starting 'SecondEdition' branch 2016-09-10 18:19:25 +02:00
19 changed files with 160 additions and 323 deletions

View File

@ -25,10 +25,20 @@
<option defaultValue="dk.xpg.msp430eclipse.compiler.option.optimization.level.none" id="dk.xpg.msp430eclipse.compiler.option.optimization.level.925149145" name="Optimization Level" superClass="dk.xpg.msp430eclipse.compiler.option.optimization.level" valueType="enumerated"/>
<option defaultValue="dk.xpg.msp430eclipse.compiler.option.debugging.level.default" id="dk.xpg.msp430eclipse.compiler.option.debugging.level.154569899" name="Debugging Level" superClass="dk.xpg.msp430eclipse.compiler.option.debugging.level" valueType="enumerated"/>
<option id="dk.xpg.msp430eclipse.compiler.option.language.standard.1380069728" name="Standard" superClass="dk.xpg.msp430eclipse.compiler.option.language.standard" value="dk.xpg.msp430eclipse.compiler.option.language.standard.gnu99" valueType="enumerated"/>
<option id="dk.xpg.msp430eclipse.compiler.option.includes.paths.1500718177" name="Include paths (-I)" superClass="dk.xpg.msp430eclipse.compiler.option.includes.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/teathermotimerng/hottislib}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/teathermotimerng/hottislibformsp430}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/teathermotimerng/src}&quot;"/>
</option>
<inputType id="dk.xpg.msp430eclipse.tool.compiler.gcc.input.1393043846" name="C Source File" superClass="dk.xpg.msp430eclipse.tool.compiler.gcc.input"/>
<inputType id="dk.xpg.msp430eclipse.tool.compiler.gcc.input.cc.1115664253" name="C++ Source File" superClass="dk.xpg.msp430eclipse.tool.compiler.gcc.input.cc"/>
</tool>
<tool id="dk.xpg.msp430eclipse.tool.assembler.gcc.423309473" name="MSP430 Assembler" superClass="dk.xpg.msp430eclipse.tool.assembler.gcc">
<option id="dk.xpg.msp430eclipse.assembler.option.general.include.497233956" name="Include Paths (-I)" superClass="dk.xpg.msp430eclipse.assembler.option.general.include" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/teathermotimerng/hottislib}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/teathermotimerng/hottislibformsp430}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/teathermotimerng/src}&quot;"/>
</option>
<inputType id="dk.xpg.msp430eclipse.tool.assembler.input.1627828012" name="Assembler Files" superClass="dk.xpg.msp430eclipse.tool.assembler.input"/>
</tool>
<tool id="dk.xpg.msp430eclipse.tool.linker.gcc.1414250393" name="MSP430 Linker" superClass="dk.xpg.msp430eclipse.tool.linker.gcc">
@ -38,7 +48,9 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="hottislibformsp430|hottislib|src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="hottislib"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="hottislibformsp430"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>
@ -68,10 +80,20 @@
<tool id="dk.xpg.msp430eclipse.tool.compiler.gcc.1604096089" name="MSP430 C Compiler" superClass="dk.xpg.msp430eclipse.tool.compiler.gcc">
<option defaultValue="dk.xpg.msp430eclipse.compiler.option.optimization.level.most" id="dk.xpg.msp430eclipse.compiler.option.optimization.level.957179260" name="Optimization Level" superClass="dk.xpg.msp430eclipse.compiler.option.optimization.level" valueType="enumerated"/>
<option defaultValue="dk.xpg.msp430eclipse.compiler.option.debugging.level.none" id="dk.xpg.msp430eclipse.compiler.option.debugging.level.1445781415" name="Debugging Level" superClass="dk.xpg.msp430eclipse.compiler.option.debugging.level" valueType="enumerated"/>
<option id="dk.xpg.msp430eclipse.compiler.option.includes.paths.1393153740" name="Include paths (-I)" superClass="dk.xpg.msp430eclipse.compiler.option.includes.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/teathermotimerng/hottislib}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/teathermotimerng/hottislibformsp430}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/teathermotimerng/src}&quot;"/>
</option>
<inputType id="dk.xpg.msp430eclipse.tool.compiler.gcc.input.2129325944" name="C Source File" superClass="dk.xpg.msp430eclipse.tool.compiler.gcc.input"/>
<inputType id="dk.xpg.msp430eclipse.tool.compiler.gcc.input.cc.2128986642" name="C++ Source File" superClass="dk.xpg.msp430eclipse.tool.compiler.gcc.input.cc"/>
</tool>
<tool id="dk.xpg.msp430eclipse.tool.assembler.gcc.1072807233" name="MSP430 Assembler" superClass="dk.xpg.msp430eclipse.tool.assembler.gcc">
<option id="dk.xpg.msp430eclipse.assembler.option.general.include.905243057" name="Include Paths (-I)" superClass="dk.xpg.msp430eclipse.assembler.option.general.include" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/teathermotimerng/hottislib}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/teathermotimerng/hottislibformsp430}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/teathermotimerng/src}&quot;"/>
</option>
<inputType id="dk.xpg.msp430eclipse.tool.assembler.input.20110081" name="Assembler Files" superClass="dk.xpg.msp430eclipse.tool.assembler.input"/>
</tool>
<tool id="dk.xpg.msp430eclipse.tool.linker.gcc.2090938199" name="MSP430 Linker" superClass="dk.xpg.msp430eclipse.tool.linker.gcc">
@ -92,9 +114,21 @@
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="TeaThermoTimer.dk.xpg.msp430eclipse.project.gcc.elf.2012413821" name="MSP430 Cross Target Application" projectType="dk.xpg.msp430eclipse.project.gcc.elf"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope"/>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="dk.xpg.msp430eclipse.configuration.app.release.1716607718;dk.xpg.msp430eclipse.configuration.app.release.1716607718.;dk.xpg.msp430eclipse.tool.compiler.gcc.1604096089;dk.xpg.msp430eclipse.tool.compiler.gcc.input.cc.2128986642">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="dk.xpg.msp430eclipse.MSP430GCCManagedMakePerProjectProfileC"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="dk.xpg.msp430eclipse.configuration.app.debug.1048602252;dk.xpg.msp430eclipse.configuration.app.debug.1048602252.;dk.xpg.msp430eclipse.tool.compiler.gcc.1489133124;dk.xpg.msp430eclipse.tool.compiler.gcc.input.1393043846">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="dk.xpg.msp430eclipse.MSP430GCCManagedMakePerProjectProfileC"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="dk.xpg.msp430eclipse.configuration.app.debug.1048602252;dk.xpg.msp430eclipse.configuration.app.debug.1048602252.;dk.xpg.msp430eclipse.tool.compiler.gcc.1489133124;dk.xpg.msp430eclipse.tool.compiler.gcc.input.cc.1115664253">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="dk.xpg.msp430eclipse.MSP430GCCManagedMakePerProjectProfileC"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="dk.xpg.msp430eclipse.configuration.app.release.1716607718;dk.xpg.msp430eclipse.configuration.app.release.1716607718.;dk.xpg.msp430eclipse.tool.compiler.gcc.1604096089;dk.xpg.msp430eclipse.tool.compiler.gcc.input.2129325944">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="dk.xpg.msp430eclipse.MSP430GCCManagedMakePerProjectProfileC"/>
</scannerConfigBuildInfo>
</storageModule>
</cproject>

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/Debug/

6
.gitmodules vendored Normal file
View File

@ -0,0 +1,6 @@
[submodule "hottislib"]
path = hottislib
url = git@gitlab.com:wolutator/hottislib.git
[submodule "hottislibformsp430"]
path = hottislibformsp430
url = git@gitlab.com:wolutator/hottislibformsp430.git

View File

@ -7,6 +7,8 @@ P2.2 G
P2.1 C
P2.0 1
P1.5 2
P1.2 3
P1.1 LED
P1.0 T

1
hottislib Submodule

@ -0,0 +1 @@
Subproject commit bba75fe8e7dd424590091481284843e85c6a1199

1
hottislibformsp430 Submodule

@ -0,0 +1 @@
Subproject commit 2be95189f47854a076f93122ea20b4053107d41a

View File

@ -1,73 +0,0 @@
/*
* PontCoopScheduler.c
*
* Created on: 29.08.2016
* Author: wn
*/
#include <stdlib.h>
#include "PontCoopScheduler.h"
tTask tasks[MAX_NUM_OF_TASKS];
void schInit() {
for (uint8_t i = 0; i < MAX_NUM_OF_TASKS; i++) {
tasks[i].delay = 0;
tasks[i].period = 0;
tasks[i].run = 0;
tasks[i].exec = NULL;
tasks[i].handle = NULL;
}
}
void schAdd(void (*exec)(void *), void *handle, uint32_t delay, uint32_t period) {
for (uint8_t i = 0; i < MAX_NUM_OF_TASKS; i++) {
if (tasks[i].exec == NULL) {
tasks[i].delay = delay;
tasks[i].period = period;
tasks[i].run = 0;
tasks[i].exec = exec;
tasks[i].handle = handle;
break;
}
}
}
void schDel(void (*exec)(void *), void *handle) {
for (uint8_t i = 0; i < MAX_NUM_OF_TASKS; i++) {
if ((tasks[i].exec == exec) && (tasks[i].handle == handle)) {
tasks[i].exec = NULL;
break;
}
}
}
void schExec() {
for (uint8_t i = 0; i < MAX_NUM_OF_TASKS; i++) {
if (tasks[i].exec != NULL && tasks[i].run > 0) {
tasks[i].run--;
tasks[i].exec(tasks[i].handle);
if (tasks[i].period == 0) {
tasks[i].exec = NULL;
}
}
}
}
void schUpdate() {
for (uint8_t i = 0; i < MAX_NUM_OF_TASKS; i++) {
if (tasks[i].exec != NULL) {
if (tasks[i].delay == 0) {
tasks[i].delay = tasks[i].period;
tasks[i].run++;
} else {
tasks[i].delay--;
}
}
}
}

View File

@ -1,35 +0,0 @@
/*
* PontCoopScheduler.h
*
* Created on: 29.08.2016
* Author: wn
*/
#ifndef PONTCOOPSCHEDULER_H_
#define PONTCOOPSCHEDULER_H_
#include <stdint.h>
#define MAX_NUM_OF_TASKS 8
typedef struct {
uint32_t delay;
uint32_t period;
uint8_t run;
void (*exec)(void *handle);
void *handle;
} tTask;
void schInit();
void schAdd(void (*exec)(void *), void *handle, uint32_t delay, uint32_t period);
void schDel(void (*exec)(void *), void *handle);
void schExec();
void schUpdate();
#endif /* PONTCOOPSCHEDULER_H_ */

View File

@ -47,64 +47,59 @@ const tPin *NUMBERS[] = { NUMBER0, NUMBER1, NUMBER2, NUMBER3, NUMBER4,
NUMBER5, NUMBER6, NUMBER7, NUMBER8, NUMBER9, ALL_PATTERN, H_PATTERN,
I_PATTERN, EMPTY_PATTERN };
const tPin DIGITS[] = { DIGIT_0, DIGIT_1, PINS_END };
const tPin DIGITS[] = { DIGIT_0, DIGIT_1, DIGIT_2, PINS_END };
uint8_t digitValues[2] = { EMPTY_ID, EMPTY_ID };
uint8_t digitValues[] = { EMPTY_ID, EMPTY_ID, EMPTY_ID };
void displayInit(void *handleArg) {
for (tPin d = DIGIT_0; d <= DIGIT_1; d++) {
for (tPin s = SEG_A; s <= SEG_F; s++) {
gpioSetPin(s, LOW);
}
for (tPin d = DIGIT_2; d >= DIGIT_0; d--) {
gpioSetPin(d, LOW);
for (tPin s = SEG_A; s <= SEG_G; s++) {
gpioSetPin(s, HIGH);
ms_active_delay(INIT_CYCLE_DELAY);
gpioSetPin(s, LOW);
}
gpioSetPin(SEG_G, HIGH);
ms_active_delay(INIT_CYCLE_DELAY);
gpioSetPin(SEG_G, LOW);
gpioSetPin(d, HIGH);
}
}
static void showNumber(uint8_t n) {
const tPin *pattern = NUMBERS[ALL_ID];
do {
for (const tPin *pattern = NUMBERS[ALL_ID]; *pattern != PINS_END; pattern++) {
gpioSetPin(*pattern, LOW);
pattern++;
} while (*pattern != PINS_END);
pattern = NUMBERS[n];
do {
}
for (const tPin *pattern = NUMBERS[n]; *pattern != PINS_END; pattern++) {
gpioSetPin(*pattern, HIGH);
pattern++;
} while (*pattern != PINS_END);
}
}
void displaySetValue(uint8_t v) {
if (v >= 100) {
digitValues[1] = H_ID;
digitValues[0] = I_ID;
} else {
digitValues[1] = v / 10;
digitValues[0] = v - digitValues[1] * 10;
}
uint32_t a,b,c,d;
a = v;
b = a / 100;
c = (a - b * 100) / 10;
d = a - c * 10 - b * 100;
digitValues[2] = (b == 0) ? EMPTY_ID : (uint8_t)b;
digitValues[1] = ((c == 0) && (b == 0)) ? EMPTY_ID : (uint8_t)c;
digitValues[0] = (uint8_t)d;
}
void displayExec(void *handleArg) {
static uint8_t activeDigit = 0;
activeDigit++;
if (activeDigit == 2) {
if (activeDigit == 3) {
activeDigit = 0;
}
const tPin *digit = DIGITS;
do {
for (const tPin *digit = DIGITS; *digit != PINS_END; digit++) {
gpioSetPin(*digit, HIGH);
digit++;
} while (*digit != PINS_END);
}
digit = DIGITS + activeDigit;
gpioSetPin(*digit, LOW);
gpioSetPin(DIGITS[activeDigit], LOW);
showNumber(digitValues[activeDigit]);
}

View File

@ -16,11 +16,12 @@
#include "button.h"
#include "gpio.h"
#include "PontCoopScheduler.h"
#include "powerDown.h"
const uint32_t EGG_TIMER_CYCLE = 1000;
const uint32_t LED_CYCLE = 250;
const uint32_t POWER_DOWN_DELAY = 120000;
const uint32_t MY_POWER_DOWN_DELAY = 120000;
const uint8_t COOKING_TIME = 120;
uint8_t restCookingTime;
@ -28,14 +29,8 @@ bool timerRunning;
bool timerStarted;
void eggTimerPowerDown(void *handleArg) {
P1DIR = 0;
P2DIR = 0;
P1OUT = 0;
P2OUT = 0;
ADC10CTL0 = 0;
LPM4;
}
void eggTimerStart(void *handleArg) {
if (! timerStarted) {
@ -62,7 +57,8 @@ void eggTimerExec(void *handleArg) {
if (restCookingTime == 0) {
// activate alarm
schAdd(eggTimerAlarm, NULL, 0, LED_CYCLE);
schAdd(eggTimerPowerDown, NULL, POWER_DOWN_DELAY, 0);
schDel(powerDown, NULL);
schAdd(powerDown, NULL, MY_POWER_DOWN_DELAY, 0);
timerRunning = false;
}
}

View File

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

View File

@ -1,98 +0,0 @@
/*
* gpio.c
*
* Created on: 29.08.2016
* Author: wn
*/
#include <msp430g2553.h>
#include <stdint.h>
#define GPIO_C
#include "gpio.h"
#undef GPIO_C
extern tPinCfg pinCfg[];
void gpioInitPins() {
for (tPin p = PINS_FIRST; p < PINS_END; p += 1) {
tPinCfg pin = pinCfg[p];
if (pin.portId == PORT1) {
if (pin.direction == PIN_OUT) {
P1DIR |= pin.bit;
P1SEL &= ~pin.bit;
P1SEL2 &= ~pin.bit;
} else if (pin.direction == PIN_IN) {
P1DIR &= ~pin.bit;
P1SEL &= ~pin.bit;
P1SEL2 &= ~pin.bit;
P1REN &= ~pin.bit;
} else if (pin.direction == PIN_IN_PULLUP) {
P1DIR &= ~pin.bit;
P1SEL &= ~pin.bit;
P1SEL2 &= ~pin.bit;
P1REN |= pin.bit;
P1OUT |= pin.bit;
}
} else if (pin.portId == PORT2) {
if (pin.direction == PIN_OUT) {
P2DIR |= pin.bit;
P2SEL &= ~pin.bit;
P2SEL2 &= ~pin.bit;
} else if (pin.direction == PIN_IN) {
P2DIR &= ~pin.bit;
P2SEL &= ~pin.bit;
P2SEL2 &= ~pin.bit;
P2REN &= ~pin.bit;
} else if (pin.direction == PIN_IN_PULLUP) {
P2DIR &= ~pin.bit;
P2SEL &= ~pin.bit;
P2SEL2 &= ~pin.bit;
P2REN |= pin.bit;
P2OUT |= pin.bit;
}
}
gpioSetPin(p, pin.defaultOut);
}
}
void gpioSetPin(tPin p, tPinState v) {
tPinCfg pin = pinCfg[p];
if (v == HIGH) {
if (pin.portId == PORT1) {
P1OUT |= pin.bit;
} else if (pin.portId == PORT2) {
P2OUT |= pin.bit;
}
} else {
if (pin.portId == PORT1) {
P1OUT &= ~pin.bit;
} else if (pin.portId == PORT2) {
P2OUT &= ~pin.bit;
}
}
}
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;
if (pin.portId == PORT1) {
pinValue = P1IN;
} else if (pin.portId == PORT2) {
pinValue = P2IN;
}
return (pinValue & pin.bit) ? HIGH : LOW;
}

View File

@ -1,66 +0,0 @@
/*
* gpio.h
*
* Created on: 29.08.2016
* Author: wn
*/
#ifndef GPIO_H_
#define GPIO_H_
#include <msp430g2553.h>
#include <stdint.h>
typedef enum {
PORT1,
PORT2
} tPort;
typedef enum {
LOW,
HIGH,
} tPinState;
typedef enum {
PIN_OUT,
PIN_IN,
PIN_IN_PULLUP
} tPinDirection;
typedef struct {
tPort portId;
uint16_t bit;
tPinDirection direction;
tPinState defaultOut;
} tPinCfg;
typedef enum {
PINS_FIRST,
SEG_A = PINS_FIRST,
SEG_B,
SEG_C,
SEG_D,
SEG_E,
SEG_F,
SEG_G,
DIGIT_0,
DIGIT_1,
BUTTON_1,
LED_1,
PINS_END
} tPin;
void gpioInitPins();
void gpioSetPin(tPin p, tPinState v);
void gpioTogglePin(tPin p);
tPinState gpioGetPin(tPin p);
#endif /* GPIO_H_ */

View File

@ -18,6 +18,7 @@ tPinCfg pinCfg[PINS_END] = {
{PORT2, BIT2, PIN_OUT, LOW}, //G
{PORT2, BIT0, PIN_OUT, HIGH}, //0
{PORT1, BIT5, PIN_OUT, HIGH}, //1
{PORT1, BIT2, PIN_OUT, HIGH}, //2
{PORT1, BIT0, PIN_IN_PULLUP, LOW}, // BUTTON_1
{PORT1, BIT1, PIN_OUT, LOW}, //TESTPIN1
{PORT1, BIT1, PIN_OUT, LOW}, // LED_1
};

31
src/gpioCfg.h Normal file
View File

@ -0,0 +1,31 @@
/*
* gpioCfg.h
*
* Created on: 18.09.2016
* Author: wn
*/
#ifndef GPIOCFG_H_
#define GPIOCFG_H_
#include "gpio.h"
typedef enum {
PINS_FIRST,
SEG_A = PINS_FIRST,
SEG_B,
SEG_C,
SEG_D,
SEG_E,
SEG_F,
SEG_G,
DIGIT_0,
DIGIT_1,
DIGIT_2,
BUTTON_1,
LED_1,
PINS_END
} tPin;
#endif /* GPIOCFG_H_ */

View File

@ -19,12 +19,17 @@
#include "measure.h"
#include "eggTimer.h"
#include "button.h"
#include "gpio.h"
#include "powerDown.h"
int main() {
WDTCTL = WDTPW | WDTHOLD;
__disable_interrupt();
// highest possible system clock
DCOCTL = DCO0 | DCO1 | DCO2;
BCSCTL1 = XT2OFF | RSEL0 | RSEL1 | RSEL2 | RSEL3;
@ -36,6 +41,8 @@ int main() {
timeInit();
schInit();
schAdd(powerDown, NULL, 1800000, 0); // default thermometer power down timeout: 30min
// interrupts are required for delay function in displayInit();
__enable_interrupt();
displayInit(NULL);
@ -57,11 +64,7 @@ int main() {
while (1) {
schExec();
// put it into the idle loop, it is not time critical
// but should get as much time as possible to avoid
// flicker
//displayExec(NULL);
//LPM3;
}
}

23
src/powerDown.c Normal file
View File

@ -0,0 +1,23 @@
/*
* powerDown.c
*
* Created on: Sep 11, 2016
* Author: wn
*/
#include <msp430g2553.h>
void powerDown(void *handleArg) {
P1OUT = 0;
P1DIR = 0xff;
P1REN = 0;
P2OUT = 0;
P2DIR = 0xff;
P2REN = 0;
ADC10CTL0 = 0;
LPM4;
while (1);
}

14
src/powerDown.h Normal file
View File

@ -0,0 +1,14 @@
/*
* powerDown.h
*
* Created on: Sep 11, 2016
* Author: wn
*/
#ifndef POWERDOWN_H_
#define POWERDOWN_H_
void powerDown(void *handleArg);
#endif /* POWERDOWN_H_ */

View File

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