Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 7d17c4c125cc0ce268da5a7dd4e884cb65c8cd35 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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