2 * -------------------------------------------
3 * MSP432 DriverLib - v01_04_00_18
4 * -------------------------------------------
6 * --COPYRIGHT--,BSD,BSD
7 * Copyright (c) 2015, Texas Instruments Incorporated
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
14 * * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
17 * * Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
21 * * Neither the name of Texas Instruments Incorporated nor the names of
22 * its contributors may be used to endorse or promote products derived
23 * from this software without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
27 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
29 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
32 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
35 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 //*****************************************************************************
42 //! \addtogroup ref_api
45 //*****************************************************************************
51 //*****************************************************************************
53 // If building with a C++ compiler, make all of the definitions in this header
56 //*****************************************************************************
62 //*****************************************************************************
64 //The following are values that can be passed to Ref_setReferenceVoltage()
65 //in the referenceVoltageSelect parameter.
67 //*****************************************************************************
68 #define REF_A_VREF1_2V REFVSEL_0
69 #define REF_A_VREF1_45V REFVSEL_1
70 #define REF_A_VREF2_5V REFVSEL_3
72 //*****************************************************************************
74 //The following are values that are returned by Ref_getBandgapMode().
76 //*****************************************************************************
77 #define REF_A_STATICMODE 0x0
78 #define REF_A_SAMPLEMODE BGMODE
80 //*****************************************************************************
82 //! Sets the reference voltage for the voltage generator.
84 //! \param referenceVoltageSelect is the desired voltage to generate for a
85 //! reference voltage.
87 //! - \b REF_A_VREF1_2V [Default]
88 //! - \b REF_A_VREF1_45V
89 //! - \b REF_A_VREF2_5V
90 //! Modified bits are \b REFVSEL of \b REFCTL0 register.
92 //! This function sets the reference voltage generated by the voltage generator
93 //! to be used by other peripherals. This reference voltage will only be valid
94 //! while the REF module is in control.
95 //! Please note, if the \link REF_A_isRefGenBusy() \endlink returns \b REF_BUSY,
96 //! this function will have no effect.
100 //*****************************************************************************
101 extern void REF_A_setReferenceVoltage(uint_fast8_t referenceVoltageSelect);
103 //*****************************************************************************
105 //! Disables the internal temperature sensor to save power consumption.
107 //! This function is used to turn off the internal temperature sensor to save
108 //! on power consumption. The temperature sensor is enabled by default. Please
109 //! note, that giving ADC12 module control over the REF module, the state of the
110 //! temperature sensor is dependent on the controls of the ADC12 module.
111 //! Please note, if the \link REF_A_isRefGenBusy() \endlink returns
112 //! \b REF_A_BUSY, this function will have no effect.
114 //! Modified bits are \b REFTCOFF of \b REFCTL0 register.
117 //*****************************************************************************
118 extern void REF_A_disableTempSensor(void);
120 //*****************************************************************************
122 //! Enables the internal temperature sensor.
124 //! This function is used to turn on the internal temperature sensor to use by
125 //! other peripherals. The temperature sensor is enabled by default.
126 //! Please note, if the \link REF_A_isRefGenBusy() \endlink returns
127 //! \b REF_A_BUSY, this function will have no effect.
129 //! Modified bits are \b REFTCOFF of \b REFCTL0 register.
133 //*****************************************************************************
134 extern void REF_A_enableTempSensor(void);
136 //*****************************************************************************
138 //! Outputs the reference voltage to an output pin.
140 //! This function is used to output the reference voltage being generated to an
141 //! output pin. Please note, the output pin is device specific. Please note,
142 //! that giving ADC12 module control over the REF module, the state of the
143 //! reference voltage as an output to a pin is dependent on the controls of the
145 //! Please note, if the \link REF_A_isRefGenBusy() \endlink returns
146 //! \b REF_A_BUSY, this function will have no effect.
148 //! Modified bits are \b REFOUT of \b REFCTL0 register.
151 //*****************************************************************************
152 extern void REF_A_enableReferenceVoltageOutput(void);
154 //*****************************************************************************
156 //! Disables the reference voltage as an output to a pin.
158 //! This function is used to disables the reference voltage being generated to
159 //! be given to an output pin.
160 //! Please note, if the \link REF_A_isRefGenBusy() \endlink returns
161 //! \b REF_A_BUSY, this function will have no effect.
163 //! Modified bits are \b REFOUT of \b REFCTL0 register.
166 //*****************************************************************************
167 extern void REF_A_disableReferenceVoltageOutput(void);
169 //*****************************************************************************
171 //! Enables the reference voltage to be used by peripherals.
173 //! This function is used to enable the generated reference voltage to be used
174 //! other peripherals or by an output pin, if enabled. Please note, that giving
175 //! ADC12 module control over the REF module, the state of the reference voltage
176 //! is dependent on the controls of the ADC12 module.
177 //! Please note, if the \link REF_A_isRefGenBusy() \endlink returns
178 //! REF_A_BUSY, this function will have no effect.
180 //! Modified bits are \b REFON of \b REFCTL0 register.
183 //*****************************************************************************
184 extern void REF_A_enableReferenceVoltage(void);
186 //*****************************************************************************
188 //! Disables the reference voltage.
190 //! This function is used to disable the generated reference voltage.
191 //! Please note, if the \link REF_A_isRefGenBusy() \endlink returns
192 //! \b REF_A_BUSY, this function will have no effect.
194 //! Modified bits are \b REFON of \b REFCTL0 register.
197 //*****************************************************************************
198 extern void REF_A_disableReferenceVoltage(void);
200 //*****************************************************************************
202 //! Returns the bandgap mode of the REF module.
204 //! This function is used to return the bandgap mode of the REF module,
205 //! requested by the peripherals using the bandgap. If a peripheral requests
206 //! static mode, then the bandgap mode will be static for all modules, whereas
207 //! if all of the peripherals using the bandgap request sample mode, then that
208 //! will be the mode returned. Sample mode allows the bandgap to be active only
209 //! when necessary to save on power consumption, static mode requires the
210 //! bandgap to be active until no peripherals are using it anymore.
212 //! \return The bandgap mode of the REF module:
213 //! - \b REF_A_STATICMODE if the bandgap is operating in static mode
214 //! - \b REF_A_SAMPLEMODE if the bandgap is operating in sample mode
216 //*****************************************************************************
217 extern uint_fast8_t REF_A_getBandgapMode(void);
219 //*****************************************************************************
221 //! Returns the active status of the bandgap in the REF module.
223 //! This function is used to return the active status of the bandgap in the REF
224 //! module. If the bandgap is in use by a peripheral, then the status will be
227 //! \return true if the bandgap is being used, false otherwise
229 //*****************************************************************************
230 extern bool REF_A_isBandgapActive(void);
232 //*****************************************************************************
234 //! Returns the busy status of the reference generator in the REF module.
236 //! This function is used to return the busy status of the reference generator
237 //! in the REF module. If the ref. generator is in use by a peripheral, then the
238 //! status will be seen as busy.
240 //! \return true if the reference generator is being used, false otherwise.
241 //*****************************************************************************
242 extern bool REF_A_isRefGenBusy(void);
244 //*****************************************************************************
246 //! Returns the active status of the reference generator in the REF module.
248 //! This function is used to return the active status of the reference generator
249 //! in the REF module. If the ref. generator is on and ready to use, then the
250 //! status will be seen as active.
252 //! \return true if the reference generator is active, false otherwise.
254 //*****************************************************************************
255 extern bool REF_A_isRefGenActive(void);
257 //*****************************************************************************
259 //! Returns the busy status of the reference generator in the REF module.
261 //! This function is used to return the buys status of the buffered bandgap
262 //! voltage in the REF module. If the ref. generator is on and ready to use,
263 //! then the status will be seen as active.
265 //! \return true if the buffered bandgap voltage is ready to be used, false
268 //*****************************************************************************
269 extern bool REF_A_getBufferedBandgapVoltageStatus(void);
271 //*****************************************************************************
273 //! Returns the busy status of the variable reference voltage in the REF module.
275 //! This function is used to return the buys status of the variable reference
276 //! voltage in the REF module. If the ref. generator is on and ready to use,
277 //! then the status will be seen as active.
279 //! \return true if the variable bandgap voltage is ready to be used, false
282 //*****************************************************************************
283 extern bool REF_A_getVariableReferenceVoltageStatus(void);
285 //*****************************************************************************
287 //! Enables the one-time trigger of the reference voltage.
289 //! Triggers the one-time generation of the variable reference voltage. Once
290 //! the reference voltage request is set, this bit is cleared by hardware
292 //! Modified bits are \b REFGENOT of \b REFCTL0 register.
296 //*****************************************************************************
297 extern void REF_A_setReferenceVoltageOneTimeTrigger(void);
299 //*****************************************************************************
301 //! Enables the one-time trigger of the buffered bandgap voltage.
303 //! Triggers the one-time generation of the buffered bandgap voltage. Once
304 //! the buffered bandgap voltage request is set, this bit is cleared by hardware
306 //! Modified bits are \b RefGOT of \b REFCTL0 register.
310 //*****************************************************************************
311 extern void REF_A_setBufferedBandgapVoltageOneTimeTrigger(void);
313 /* Defines for future devices that might have multiple instances */
314 #define REF_A_setReferenceVoltageMultipleInstance(a,b) REF_A_setReferenceVoltage(b)
315 #define REF_A_disableTempSensorMultipleInstance(a) REF_A_disableTempSensor()
316 #define REF_A_enableTempSensorMultipleInstance(a) REF_A_enableTempSensor()
317 #define REF_A_enableReferenceVoltageOutputMultipleInstance(a) REF_A_enableReferenceVoltageOutput()
318 #define REF_A_disableReferenceVoltageOutputMultipleInstance(a) REF_A_disableReferenceVoltageOutput()
319 #define REF_A_enableReferenceVoltageMultipleInstance(a) REF_A_enableReferenceVoltage()
320 #define REF_A_disableReferenceVoltageMultipleInstance(a) REF_A_disableReferenceVoltage()
321 #define REF_A_getBandgapModeMultipleInstance(a) REF_A_getBandgapMode()
322 #define REF_A_isBandgapActiveMultipleInstance(a) REF_A_isBandgapActive()
323 #define REF_A_isRefGenBusyMultipleInstance(a) REF_A_isRefGenBusy()
324 #define REF_A_isRefGenActiveMultipleInstance(a) REF_A_isRefGenActive()
325 #define REF_A_getBufferedBandgapVoltageStatusMultipleInstance(a) REF_A_getBufferedBandgapVoltageStatus()
326 #define REF_A_getVariableReferenceVoltageStatusMultipleInstance(a) REF_A_getVariableReferenceVoltageStatus()
327 #define REF_A_setReferenceVoltageOneTimeTriggerMultipleInstance(a) REF_A_setReferenceVoltageOneTimeTrigger()
328 #define REF_A_setBufferedBandgapVoltageOneTimeTriggerMultipleInstance(a) REF_A_setBufferedBandgapVoltageOneTimeTrigger()
330 //*****************************************************************************
332 // Mark the end of the C bindings section for C++ compilers.
334 //*****************************************************************************
339 //*****************************************************************************
341 // Close the Doxygen group.
344 //*****************************************************************************
346 #endif // __REF_A_H__