-
Notifications
You must be signed in to change notification settings - Fork 4
/
TI_CC_msp430.h
190 lines (173 loc) · 6.92 KB
/
TI_CC_msp430.h
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/* --COPYRIGHT--,BSD
* Copyright (c) 2011, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
//******************************************************************************
// Description: This file contains definitions specific to the specific MSP430
// chosen for this implementation. MSP430 has multiple interfaces capable
// of interfacing to the SPI port; each of these is defined in this file.
//
// The source labels for the definitions (i.e., "P3SEL") can be found in
// msp430xxxx.h.
//
// MSP430/CC1100-2500 Interface Code Library v1.1
//
// W. Goh
// Texas Instruments, Inc.
// December 2009
// IAR Embedded Workbench v4.20
//******************************************************************************
// Change Log:
//******************************************************************************
// Version: 1.1
// Comments: Added support for various MSP430 development tools.
// Added support for 5xx
// Version: 1.00
// Comments: Initial Release Version
//******************************************************************************
#include <msp430.h>
// SPI port definitions // Adjust the values for the chosen
#define TI_CC_SPI_USART0_PxSEL P3SEL // interfaces, according to the pin
#define TI_CC_SPI_USART0_PxDIR P3DIR // assignments indicated in the
#define TI_CC_SPI_USART0_PxIN P3IN // chosen MSP430 device datasheet.
#define TI_CC_SPI_USART0_SIMO BIT1
#define TI_CC_SPI_USART0_SOMI BIT2
#define TI_CC_SPI_USART0_UCLK BIT3
// Use this setting with 4xx EXP Board
#define TI_CC_SPI_USART1_PxSEL P4SEL
#define TI_CC_SPI_USART1_PxDIR P4DIR
#define TI_CC_SPI_USART1_PxIN P4IN
#define TI_CC_SPI_USART1_SIMO BIT3
#define TI_CC_SPI_USART1_SOMI BIT4
#define TI_CC_SPI_USART1_UCLK BIT5
#define TI_CC_SPI_USCIA0_PxSEL P3SEL
#define TI_CC_SPI_USCIA0_PxDIR P3DIR
#define TI_CC_SPI_USCIA0_PxIN P3IN
#define TI_CC_SPI_USCIA0_SIMO BIT4
#define TI_CC_SPI_USCIA0_SOMI BIT5
#define TI_CC_SPI_USCIA0_UCLK BIT0
#define TI_CC_SPI_USCIA1_PxSEL P7SEL
#define TI_CC_SPI_USCIA1_PxDIR P7DIR
#define TI_CC_SPI_USCIA1_PxIN P7IN
#define TI_CC_SPI_USCIA1_SIMO 0x02
#define TI_CC_SPI_USCIA1_SOMI 0x04
#define TI_CC_SPI_USCIA1_UCLK 0x08
// USCIA1 for F543x
/*
#define TI_CC_SPI_USCIA1_PxSEL P5SEL
#define TI_CC_SPI_USCIA1_PxDIR P5DIR
#define TI_CC_SPI_USCIA1_PxIN P5IN
#define TI_CC_SPI_USCIA1_SIMO BIT6
#define TI_CC_SPI_USCIA1_SOMI BIT7
#define TI_CC_SPI_USCIA1_PxSEL_UCLK P3SEL
#define TI_CC_SPI_USCIA1_PxDIR_UCLK P3DIR
#define TI_CC_SPI_USCIA1_UCLK BIT6
*/
// USCIA2 for F543x
#define TI_CC_SPI_USCIA2_PxSEL P9SEL
#define TI_CC_SPI_USCIA2_PxDIR P9DIR
#define TI_CC_SPI_USCIA2_PxIN P9IN
#define TI_CC_SPI_USCIA2_SOMI BIT5
#define TI_CC_SPI_USCIA2_UCLK BIT0
#define TI_CC_SPI_USCIA2_SIMO BIT4
// USCIA3 for F543x
#define TI_CC_SPI_USCIA3_PxSEL P10SEL
#define TI_CC_SPI_USCIA3_PxDIR P10DIR
#define TI_CC_SPI_USCIA3_PxIN P10IN
#define TI_CC_SPI_USCIA3_SOMI BIT5
#define TI_CC_SPI_USCIA3_UCLK BIT0
#define TI_CC_SPI_USCIA3_SIMO BIT4
// USCIB0 for Launchpad w/USCI
#define TI_CC_SPI_USCIB0_PxSEL P1SEL
#define TI_CC_SPI_USCIB0_PxSEL2 P1SEL2
#define TI_CC_SPI_USCIB0_PxDIR P1DIR
#define TI_CC_SPI_USCIB0_PxIN P1IN
#define TI_CC_SPI_USCIB0_SIMO BIT7
#define TI_CC_SPI_USCIB0_SOMI BIT6
#define TI_CC_SPI_USCIB0_UCLK BIT5
/*
//USCIB0 for eZ430-RF2500
#define TI_CC_SPI_USCIB0_PxSEL P3SEL
#define TI_CC_SPI_USCIB0_PxDIR P3DIR
#define TI_CC_SPI_USCIB0_PxIN P3IN
#define TI_CC_SPI_USCIB0_SIMO BIT1
#define TI_CC_SPI_USCIB0_SOMI BIT2
#define TI_CC_SPI_USCIB0_UCLK BIT3
*/
// USCIB1 for F543x
#define TI_CC_SPI_USCIB1_PxSEL P5SEL
#define TI_CC_SPI_USCIB1_PxDIR P5DIR
#define TI_CC_SPI_USCIB1_PxIN P5IN
#define TI_CC_SPI_USCIB1_SOMI BIT4
#define TI_CC_SPI_USCIB1_UCLK BIT5
#define TI_CC_SPI_USCIB1_PxSEL_SIMO P3SEL
#define TI_CC_SPI_USCIB1_PxDIR_SIMO P3DIR
#define TI_CC_SPI_USCIB1_SIMO BIT7
// USCIB2 for F543x
#define TI_CC_SPI_USCIB2_PxSEL P9SEL
#define TI_CC_SPI_USCIB2_PxDIR P9DIR
#define TI_CC_SPI_USCIB2_PxIN P9IN
#define TI_CC_SPI_USCIB2_SOMI BIT2
#define TI_CC_SPI_USCIB2_UCLK BIT3
#define TI_CC_SPI_USCIB2_SIMO BIT1
// USCIB3 for F543x
#define TI_CC_SPI_USCIB3_PxSEL P10SEL
#define TI_CC_SPI_USCIB3_PxDIR P10DIR
#define TI_CC_SPI_USCIB3_PxIN P10IN
#define TI_CC_SPI_USCIB3_SOMI BIT2
#define TI_CC_SPI_USCIB3_UCLK BIT3
#define TI_CC_SPI_USCIB3_SIMO BIT1
#define TI_CC_SPI_USI_PxDIR P1DIR
#define TI_CC_SPI_USI_PxIN P1IN
#define TI_CC_SPI_USI_SIMO BIT6
#define TI_CC_SPI_USI_SOMI BIT7
#define TI_CC_SPI_USI_UCLK BIT5
#define TI_CC_SPI_BITBANG_PxDIR P1DIR
#define TI_CC_SPI_BITBANG_PxOUT P1OUT
#define TI_CC_SPI_BITBANG_PxIN P1IN
#define TI_CC_SPI_BITBANG_SIMO BIT6
#define TI_CC_SPI_BITBANG_SOMI BIT7
#define TI_CC_SPI_BITBANG_UCLK BIT5
//******************************************************************************
// These constants are used to identify the chosen SPI and UART interfaces.
//******************************************************************************
#define TI_CC_SER_INTF_NULL 0
#define TI_CC_SER_INTF_USART0 1
#define TI_CC_SER_INTF_USART1 2
#define TI_CC_SER_INTF_USCIA0 3
#define TI_CC_SER_INTF_USCIA1 4
#define TI_CC_SER_INTF_USCIA2 5
#define TI_CC_SER_INTF_USCIA3 6
#define TI_CC_SER_INTF_USCIB0 7
#define TI_CC_SER_INTF_USCIB1 8
#define TI_CC_SER_INTF_USCIB2 9
#define TI_CC_SER_INTF_USCIB3 10
#define TI_CC_SER_INTF_USI 11
#define TI_CC_SER_INTF_BITBANG 12