summaryrefslogtreecommitdiff
path: root/src/arch/msp430fr5969lp
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/msp430fr5969lp')
-rw-r--r--src/arch/msp430fr5969lp/Makefile.inc5
-rw-r--r--src/arch/msp430fr5969lp/arch.cc19
-rw-r--r--src/arch/msp430fr5969lp/driver/uptime.cc5
3 files changed, 20 insertions, 9 deletions
diff --git a/src/arch/msp430fr5969lp/Makefile.inc b/src/arch/msp430fr5969lp/Makefile.inc
index 81c8fdf..36d19c6 100644
--- a/src/arch/msp430fr5969lp/Makefile.inc
+++ b/src/arch/msp430fr5969lp/Makefile.inc
@@ -35,4 +35,7 @@ arch_clean:
rm -f ${OBJECTS}
rm -f build/system.hex
-.PHONY: arch_clean program
+monitor:
+ screen /dev/ttyACM1 115200
+
+.PHONY: arch_clean monitor program
diff --git a/src/arch/msp430fr5969lp/arch.cc b/src/arch/msp430fr5969lp/arch.cc
index be821a6..44a22c6 100644
--- a/src/arch/msp430fr5969lp/arch.cc
+++ b/src/arch/msp430fr5969lp/arch.cc
@@ -38,13 +38,14 @@ void Arch::setup(void)
__delay_cycles(1000000);
#endif
+#ifdef TIMER_US
// 16MHz/16 -> ~1MHz timer
TA0CTL = TASSEL__SMCLK | ID__8 | MC__CONTINUOUS;
TA0EX0 = 1;
TA0CTL |= TACLR;
+#endif
-#ifdef WITH_LOOP
-
+#if defined(WITH_LOOP) || defined(TIMER_S)
// 1s per wakeup for loop
TA1CTL = TASSEL__ACLK | ID__8 | MC__UP;
TA1EX0 = 0;
@@ -52,6 +53,12 @@ void Arch::setup(void)
TA1CTL |= TACLR | TAIE;
#endif
+#ifdef TIMER_CYCLES
+ TA2CTL = TASSEL__SMCLK | ID__1 | MC__CONTINUOUS;
+ TA2EX0 = 0;
+ TA2CTL |= TACLR;
+#endif
+
//P1OUT = 0;
//P4OUT = 0;
}
@@ -64,14 +71,20 @@ void Arch::idle_loop(void)
Arch arch;
-#ifdef WITH_LOOP
+#if defined(WITH_LOOP) || defined(TIMER_S)
+#include "driver/uptime.h"
extern void loop();
__attribute__((interrupt(TIMER1_A1_VECTOR))) __attribute__((wakeup)) void handle_timer0_overflow()
{
if (TA1IV == 0x0e) {
+#ifdef WITH_LOOP
loop();
+#endif
+#ifdef TIMER_S
+ uptime.tick_s();
+#endif
}
}
diff --git a/src/arch/msp430fr5969lp/driver/uptime.cc b/src/arch/msp430fr5969lp/driver/uptime.cc
index 6d16441..05154f9 100644
--- a/src/arch/msp430fr5969lp/driver/uptime.cc
+++ b/src/arch/msp430fr5969lp/driver/uptime.cc
@@ -1,9 +1,4 @@
#include "driver/uptime.h"
#include <msp430.h>
-uint32_t Uptime::get()
-{
- return TA0R;
-}
-
Uptime uptime;