blob: 1650cd8a4d46ff00e01118b14d440d019ff25a11 (
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
84
85
86
87
88
89
90
91
92
|
/*******************************************************************************
* 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"
#include "platform/etTimer.h"
/* forward declarations */
static void prvSetupHardware(void);
void initIO(void);
/* implemenatation for eTrice interfaces*/
void etUserEntry(void){
prvSetupHardware();
etTimer_init();
}
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;
SFRIE1 |= WDTIE;
/* select port pin functions */
halBoardInit();
P1DIR |= 0x03;
P2DIR &= ~0xC0;
P2REN |= 0xC0;
P2OUT |= 0xC0;
LFXT_Start(XT1DRIVE_0); /* enable oszillator */
Init_FLL_Settle((unsigned short) ulCPU_Clock_KHz, 488); /* clock divisor */
}
unsigned char getButtonStatus(unsigned int id){
switch (id){
case 1:return P2IN & 0x80;
break;
case 2:return P2IN & 0x40;
break;
default: return 0xFF;
};
}
void setLedPin (unsigned int id, unsigned int onOff){
switch (id){
case 1:
if (onOff){
P1OUT |= 0x01;
}else{
P1OUT &= ~0x01;
}
break;
case 2:
if (onOff){
P1OUT |= 0x02;
}else{
P1OUT &= ~0x02;
}
break;
default:
}
}
|