MSP430 DriverLib for MSP430F5xx_6xx Devices  2.91.13.01
ref.h
1 //*****************************************************************************
2 //
3 // ref.h - Driver for the REF Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_REF_H__
8 #define __MSP430WARE_REF_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_REF__
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 //*****************************************************************************
26 //
27 // The following are values that can be passed to the referenceVoltageSelect
28 // parameter for functions: Ref_setReferenceVoltage().
29 //
30 //*****************************************************************************
31 #define REF_VREF1_5V (REFVSEL_0)
32 #define REF_VREF2_0V (REFVSEL_1)
33 #define REF_VREF2_5V (REFVSEL_2)
34 
35 //*****************************************************************************
36 //
37 // The following are values that can be passed toThe following are values that
38 // can be returned by the Ref_isBandgapActive() function and the
39 // Ref_isRefGenActive() function.
40 //
41 //*****************************************************************************
42 #define REF_ACTIVE true
43 #define REF_INACTIVE false
44 
45 //*****************************************************************************
46 //
47 // The following are values that can be passed toThe following are values that
48 // can be returned by the Ref_getBandgapMode() function.
49 //
50 //*****************************************************************************
51 #define REF_STATICMODE 0x00
52 #define REF_SAMPLEMODE BGMODE
53 
54 //*****************************************************************************
55 //
56 // The following are values that can be passed toThe following are values that
57 // can be returned by the Ref_isRefGenBusy() function.
58 //
59 //*****************************************************************************
60 #define REF_NOTBUSY 0x00
61 #define REF_BUSY REFGENBUSY
62 
63 //*****************************************************************************
64 //
65 // Prototypes for the APIs.
66 //
67 //*****************************************************************************
68 
69 //*****************************************************************************
70 //
71 //! \brief Sets the reference voltage for the voltage generator.
72 //!
73 //! This function sets the reference voltage generated by the voltage generator
74 //! to be used by other peripherals. This reference voltage will only be valid
75 //! while the Ref module is in control. Please note, if the Ref_isRefGenBusy()
76 //! returns Ref_BUSY, this function will have no effect.
77 //!
78 //! \param baseAddress is the base address of the REF module.
79 //! \param referenceVoltageSelect is the desired voltage to generate for a
80 //! reference voltage.
81 //! Valid values are:
82 //! - \b REF_VREF1_5V [Default]
83 //! - \b REF_VREF2_0V
84 //! - \b REF_VREF2_5V
85 //! \n Modified bits are \b REFVSEL of \b REFCTL0 register.
86 //!
87 //! \return None
88 //
89 //*****************************************************************************
90 extern void Ref_setReferenceVoltage(uint16_t baseAddress,
91  uint8_t referenceVoltageSelect);
92 
93 //*****************************************************************************
94 //
95 //! \brief Disables the internal temperature sensor to save power consumption.
96 //!
97 //! This function is used to turn off the internal temperature sensor to save
98 //! on power consumption. The temperature sensor is enabled by default. Please
99 //! note, that giving ADC12 module control over the Ref module, the state of
100 //! the temperature sensor is dependent on the controls of the ADC12 module.
101 //! Please note, if the Ref_isRefGenBusy() returns Ref_BUSY, this function will
102 //! have no effect.
103 //!
104 //! \param baseAddress is the base address of the REF module.
105 //!
106 //! Modified bits are \b REFTCOFF of \b REFCTL0 register.
107 //!
108 //! \return None
109 //
110 //*****************************************************************************
111 extern void Ref_disableTempSensor(uint16_t baseAddress);
112 
113 //*****************************************************************************
114 //
115 //! \brief Enables the internal temperature sensor.
116 //!
117 //! This function is used to turn on the internal temperature sensor to use by
118 //! other peripherals. The temperature sensor is enabled by default. Please
119 //! note, if the Ref_isRefGenBusy() returns Ref_BUSY, this function will have
120 //! no effect.
121 //!
122 //! \param baseAddress is the base address of the REF module.
123 //!
124 //! Modified bits are \b REFTCOFF of \b REFCTL0 register.
125 //!
126 //! \return None
127 //
128 //*****************************************************************************
129 extern void Ref_enableTempSensor(uint16_t baseAddress);
130 
131 //*****************************************************************************
132 //
133 //! \brief Outputs the reference voltage to an output pin.
134 //!
135 //! This function is used to output the reference voltage being generated to an
136 //! output pin. Please note, the output pin is device specific. Please note,
137 //! that giving ADC12 module control over the Ref module, the state of the
138 //! reference voltage as an output to a pin is dependent on the controls of the
139 //! ADC12 module. If ADC12_A reference burst is disabled or DAC12_A is enabled,
140 //! this output is available continuously. If ADC12_A reference burst is
141 //! enabled, this output is available only during an ADC12_A conversion. For
142 //! devices with CTSD16, Ref_enableReferenceVoltage() needs to be invoked to
143 //! get VREFBG available continuously. Otherwise, VREFBG is only available
144 //! externally when a module requests it. Please note, if the
145 //! Ref_isRefGenBusy() returns Ref_BUSY, this function will have no effect.
146 //!
147 //! \param baseAddress is the base address of the REF module.
148 //!
149 //! Modified bits are \b REFOUT of \b REFCTL0 register.
150 //!
151 //! \return None
152 //
153 //*****************************************************************************
154 extern void Ref_enableReferenceVoltageOutput(uint16_t baseAddress);
155 
156 //*****************************************************************************
157 //
158 //! \brief Disables the reference voltage as an output to a pin.
159 //!
160 //! This function is used to disables the reference voltage being generated to
161 //! be given to an output pin. Please note, if the Ref_isRefGenBusy() returns
162 //! Ref_BUSY, this function will have no effect.
163 //!
164 //! \param baseAddress is the base address of the REF module.
165 //!
166 //! Modified bits are \b REFOUT of \b REFCTL0 register.
167 //!
168 //! \return None
169 //
170 //*****************************************************************************
171 extern void Ref_disableReferenceVoltageOutput(uint16_t baseAddress);
172 
173 //*****************************************************************************
174 //
175 //! \brief Enables the reference voltage to be used by peripherals.
176 //!
177 //! This function is used to enable the generated reference voltage to be used
178 //! other peripherals or by an output pin, if enabled. Please note, that giving
179 //! ADC12 module control over the Ref module, the state of the reference
180 //! voltage is dependent on the controls of the ADC12 module. Please note,
181 //! ADC10_A does not support the reference request. If the Ref_isRefGenBusy()
182 //! returns Ref_BUSY, this function will have no effect.
183 //!
184 //! \param baseAddress is the base address of the REF module.
185 //!
186 //! Modified bits are \b REFON of \b REFCTL0 register.
187 //!
188 //! \return None
189 //
190 //*****************************************************************************
191 extern void Ref_enableReferenceVoltage(uint16_t baseAddress);
192 
193 //*****************************************************************************
194 //
195 //! \brief Disables the reference voltage.
196 //!
197 //! This function is used to disable the generated reference voltage. Please
198 //! note, if the Ref_isRefGenBusy() returns Ref_BUSY, this function will have
199 //! no effect.
200 //!
201 //! \param baseAddress is the base address of the REF module.
202 //!
203 //! Modified bits are \b REFON of \b REFCTL0 register.
204 //!
205 //! \return None
206 //
207 //*****************************************************************************
208 extern void Ref_disableReferenceVoltage(uint16_t baseAddress);
209 
210 //*****************************************************************************
211 //
212 //! \brief Returns the bandgap mode of the Ref module.
213 //!
214 //! This function is used to return the bandgap mode of the Ref module,
215 //! requested by the peripherals using the bandgap. If a peripheral requests
216 //! static mode, then the bandgap mode will be static for all modules, whereas
217 //! if all of the peripherals using the bandgap request sample mode, then that
218 //! will be the mode returned. Sample mode allows the bandgap to be active only
219 //! when necessary to save on power consumption, static mode requires the
220 //! bandgap to be active until no peripherals are using it anymore.
221 //!
222 //! \param baseAddress is the base address of the REF module.
223 //!
224 //! \return One of the following:
225 //! - \b REF_STATICMODE if the bandgap is operating in static mode
226 //! - \b REF_SAMPLEMODE if the bandgap is operating in sample mode
227 //! \n indicating the bandgap mode of the module
228 //
229 //*****************************************************************************
230 extern uint16_t Ref_getBandgapMode(uint16_t baseAddress);
231 
232 //*****************************************************************************
233 //
234 //! \brief Returns the active status of the bandgap in the Ref module.
235 //!
236 //! This function is used to return the active status of the bandgap in the Ref
237 //! module. If the bandgap is in use by a peripheral, then the status will be
238 //! seen as active.
239 //!
240 //! \param baseAddress is the base address of the REF module.
241 //!
242 //! \return One of the following:
243 //! - \b REF_ACTIVE if active
244 //! - \b REF_INACTIVE if not active
245 //! \n indicating the bandgap active status of the module
246 //
247 //*****************************************************************************
248 extern bool Ref_isBandgapActive(uint16_t baseAddress);
249 
250 //*****************************************************************************
251 //
252 //! \brief Returns the busy status of the reference generator in the Ref
253 //! module.
254 //!
255 //! This function is used to return the busy status of the reference generator
256 //! in the Ref module. If the ref generator is in use by a peripheral, then the
257 //! status will be seen as busy.
258 //!
259 //! \param baseAddress is the base address of the REF module.
260 //!
261 //! \return One of the following:
262 //! - \b REF_NOTBUSY if the reference generator is not being used
263 //! - \b REF_BUSY if the reference generator is being used, disallowing
264 //! changes to be made to the Ref module controls
265 //! \n indicating the reference generator busy status of the module
266 //
267 //*****************************************************************************
268 extern uint16_t Ref_isRefGenBusy(uint16_t baseAddress);
269 
270 //*****************************************************************************
271 //
272 //! \brief Returns the active status of the reference generator in the Ref
273 //! module.
274 //!
275 //! This function is used to return the active status of the reference
276 //! generator in the Ref module. If the ref generator is on and ready to use,
277 //! then the status will be seen as active.
278 //!
279 //! \param baseAddress is the base address of the REF module.
280 //!
281 //! \return One of the following:
282 //! - \b REF_ACTIVE if active
283 //! - \b REF_INACTIVE if not active
284 //! \n indicating the reference generator active status of the module
285 //
286 //*****************************************************************************
287 extern bool Ref_isRefGenActive(uint16_t baseAddress);
288 
289 //*****************************************************************************
290 //
291 // Mark the end of the C bindings section for C++ compilers.
292 //
293 //*****************************************************************************
294 #ifdef __cplusplus
295 }
296 #endif
297 
298 #endif
299 #endif // __MSP430WARE_REF_H__
void Ref_enableTempSensor(uint16_t baseAddress)
Enables the internal temperature sensor.
Definition: ref.c:33
void Ref_enableReferenceVoltageOutput(uint16_t baseAddress)
Outputs the reference voltage to an output pin.
Definition: ref.c:38
bool Ref_isBandgapActive(uint16_t baseAddress)
Returns the active status of the bandgap in the Ref module.
Definition: ref.c:63
void Ref_setReferenceVoltage(uint16_t baseAddress, uint8_t referenceVoltageSelect)
Sets the reference voltage for the voltage generator.
Definition: ref.c:21
uint16_t Ref_getBandgapMode(uint16_t baseAddress)
Returns the bandgap mode of the Ref module.
Definition: ref.c:58
bool Ref_isRefGenActive(uint16_t baseAddress)
Returns the active status of the reference generator in the Ref module.
Definition: ref.c:77
uint16_t Ref_isRefGenBusy(uint16_t baseAddress)
Returns the busy status of the reference generator in the Ref module.
Definition: ref.c:72
void Ref_disableReferenceVoltageOutput(uint16_t baseAddress)
Disables the reference voltage as an output to a pin.
Definition: ref.c:43
void Ref_disableTempSensor(uint16_t baseAddress)
Disables the internal temperature sensor to save power consumption.
Definition: ref.c:28
void Ref_disableReferenceVoltage(uint16_t baseAddress)
Disables the reference voltage.
Definition: ref.c:53
void Ref_enableReferenceVoltage(uint16_t baseAddress)
Enables the reference voltage to be used by peripherals.
Definition: ref.c:48

Copyright 2020, Texas Instruments Incorporated