Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: e3265ad0a727ccff036afb7dea6396e080883eee (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*******************************************************************************
 * Copyright (c) 2012 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 (initial contribution)
 *
 *******************************************************************************/

#include "msp430f5438a.h"
#include "hal_MSP-EXP430F5438.h"

/* forward declarations */
static void prvSetupHardware(void);
void initIO(void);


/* implemenatation for eTrice interfaces*/

void etUserEntry(void){
	prvSetupHardware();
}

void etUserPreRun(void){
	//_enable_interrupt();
}

void etUserPostRun(void){ }
void etUserExit(void){ }


/* platform specific functions */

static void prvSetupHardware(void) {
	/* Convert a Hz value to a KHz value, as required by the Init_FLL_Settle()
	 function. */
	unsigned long ulCPU_Clock_KHz = (25000000UL / 1000UL );

	/* Disable the watchdog. */
	WDTCTL = WDTPW + 0x36;

	halBoardInit();

	LFXT_Start(XT1DRIVE_0);
	Init_FLL_Settle((unsigned short) ulCPU_Clock_KHz, 488);

	halButtonsInit(BUTTON_ALL);
	halButtonsInterruptEnable(BUTTON_SELECT);

	/* Initialise the LCD, but note that the backlight is not used as the
	 library function uses timer A0 to modulate the backlight, and this file
	 defines	vApplicationSetupTimerInterrupt() to also use timer A0 to generate
	 the tick interrupt.  If the backlight is required, then change either the
	 halLCD library or vApplicationSetupTimerInterrupt() to use a different
	 timer.  Timer A1 is used for the run time stats time base6. */
	halLcdInit();
	halLcdSetContrast(105);
	halLcdClearScreen();
	halLcdBackLightInit();
	halLcdSetBackLight(10);

	halLcdPrintLine(" eTrice on MSP430", 1, OVERWRITE_TEXT);

	//initIO();
}


#pragma INTERRUPT(wdt_isr)
#pragma vector=WDT_VECTOR
void wdt_isr(void) {
// this interrupt will be called every 15,625ms
	static unsigned char secCounter = 0;

	secCounter++;

	if (secCounter >= 64) {
		secCounter = 0;
		P1OUT ^= 0x01;
	}
} // end interrupt

Back to the top