2020-2021 Sunseeker Telemetry and Lighting System
dac12_a.h
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // dac12_a.h - Driver for the DAC12_A Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_DAC12_A_H__
8 #define __MSP430WARE_DAC12_A_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_DAC12_2__
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 //
29 //
30 //*****************************************************************************
31 typedef struct DAC12_A_initParam {
36  uint8_t submoduleSelect;
41  uint16_t outputSelect;
50  uint16_t positiveReferenceVoltage;
56  uint16_t outputVoltageMultiplier;
80  uint8_t amplifierSetting;
97  uint16_t conversionTriggerSelect;
98 } DAC12_A_initParam;
99 
100 
101 //*****************************************************************************
102 //
103 // The following are values that can be passed to the positiveReferenceVoltage
104 // parameter for functions: DAC12_A_init(); the param parameter for functions:
105 // DAC12_A_init().
106 //
107 //*****************************************************************************
108 #define DAC12_A_VREF_INT (DAC12SREF_0)
109 #define DAC12_A_VREF_AVCC (DAC12SREF_1)
110 #define DAC12_A_VREF_EXT (DAC12SREF_2)
111 
112 //*****************************************************************************
113 //
114 // The following are values that can be passed to the param parameter for
115 // functions: DAC12_A_init(); the amplifierSetting parameter for functions:
116 // DAC12_A_init(), and DAC12_A_setAmplifierSetting().
117 //
118 //*****************************************************************************
119 #define DAC12_A_AMP_OFF_PINOUTHIGHZ (DAC12AMP_0)
120 #define DAC12_A_AMP_OFF_PINOUTLOW (DAC12AMP_1)
121 #define DAC12_A_AMP_LOWIN_LOWOUT (DAC12AMP_2)
122 #define DAC12_A_AMP_LOWIN_MEDOUT (DAC12AMP_3)
123 #define DAC12_A_AMP_LOWIN_HIGHOUT (DAC12AMP_4)
124 #define DAC12_A_AMP_MEDIN_MEDOUT (DAC12AMP_5)
125 #define DAC12_A_AMP_MEDIN_HIGHOUT (DAC12AMP_6)
126 #define DAC12_A_AMP_HIGHIN_HIGHOUT (DAC12AMP_7)
127 
128 //*****************************************************************************
129 //
130 // The following are values that can be passed to the outputSelect parameter
131 // for functions: DAC12_A_init(); the param parameter for functions:
132 // DAC12_A_init().
133 //
134 //*****************************************************************************
135 #define DAC12_A_OUTPUT_1 (!(DAC12OPS))
136 #define DAC12_A_OUTPUT_2 (DAC12OPS)
137 
138 //*****************************************************************************
139 //
140 // The following are values that can be passed to the submoduleSelect parameter
141 // for functions: DAC12_A_init(), DAC12_A_setAmplifierSetting(),
142 // DAC12_A_disable(), DAC12_A_enableInterrupt(), DAC12_A_disableInterrupt(),
143 // DAC12_A_getInterruptStatus(), DAC12_A_clearInterrupt(),
144 // DAC12_A_calibrateOutput(), DAC12_A_getCalibrationData(),
145 // DAC12_A_setCalibrationOffset(), DAC12_A_enableConversions(),
146 // DAC12_A_setData(), DAC12_A_disableConversions(), DAC12_A_setResolution(),
147 // DAC12_A_setInputDataFormat(), and
148 // DAC12_A_getDataBufferMemoryAddressForDMA(); the param parameter for
149 // functions: DAC12_A_init().
150 //
151 //*****************************************************************************
152 #define DAC12_A_SUBMODULE_0 (0x00)
153 #define DAC12_A_SUBMODULE_1 (0x10)
154 
155 //*****************************************************************************
156 //
157 // The following are values that can be passed to the outputVoltageMultiplier
158 // parameter for functions: DAC12_A_init(); the param parameter for functions:
159 // DAC12_A_init().
160 //
161 //*****************************************************************************
162 #define DAC12_A_VREFx1 (DAC12IR)
163 #define DAC12_A_VREFx2 (DAC12OG)
164 #define DAC12_A_VREFx3 (0x0)
165 
166 //*****************************************************************************
167 //
168 // The following are values that can be passed to the conversionTriggerSelect
169 // parameter for functions: DAC12_A_init(); the param parameter for functions:
170 // DAC12_A_init().
171 //
172 //*****************************************************************************
173 #define DAC12_A_TRIGGER_ENCBYPASS (DAC12LSEL_0)
174 #define DAC12_A_TRIGGER_ENC (DAC12LSEL_1)
175 #define DAC12_A_TRIGGER_TA (DAC12LSEL_2)
176 #define DAC12_A_TRIGGER_TB (DAC12LSEL_3)
177 
178 //*****************************************************************************
179 //
180 // The following are values that can be passed to the resolutionSelect
181 // parameter for functions: DAC12_A_setResolution().
182 //
183 //*****************************************************************************
184 #define DAC12_A_RESOLUTION_8BIT (DAC12RES)
185 #define DAC12_A_RESOLUTION_12BIT (!(DAC12RES))
186 
187 //*****************************************************************************
188 //
189 // The following are values that can be passed to the inputJustification
190 // parameter for functions: DAC12_A_setInputDataFormat().
191 //
192 //*****************************************************************************
193 #define DAC12_A_JUSTIFICATION_RIGHT (!(DAC12DFJ))
194 #define DAC12_A_JUSTIFICATION_LEFT (DAC12DFJ)
195 
196 //*****************************************************************************
197 //
198 // The following are values that can be passed to the inputSign parameter for
199 // functions: DAC12_A_setInputDataFormat().
200 //
201 //*****************************************************************************
202 #define DAC12_A_UNSIGNED_BINARY (!(DAC12DF))
203 #define DAC12_A_SIGNED_2SCOMPLEMENT (DAC12DF)
204 
205 //*****************************************************************************
206 //
207 // The following are values that can be passed toThe following are values that
208 // can be returned by the DAC12_A_getInterruptStatus() function.
209 //
210 //*****************************************************************************
211 #define DAC12_A_INT_ACTIVE (DAC12IFG)
212 #define DAC12_A_INT_INACTIVE (0x00)
213 
214 //*****************************************************************************
215 //
216 // Prototypes for the APIs.
217 //
218 //*****************************************************************************
219 
220 //*****************************************************************************
221 //
235 //
236 //*****************************************************************************
237 extern bool DAC12_A_init(uint16_t baseAddress,
238  DAC12_A_initParam *param);
239 
240 //*****************************************************************************
241 //
279 //
280 //*****************************************************************************
281 extern void DAC12_A_setAmplifierSetting(uint16_t baseAddress,
282  uint8_t submoduleSelect,
283  uint8_t amplifierSetting);
284 
285 //*****************************************************************************
286 //
301 //
302 //*****************************************************************************
303 extern void DAC12_A_disable(uint16_t baseAddress,
304  uint8_t submoduleSelect);
305 
306 //*****************************************************************************
307 //
323 //
324 //*****************************************************************************
325 extern void DAC12_A_enableGrouping(uint16_t baseAddress);
326 
327 //*****************************************************************************
328 //
337 //
338 //*****************************************************************************
339 extern void DAC12_A_disableGrouping(uint16_t baseAddress);
340 
341 //*****************************************************************************
342 //
359 //
360 //*****************************************************************************
361 extern void DAC12_A_enableInterrupt(uint16_t baseAddress,
362  uint8_t submoduleSelect);
363 
364 //*****************************************************************************
365 //
379 //
380 //*****************************************************************************
381 extern void DAC12_A_disableInterrupt(uint16_t baseAddress,
382  uint8_t submoduleSelect);
383 
384 //*****************************************************************************
385 //
402 //
403 //*****************************************************************************
404 extern uint16_t DAC12_A_getInterruptStatus(uint16_t baseAddress,
405  uint8_t submoduleSelect);
406 
407 //*****************************************************************************
408 //
424 //
425 //*****************************************************************************
426 extern void DAC12_A_clearInterrupt(uint16_t baseAddress,
427  uint8_t submoduleSelect);
428 
429 //*****************************************************************************
430 //
448 //
449 //*****************************************************************************
450 extern void DAC12_A_calibrateOutput(uint16_t baseAddress,
451  uint8_t submoduleSelect);
452 
453 //*****************************************************************************
454 //
470 //
471 //*****************************************************************************
472 extern uint16_t DAC12_A_getCalibrationData(uint16_t baseAddress,
473  uint8_t submoduleSelect);
474 
475 //*****************************************************************************
476 //
495 //
496 //*****************************************************************************
497 extern void DAC12_A_setCalibrationOffset(uint16_t baseAddress,
498  uint8_t submoduleSelect,
499  uint16_t calibrationOffsetValue);
500 
501 //*****************************************************************************
502 //
519 //
520 //*****************************************************************************
521 extern void DAC12_A_enableConversions(uint16_t baseAddress,
522  uint8_t submoduleSelect);
523 
524 //*****************************************************************************
525 //
551 //
552 //*****************************************************************************
553 extern void DAC12_A_setData(uint16_t baseAddress,
554  uint8_t submoduleSelect,
555  uint16_t data);
556 
557 //*****************************************************************************
558 //
574 //
575 //*****************************************************************************
576 extern void DAC12_A_disableConversions(uint16_t baseAddress,
577  uint8_t submoduleSelect);
578 
579 //*****************************************************************************
580 //
599 //
600 //*****************************************************************************
601 extern void DAC12_A_setResolution(uint16_t baseAddress,
602  uint8_t submoduleSelect,
603  uint16_t resolutionSelect);
604 
605 //*****************************************************************************
606 //
628 //
629 //*****************************************************************************
630 extern void DAC12_A_setInputDataFormat(uint16_t baseAddress,
631  uint8_t submoduleSelect,
632  uint8_t inputJustification,
633  uint8_t inputSign);
634 
635 //*****************************************************************************
636 //
650 //
651 //*****************************************************************************
652 extern uint32_t DAC12_A_getDataBufferMemoryAddressForDMA(uint16_t baseAddress,
653  uint8_t submoduleSelect);
654 
655 //*****************************************************************************
656 //
657 // Mark the end of the C bindings section for C++ compilers.
658 //
659 //*****************************************************************************
660 #ifdef __cplusplus
661 }
662 #endif
663 
664 #endif
665 #endif // __MSP430WARE_DAC12_A_H__
MPU_initThreeSegmentsParam param