MSP430 DriverLib for MSP430F5xx_6xx Devices  2.10.00.09
 All Data Structures Functions Variables Modules Pages
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. Please note, if the Ref_isRefGenBusy() returns Ref_BUSY, this
140 //! function will have no effect.
141 //!
142 //! \param baseAddress is the base address of the REF module.
143 //!
144 //! Modified bits are \b REFOUT of \b REFCTL0 register.
145 //!
146 //! \return None
147 //
148 //*****************************************************************************
149 extern void Ref_enableReferenceVoltageOutput(uint16_t baseAddress);
150 
151 //*****************************************************************************
152 //
153 //! \brief Disables the reference voltage as an output to a pin.
154 //!
155 //! This function is used to disables the reference voltage being generated to
156 //! be given to an output pin. Please note, if the Ref_isRefGenBusy() returns
157 //! Ref_BUSY, this function will have no effect.
158 //!
159 //! \param baseAddress is the base address of the REF module.
160 //!
161 //! Modified bits are \b REFOUT of \b REFCTL0 register.
162 //!
163 //! \return None
164 //
165 //*****************************************************************************
166 extern void Ref_disableReferenceVoltageOutput(uint16_t baseAddress);
167 
168 //*****************************************************************************
169 //
170 //! \brief Enables the reference voltage to be used by peripherals.
171 //!
172 //! This function is used to enable the generated reference voltage to be used
173 //! other peripherals or by an output pin, if enabled. Please note, that giving
174 //! ADC12 module control over the Ref module, the state of the reference
175 //! voltage is dependent on the controls of the ADC12 module. Please note, if
176 //! the Ref_isRefGenBusy() returns Ref_BUSY, this function will have no effect.
177 //!
178 //! \param baseAddress is the base address of the REF module.
179 //!
180 //! Modified bits are \b REFON of \b REFCTL0 register.
181 //!
182 //! \return None
183 //
184 //*****************************************************************************
185 extern void Ref_enableReferenceVoltage(uint16_t baseAddress);
186 
187 //*****************************************************************************
188 //
189 //! \brief Disables the reference voltage.
190 //!
191 //! This function is used to disable the generated reference voltage. Please
192 //! note, if the Ref_isRefGenBusy() returns Ref_BUSY, this function will have
193 //! no effect.
194 //!
195 //! \param baseAddress is the base address of the REF module.
196 //!
197 //! Modified bits are \b REFON of \b REFCTL0 register.
198 //!
199 //! \return None
200 //
201 //*****************************************************************************
202 extern void Ref_disableReferenceVoltage(uint16_t baseAddress);
203 
204 //*****************************************************************************
205 //
206 //! \brief Returns the bandgap mode of the Ref module.
207 //!
208 //! This function is used to return the bandgap mode of the Ref module,
209 //! requested by the peripherals using the bandgap. If a peripheral requests
210 //! static mode, then the bandgap mode will be static for all modules, whereas
211 //! if all of the peripherals using the bandgap request sample mode, then that
212 //! will be the mode returned. Sample mode allows the bandgap to be active only
213 //! when necessary to save on power consumption, static mode requires the
214 //! bandgap to be active until no peripherals are using it anymore.
215 //!
216 //! \param baseAddress is the base address of the REF module.
217 //!
218 //! \return One of the following:
219 //! - \b Ref_STATICMODE if the bandgap is operating in static mode
220 //! - \b Ref_SAMPLEMODE if the bandgap is operating in sample mode
221 //! \n indicating the bandgap mode of the module
222 //
223 //*****************************************************************************
224 extern uint16_t Ref_getBandgapMode(uint16_t baseAddress);
225 
226 //*****************************************************************************
227 //
228 //! \brief Returns the active status of the bandgap in the Ref module.
229 //!
230 //! This function is used to return the active status of the bandgap in the Ref
231 //! module. If the bandgap is in use by a peripheral, then the status will be
232 //! seen as active.
233 //!
234 //! \param baseAddress is the base address of the REF module.
235 //!
236 //! \return One of the following:
237 //! - \b Ref_ACTIVE if active
238 //! - \b Ref_INACTIVE if not active
239 //! \n indicating the bandgap active status of the module
240 //
241 //*****************************************************************************
242 extern bool Ref_isBandgapActive(uint16_t baseAddress);
243 
244 //*****************************************************************************
245 //
246 //! \brief Returns the busy status of the reference generator in the Ref
247 //! module.
248 //!
249 //! This function is used to return the busy status of the reference generator
250 //! in the Ref module. If the ref generator is in use by a peripheral, then the
251 //! status will be seen as busy.
252 //!
253 //! \param baseAddress is the base address of the REF module.
254 //!
255 //! \return One of the following:
256 //! - \b Ref_NOTBUSY if the reference generator is not being used
257 //! - \b Ref_BUSY if the reference generator is being used, disallowing
258 //! changes to be made to the Ref module controls
259 //! \n indicating the reference generator busy status of the module
260 //
261 //*****************************************************************************
262 extern uint16_t Ref_isRefGenBusy(uint16_t baseAddress);
263 
264 //*****************************************************************************
265 //
266 //! \brief Returns the active status of the reference generator in the Ref
267 //! module.
268 //!
269 //! This function is used to return the active status of the reference
270 //! generator in the Ref module. If the ref generator is on and ready to use,
271 //! then the status will be seen as active.
272 //!
273 //! \param baseAddress is the base address of the REF module.
274 //!
275 //! \return One of the following:
276 //! - \b Ref_ACTIVE if active
277 //! - \b Ref_INACTIVE if not active
278 //! \n indicating the reference generator active status of the module
279 //
280 //*****************************************************************************
281 extern bool Ref_isRefGenActive(uint16_t baseAddress);
282 
283 //*****************************************************************************
284 //
285 // Mark the end of the C bindings section for C++ compilers.
286 //
287 //*****************************************************************************
288 #ifdef __cplusplus
289 }
290 #endif
291 
292 #endif
293 #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 2015, Texas Instruments Incorporated