2 * Copyright (c) 2014, Texas Instruments Incorporated
\r
3 * All rights reserved.
\r
5 * Redistribution and use in source and binary forms, with or without
\r
6 * modification, are permitted provided that the following conditions
\r
9 * * Redistributions of source code must retain the above copyright
\r
10 * notice, this list of conditions and the following disclaimer.
\r
12 * * Redistributions in binary form must reproduce the above copyright
\r
13 * notice, this list of conditions and the following disclaimer in the
\r
14 * documentation and/or other materials provided with the distribution.
\r
16 * * Neither the name of Texas Instruments Incorporated nor the names of
\r
17 * its contributors may be used to endorse or promote products derived
\r
18 * from this software without specific prior written permission.
\r
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
\r
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
\r
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
\r
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
\r
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
\r
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
\r
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
\r
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
\r
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
\r
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
\r
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
32 //*****************************************************************************
\r
34 // ref_a.h - Driver for the REF_A Module.
\r
36 //*****************************************************************************
\r
38 #ifndef __MSP430WARE_REF_A_H__
\r
39 #define __MSP430WARE_REF_A_H__
\r
41 #include "inc/hw_memmap.h"
\r
43 #ifdef __MSP430_HAS_REF_A__
\r
45 //*****************************************************************************
\r
47 // If building with a C++ compiler, make all of the definitions in this header
\r
48 // have a C binding.
\r
50 //*****************************************************************************
\r
56 //*****************************************************************************
\r
58 // The following are values that can be passed to the referenceVoltageSelect
\r
59 // parameter for functions: Ref_A_setReferenceVoltage().
\r
61 //*****************************************************************************
\r
62 #define REF_A_VREF1_2V (REFVSEL_0)
\r
63 #define REF_A_VREF2_0V (REFVSEL_1)
\r
64 #define REF_A_VREF2_5V (REFVSEL_2)
\r
66 //*****************************************************************************
\r
68 // The following are values that can be passed toThe following are values that
\r
69 // can be returned by the Ref_A_isBandgapActive() function and the
\r
70 // Ref_A_isRefGenActive() function.
\r
72 //*****************************************************************************
\r
73 #define REF_A_ACTIVE true
\r
74 #define REF_A_INACTIVE false
\r
76 //*****************************************************************************
\r
78 // The following are values that can be passed toThe following are values that
\r
79 // can be returned by the Ref_A_getBandgapMode() function.
\r
81 //*****************************************************************************
\r
82 #define REF_A_STATICMODE 0x00
\r
83 #define REF_A_SAMPLEMODE BGMODE
\r
85 //*****************************************************************************
\r
87 // The following are values that can be passed toThe following are values that
\r
88 // can be returned by the Ref_A_isRefGenBusy() function.
\r
90 //*****************************************************************************
\r
91 #define REF_A_NOTBUSY 0x00
\r
92 #define REF_A_BUSY REFGENBUSY
\r
94 //*****************************************************************************
\r
96 // The following are values that can be passed toThe following are values that
\r
97 // can be returned by the Ref_A_isVariableReferenceVoltageOutputReady()
\r
98 // function and the Ref_A_isBufferedBandgapVoltageReady() function.
\r
100 //*****************************************************************************
\r
101 #define REF_A_NOTREADY false
\r
102 #define REF_A_READY true
\r
104 //*****************************************************************************
\r
106 // Prototypes for the APIs.
\r
108 //*****************************************************************************
\r
110 //*****************************************************************************
\r
112 //! \brief Sets the reference voltage for the voltage generator.
\r
114 //! This function sets the reference voltage generated by the voltage generator
\r
115 //! to be used by other peripherals. This reference voltage will only be valid
\r
116 //! while the Ref_A module is in control. Please note, if the
\r
117 //! Ref_A_isRefGenBusy() returns Ref_A_BUSY, this function will have no effect.
\r
119 //! \param baseAddress is the base address of the REF_A module.
\r
120 //! \param referenceVoltageSelect is the desired voltage to generate for a
\r
121 //! reference voltage.
\r
122 //! Valid values are:
\r
123 //! - \b REF_A_VREF1_2V [Default]
\r
124 //! - \b REF_A_VREF2_0V
\r
125 //! - \b REF_A_VREF2_5V
\r
126 //! \n Modified bits are \b REFVSEL of \b REFCTL0 register.
\r
130 //*****************************************************************************
\r
131 extern void Ref_A_setReferenceVoltage(uint16_t baseAddress,
\r
132 uint8_t referenceVoltageSelect);
\r
134 //*****************************************************************************
\r
136 //! \brief Disables the internal temperature sensor to save power consumption.
\r
138 //! This function is used to turn off the internal temperature sensor to save
\r
139 //! on power consumption. The temperature sensor is enabled by default. Please
\r
140 //! note, that giving ADC12 module control over the Ref_A module, the state of
\r
141 //! the temperature sensor is dependent on the controls of the ADC12 module.
\r
142 //! Please note, if the Ref_A_isRefGenBusy() returns Ref_A_BUSY, this function
\r
143 //! will have no effect.
\r
145 //! \param baseAddress is the base address of the REF_A module.
\r
147 //! Modified bits are \b REFTCOFF of \b REFCTL0 register.
\r
151 //*****************************************************************************
\r
152 extern void Ref_A_disableTempSensor(uint16_t baseAddress);
\r
154 //*****************************************************************************
\r
156 //! \brief Enables the internal temperature sensor.
\r
158 //! This function is used to turn on the internal temperature sensor to use by
\r
159 //! other peripherals. The temperature sensor is enabled by default. Please
\r
160 //! note, if the Ref_A_isRefGenBusy() returns Ref_A_BUSY, this function will
\r
161 //! have no effect.
\r
163 //! \param baseAddress is the base address of the REF_A module.
\r
165 //! Modified bits are \b REFTCOFF of \b REFCTL0 register.
\r
169 //*****************************************************************************
\r
170 extern void Ref_A_enableTempSensor(uint16_t baseAddress);
\r
172 //*****************************************************************************
\r
174 //! \brief Outputs the reference voltage to an output pin.
\r
176 //! This function is used to output the reference voltage being generated to an
\r
177 //! output pin. Please note, the output pin is device specific. Please note,
\r
178 //! that giving ADC12 module control over the Ref_A module, the state of the
\r
179 //! reference voltage as an output to a pin is dependent on the controls of the
\r
180 //! ADC12 module. Please note, if the Ref_A_isRefGenBusy() returns Ref_A_BUSY,
\r
181 //! this function will have no effect.
\r
183 //! \param baseAddress is the base address of the REF_A module.
\r
185 //! Modified bits are \b REFOUT of \b REFCTL0 register.
\r
189 //*****************************************************************************
\r
190 extern void Ref_A_enableReferenceVoltageOutput(uint16_t baseAddress);
\r
192 //*****************************************************************************
\r
194 //! \brief Disables the reference voltage as an output to a pin.
\r
196 //! This function is used to disables the reference voltage being generated to
\r
197 //! be given to an output pin. Please note, if the Ref_A_isRefGenBusy() returns
\r
198 //! Ref_A_BUSY, this function will have no effect.
\r
200 //! \param baseAddress is the base address of the REF_A module.
\r
202 //! Modified bits are \b REFOUT of \b REFCTL0 register.
\r
206 //*****************************************************************************
\r
207 extern void Ref_A_disableReferenceVoltageOutput(uint16_t baseAddress);
\r
209 //*****************************************************************************
\r
211 //! \brief Enables the reference voltage to be used by peripherals.
\r
213 //! This function is used to enable the generated reference voltage to be used
\r
214 //! other peripherals or by an output pin, if enabled. Please note, that giving
\r
215 //! ADC12 module control over the Ref_A module, the state of the reference
\r
216 //! voltage is dependent on the controls of the ADC12 module. Please note, if
\r
217 //! the Ref_A_isRefGenBusy() returns Ref_A_BUSY, this function will have no
\r
220 //! \param baseAddress is the base address of the REF_A module.
\r
222 //! Modified bits are \b REFON of \b REFCTL0 register.
\r
226 //*****************************************************************************
\r
227 extern void Ref_A_enableReferenceVoltage(uint16_t baseAddress);
\r
229 //*****************************************************************************
\r
231 //! \brief Disables the reference voltage.
\r
233 //! This function is used to disable the generated reference voltage. Please
\r
234 //! note, if the Ref_A_isRefGenBusy() returns Ref_A_BUSY, this function will
\r
235 //! have no effect.
\r
237 //! \param baseAddress is the base address of the REF_A module.
\r
239 //! Modified bits are \b REFON of \b REFCTL0 register.
\r
243 //*****************************************************************************
\r
244 extern void Ref_A_disableReferenceVoltage(uint16_t baseAddress);
\r
246 //*****************************************************************************
\r
248 //! \brief Returns the bandgap mode of the Ref_A module.
\r
250 //! This function is used to return the bandgap mode of the Ref_A module,
\r
251 //! requested by the peripherals using the bandgap. If a peripheral requests
\r
252 //! static mode, then the bandgap mode will be static for all modules, whereas
\r
253 //! if all of the peripherals using the bandgap request sample mode, then that
\r
254 //! will be the mode returned. Sample mode allows the bandgap to be active only
\r
255 //! when necessary to save on power consumption, static mode requires the
\r
256 //! bandgap to be active until no peripherals are using it anymore.
\r
258 //! \param baseAddress is the base address of the REF_A module.
\r
260 //! \return One of the following:
\r
261 //! - \b Ref_A_STATICMODE if the bandgap is operating in static mode
\r
262 //! - \b Ref_A_SAMPLEMODE if the bandgap is operating in sample mode
\r
263 //! \n indicating the bandgap mode of the module
\r
265 //*****************************************************************************
\r
266 extern uint16_t Ref_A_getBandgapMode(uint16_t baseAddress);
\r
268 //*****************************************************************************
\r
270 //! \brief Returns the active status of the bandgap in the Ref_A module.
\r
272 //! This function is used to return the active status of the bandgap in the
\r
273 //! Ref_A module. If the bandgap is in use by a peripheral, then the status
\r
274 //! will be seen as active.
\r
276 //! \param baseAddress is the base address of the REF_A module.
\r
278 //! \return One of the following:
\r
279 //! - \b Ref_A_ACTIVE if active
\r
280 //! - \b Ref_A_INACTIVE if not active
\r
281 //! \n indicating the bandgap active status of the module
\r
283 //*****************************************************************************
\r
284 extern bool Ref_A_isBandgapActive(uint16_t baseAddress);
\r
286 //*****************************************************************************
\r
288 //! \brief Returns the busy status of the reference generator in the Ref_A
\r
291 //! This function is used to return the busy status of the reference generator
\r
292 //! in the Ref_A module. If the ref generator is in use by a peripheral, then
\r
293 //! the status will be seen as busy.
\r
295 //! \param baseAddress is the base address of the REF_A module.
\r
297 //! \return One of the following:
\r
298 //! - \b Ref_A_NOTBUSY if the reference generator is not being used
\r
299 //! - \b Ref_A_BUSY if the reference generator is being used,
\r
300 //! disallowing changes to be made to the Ref_A module controls
\r
301 //! \n indicating the reference generator busy status of the module
\r
303 //*****************************************************************************
\r
304 extern uint16_t Ref_A_isRefGenBusy(uint16_t baseAddress);
\r
306 //*****************************************************************************
\r
308 //! \brief Returns the active status of the reference generator in the Ref_A
\r
311 //! This function is used to return the active status of the reference
\r
312 //! generator in the Ref_A module. If the ref generator is on and ready to use,
\r
313 //! then the status will be seen as active.
\r
315 //! \param baseAddress is the base address of the REF_A module.
\r
317 //! \return One of the following:
\r
318 //! - \b Ref_A_ACTIVE if active
\r
319 //! - \b Ref_A_INACTIVE if not active
\r
320 //! \n indicating the reference generator active status of the module
\r
322 //*****************************************************************************
\r
323 extern bool Ref_A_isRefGenActive(uint16_t baseAddress);
\r
325 //*****************************************************************************
\r
327 //! \brief Returns the busy status of the reference generator in the Ref_A
\r
330 //! This function is used to return the buys status of the buffered bandgap
\r
331 //! voltage in the Ref_A module. If the ref generator is on and ready to use,
\r
332 //! then the status will be seen as active.
\r
334 //! \param baseAddress is the base address of the REF_A module.
\r
336 //! \return One of the following:
\r
337 //! - \b Ref_A_NOTREADY if NOT ready to be used
\r
338 //! - \b Ref_A_READY if ready to be used
\r
339 //! \n indicating the the busy status of the reference generator in the
\r
342 //*****************************************************************************
\r
343 extern bool Ref_A_isBufferedBandgapVoltageReady(uint16_t baseAddress);
\r
345 //*****************************************************************************
\r
347 //! \brief Returns the busy status of the variable reference voltage in the
\r
350 //! This function is used to return the busy status of the variable reference
\r
351 //! voltage in the Ref_A module. If the ref generator is on and ready to use,
\r
352 //! then the status will be seen as active.
\r
354 //! \param baseAddress is the base address of the REF_A module.
\r
356 //! \return One of the following:
\r
357 //! - \b Ref_A_NOTREADY if NOT ready to be used
\r
358 //! - \b Ref_A_READY if ready to be used
\r
359 //! \n indicating the the busy status of the variable reference voltage
\r
362 //*****************************************************************************
\r
363 extern bool Ref_A_isVariableReferenceVoltageOutputReady(uint16_t baseAddress);
\r
365 //*****************************************************************************
\r
367 //! \brief Enables the one-time trigger of the reference voltage.
\r
369 //! Triggers the one-time generation of the variable reference voltage. Once
\r
370 //! the reference voltage request is set, this bit is cleared by hardware
\r
372 //! \param baseAddress is the base address of the REF_A module.
\r
374 //! Modified bits are \b REFGENOT of \b REFCTL0 register.
\r
378 //*****************************************************************************
\r
379 extern void Ref_A_setReferenceVoltageOneTimeTrigger(uint16_t baseAddress);
\r
381 //*****************************************************************************
\r
383 //! \brief Enables the one-time trigger of the buffered bandgap voltage.
\r
385 //! Triggers the one-time generation of the buffered bandgap voltage. Once the
\r
386 //! buffered bandgap voltage request is set, this bit is cleared by hardware
\r
388 //! \param baseAddress is the base address of the REF_A module.
\r
390 //! Modified bits are \b REFBGOT of \b REFCTL0 register.
\r
394 //*****************************************************************************
\r
395 extern void Ref_A_setBufferedBandgapVoltageOneTimeTrigger(uint16_t baseAddress);
\r
397 //*****************************************************************************
\r
399 // Mark the end of the C bindings section for C++ compilers.
\r
401 //*****************************************************************************
\r
407 #endif // __MSP430WARE_REF_A_H__
\r