Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etTime.c')
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etTime.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etTime.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etTime.c
new file mode 100644
index 000000000..7d17c4c12
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etTime.c
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz, Thomas Jung (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "osal/etTime.h"
+
+etTime targetTime;
+
+void etTime_init(void){
+ targetTime.nSec=0;
+ targetTime.sec=0;
+}
+
+
+void getTimeFromTarget(etTime *t) {
+ _disable_interrupt();
+ *t = targetTime;
+ _enable_interrupt();
+}
+
+/* the timer interrupt */
+#pragma INTERRUPT(wdt_isr)
+#pragma vector=WDT_VECTOR
+void wdt_isr(void) {
+// this interrupt will be called every 15,625ms or 1,953125ms
+ targetTime.nSec += 15625000L;
+
+ if (targetTime.nSec >= 1000000000L) {
+ targetTime.nSec -= 1000000000L;
+ targetTime.sec++;
+ }
+// P10OUT ^= 0x01; //toggle testpin
+} // end interrupt
+
+

Back to the top