2020-2021 Sunseeker Telemetry and Lighting System
tec.h
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // tec.h - Driver for the TEC Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_TEC_H__
8 #define __MSP430WARE_TEC_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_TEV0__
13 
14 //*****************************************************************************
15 //
16 // If building with a C++ compiler, make all of the definitions in this header
17 // have a C binding.
18 //
19 //*****************************************************************************
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 #include "inc/hw_memmap.h"
26 //*****************************************************************************
27 //
30 //
31 //*****************************************************************************
32 typedef struct TEC_initExternalFaultInputParam {
42  uint8_t selectedExternalFault;
47  uint16_t signalType;
52  uint8_t signalHold;
57  uint8_t polarityBit;
58 } TEC_initExternalFaultInputParam;
59 
60 
61 //*****************************************************************************
62 //
63 // The following are values that can be passed to the signalHold parameter for
64 // functions: TEC_initExternalClearInput().
65 //
66 //*****************************************************************************
67 #define TEC_EXTERNAL_CLEAR_SIGNAL_NOT_HELD 0x00
68 #define TEC_EXTERNAL_CLEAR_SIGNAL_HELD TECEXCLRHLD
69 
70 //*****************************************************************************
71 //
72 // The following are values that can be passed to the param parameter for
73 // functions: TEC_initExternalFaultInput().
74 //
75 //*****************************************************************************
76 #define TEC_EXTERNAL_FAULT_SIGNAL_NOT_HELD 0x00
77 #define TEC_EXTERNAL_FAULT_SIGNAL_HELD TECXFLTHLD0
78 
79 //*****************************************************************************
80 //
81 // The following are values that can be passed to the polarityBit parameter for
82 // functions: TEC_initExternalClearInput().
83 //
84 //*****************************************************************************
85 #define TEC_EXTERNAL_CLEAR_POLARITY_FALLING_EDGE_OR_LOW_LEVEL 0x00
86 #define TEC_EXTERNAL_CLEAR_POLARITY_RISING_EDGE_OR_HIGH_LEVEL TECEXCLRPOL
87 
88 //*****************************************************************************
89 //
90 // The following are values that can be passed to the param parameter for
91 // functions: TEC_initExternalFaultInput().
92 //
93 //*****************************************************************************
94 #define TEC_EXTERNAL_FAULT_POLARITY_FALLING_EDGE_OR_LOW_LEVEL 0x00
95 #define TEC_EXTERNAL_FAULT_POLARITY_RISING_EDGE_OR_HIGH_LEVEL TECXFLTPOL0
96 
97 //*****************************************************************************
98 //
99 // The following are values that can be passed to the signalType parameter for
100 // functions: TEC_initExternalClearInput().
101 //
102 //*****************************************************************************
103 #define TEC_EXTERNAL_CLEAR_SIGNALTYPE_EDGE_SENSITIVE 0x00
104 #define TEC_EXTERNAL_CLEAR_SIGNALTYPE_LEVEL_SENSITIVE TECEXCLRLVS
105 
106 //*****************************************************************************
107 //
108 // The following are values that can be passed to the param parameter for
109 // functions: TEC_initExternalFaultInput().
110 //
111 //*****************************************************************************
112 #define TEC_EXTERNAL_FAULT_SIGNALTYPE_EDGE_SENSITIVE 0x00
113 #define TEC_EXTERNAL_FAULT_SIGNALTYPE_LEVEL_SENSITIVE TECXFLTLVS0
114 
115 //*****************************************************************************
116 //
117 // The following are values that can be passed to the param parameter for
118 // functions: TEC_initExternalFaultInput().
119 //
120 //*****************************************************************************
121 #define TEC_EXTERNAL_FAULT_0 0
122 #define TEC_EXTERNAL_FAULT_1 1
123 #define TEC_EXTERNAL_FAULT_2 2
124 #define TEC_EXTERNAL_FAULT_3 3
125 #define TEC_EXTERNAL_FAULT_4 4
126 #define TEC_EXTERNAL_FAULT_5 5
127 #define TEC_EXTERNAL_FAULT_6 6
128 
129 //*****************************************************************************
130 //
131 // The following are values that can be passed to the channelEventBlock
132 // parameter for functions: TEC_enableExternalFaultInput(), and
133 // TEC_disableExternalFaultInput(); the mask parameter for functions:
134 // TEC_clearExternalFaultStatus(), and TEC_getExternalFaultStatus() as well as
135 // returned by the TEC_getExternalFaultStatus() function.
136 //
137 //*****************************************************************************
138 #define TEC_CE0 TECXFLT0STA
139 #define TEC_CE1 TECXFLT1STA
140 #define TEC_CE2 TECXFLT2STA
141 #define TEC_CE3 TECXFLT3STA
142 #define TEC_CE4 TECXFLT4STA
143 #define TEC_CE5 TECXFLT5STA
144 #define TEC_CE6 TECXFLT6STA
145 
146 //*****************************************************************************
147 //
148 // The following are values that can be passed to the mask parameter for
149 // functions: TEC_clearInterrupt(), TEC_getInterruptStatus(),
150 // TEC_enableInterrupt(), and TEC_disableInterrupt() as well as returned by the
151 // TEC_getInterruptStatus() function.
152 //
153 //*****************************************************************************
154 #define TEC_EXTERNAL_FAULT_INTERRUPT TECXFLTIFG
155 #define TEC_EXTERNAL_CLEAR_INTERRUPT TECEXCLRIFG
156 #define TEC_AUXILIARY_CLEAR_INTERRUPT TECAXCLRIFG
157 
158 //*****************************************************************************
159 //
160 // The following are values that can be passed toThe following are values that
161 // can be returned by the TEC_getExternalClearStatus() function.
162 //
163 //*****************************************************************************
164 #define TEC_EXTERNAL_CLEAR_DETECTED TECXCLRSTA
165 #define TEC_EXTERNAL_CLEAR_NOT_DETECTED 0x00
166 
167 //*****************************************************************************
168 //
169 // Prototypes for the APIs.
170 //
171 //*****************************************************************************
172 
173 //*****************************************************************************
174 //
194 //
195 //*****************************************************************************
196 extern void TEC_initExternalClearInput(uint16_t baseAddress,
197  uint8_t signalType,
198  uint8_t signalHold,
199  uint8_t polarityBit);
200 
201 //*****************************************************************************
202 //
212 //
213 //*****************************************************************************
214 extern void TEC_initExternalFaultInput(uint16_t baseAddress,
215  TEC_initExternalFaultInputParam *param);
216 
217 //*****************************************************************************
218 //
235 //
236 //*****************************************************************************
237 extern void TEC_enableExternalFaultInput(uint16_t baseAddress,
238  uint8_t channelEventBlock);
239 
240 //*****************************************************************************
241 //
258 //
259 //*****************************************************************************
260 extern void TEC_disableExternalFaultInput(uint16_t baseAddress,
261  uint8_t channelEventBlock);
262 
263 //*****************************************************************************
264 //
272 //
273 //*****************************************************************************
274 extern void TEC_enableExternalClearInput(uint16_t baseAddress);
275 
276 //*****************************************************************************
277 //
285 //
286 //*****************************************************************************
287 extern void TEC_disableExternalClearInput(uint16_t baseAddress);
288 
289 //*****************************************************************************
290 //
298 //
299 //*****************************************************************************
300 extern void TEC_enableAuxiliaryClearSignal(uint16_t baseAddress);
301 
302 //*****************************************************************************
303 //
311 //
312 //*****************************************************************************
313 extern void TEC_disableAuxiliaryClearSignal(uint16_t baseAddress);
314 
315 //*****************************************************************************
316 //
329 //
330 //*****************************************************************************
331 extern void TEC_clearInterrupt(uint16_t baseAddress,
332  uint8_t mask);
333 
334 //*****************************************************************************
335 //
353 //
354 //*****************************************************************************
355 extern uint8_t TEC_getInterruptStatus(uint16_t baseAddress,
356  uint8_t mask);
357 
358 //*****************************************************************************
359 //
377 //
378 //*****************************************************************************
379 extern void TEC_enableInterrupt(uint16_t baseAddress,
380  uint8_t mask);
381 
382 //*****************************************************************************
383 //
400 //
401 //*****************************************************************************
402 extern void TEC_disableInterrupt(uint16_t baseAddress,
403  uint8_t mask);
404 
405 //*****************************************************************************
406 //
432 //
433 //*****************************************************************************
434 extern uint8_t TEC_getExternalFaultStatus(uint16_t baseAddress,
435  uint8_t mask);
436 
437 //*****************************************************************************
438 //
455 //
456 //*****************************************************************************
457 extern void TEC_clearExternalFaultStatus(uint16_t baseAddress,
458  uint8_t mask);
459 
460 //*****************************************************************************
461 //
470 //
471 //*****************************************************************************
472 extern uint8_t TEC_getExternalClearStatus(uint16_t baseAddress);
473 
474 //*****************************************************************************
475 //
483 //
484 //*****************************************************************************
485 extern void TEC_clearExternalClearStatus(uint16_t baseAddress);
486 
487 //*****************************************************************************
488 //
489 // Mark the end of the C bindings section for C++ compilers.
490 //
491 //*****************************************************************************
492 #ifdef __cplusplus
493 }
494 #endif
495 
496 #endif
497 #endif // __MSP430WARE_TEC_H__
MPU_initThreeSegmentsParam param