From 36ffda7e5d4db86f2b7aab1ad2716bf204cec9a2 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Wed, 28 Sep 2016 12:21:08 +0200 Subject: [PATCH] boilerplate --- .cproject | 38 ++++++++++++++++++++++++++++++++------ .gitignore | 1 + .gitmodules | 3 +++ hottislib | 1 + src/main.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/time.c | 38 ++++++++++++++++++++++++++++++++++++++ src/time.h | 19 +++++++++++++++++++ 7 files changed, 140 insertions(+), 6 deletions(-) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 160000 hottislib create mode 100644 src/main.c create mode 100644 src/time.c create mode 100644 src/time.h diff --git a/.cproject b/.cproject index f761850..a0b1371 100644 --- a/.cproject +++ b/.cproject @@ -22,12 +22,19 @@ - + + @@ -37,7 +44,8 @@ - + + @@ -67,10 +75,16 @@ + @@ -91,9 +105,21 @@ - - - + + + + + + + + + + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3df573f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/Debug/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f0c11c1 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "hottislib"] + path = hottislib + url = git@bitbucket.org:wollud1969/hottislib.git diff --git a/hottislib b/hottislib new file mode 160000 index 0000000..bba75fe --- /dev/null +++ b/hottislib @@ -0,0 +1 @@ +Subproject commit bba75fe8e7dd424590091481284843e85c6a1199 diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..6937d6e --- /dev/null +++ b/src/main.c @@ -0,0 +1,46 @@ +/* + * main.c + * + * Created on: 29.08.2016 + * Author: wn + */ + +#include +#include +#include +#include +#include + +#include "time.h" +#include "PontCoopScheduler.h" + + + + +int main() { + WDTCTL = WDTPW | WDTHOLD; + + __disable_interrupt(); + + // highest possible system clock + DCOCTL = DCO0 | DCO1 | DCO2; + BCSCTL1 = XT2OFF | RSEL0 | RSEL1 | RSEL2 | RSEL3; + BCSCTL2 = 0; + BCSCTL3 = 0; + + + timeInit(); + schInit(); + + // schAdd(displayExec, NULL, 0, DISPLAY_CYCLE); + + + __enable_interrupt(); + + while (1) { + schExec(); + } +} + + + diff --git a/src/time.c b/src/time.c new file mode 100644 index 0000000..a7fd15f --- /dev/null +++ b/src/time.c @@ -0,0 +1,38 @@ +/* + * time.c + * + * Created on: 20.05.2014 + * Author: wn + */ + +#include +#include +#include + +#include "time.h" +#include "PontCoopScheduler.h" + + +volatile uint32_t timestamp; + +ISR(TIMER0_A0, TA0_ISR) { + timestamp++; + schUpdate(); +} + +void timeInit() { + timestamp = 0; + + TACCR0 = 32; + TACCTL0 = CCIE; + TACTL = MC_1 | ID_0 | TASSEL_1 | TACLR; +} + +uint32_t getMillis() { + return timestamp; +} + +void ms_active_delay(uint16_t delay) { + uint32_t start = timestamp; + while (start + delay > timestamp); +} diff --git a/src/time.h b/src/time.h new file mode 100644 index 0000000..874251e --- /dev/null +++ b/src/time.h @@ -0,0 +1,19 @@ +/* + * time.h + * + * Created on: 20.05.2014 + * Author: wn + */ + +#ifndef TIME_H_ +#define TIME_H_ + +#include + +void timeInit(); +uint32_t getMillis(); +void ms_active_delay(uint16_t delay); + + + +#endif /* TIME_H_ */