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 // comp_e.h - Driver for the COMP_E Module.
\r
36 //*****************************************************************************
\r
38 #ifndef __MSP430WARE_COMP_E_H__
\r
39 #define __MSP430WARE_COMP_E_H__
\r
41 #include "inc/hw_memmap.h"
\r
43 #ifdef __MSP430_HAS_COMP_E__
\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 #include "inc/hw_regaccess.h"
\r
57 //*****************************************************************************
\r
59 //! \brief Used in the Comp_E_init() function as the param parameter.
\r
61 //*****************************************************************************
\r
62 typedef struct Comp_E_initParam
\r
64 //! Selects the input to the positive terminal.
\r
65 //! \n Valid values are:
\r
66 //! - \b COMP_E_INPUT0 [Default]
\r
67 //! - \b COMP_E_INPUT1
\r
68 //! - \b COMP_E_INPUT2
\r
69 //! - \b COMP_E_INPUT3
\r
70 //! - \b COMP_E_INPUT4
\r
71 //! - \b COMP_E_INPUT5
\r
72 //! - \b COMP_E_INPUT6
\r
73 //! - \b COMP_E_INPUT7
\r
74 //! - \b COMP_E_INPUT8
\r
75 //! - \b COMP_E_INPUT9
\r
76 //! - \b COMP_E_INPUT10
\r
77 //! - \b COMP_E_INPUT11
\r
78 //! - \b COMP_E_INPUT12
\r
79 //! - \b COMP_E_INPUT13
\r
80 //! - \b COMP_E_INPUT14
\r
81 //! - \b COMP_E_INPUT15
\r
82 //! - \b COMP_E_VREF
\r
83 uint16_t posTerminalInput;
\r
84 //! Selects the input to the negative terminal.
\r
85 //! \n Valid values are:
\r
86 //! - \b COMP_E_INPUT0 [Default]
\r
87 //! - \b COMP_E_INPUT1
\r
88 //! - \b COMP_E_INPUT2
\r
89 //! - \b COMP_E_INPUT3
\r
90 //! - \b COMP_E_INPUT4
\r
91 //! - \b COMP_E_INPUT5
\r
92 //! - \b COMP_E_INPUT6
\r
93 //! - \b COMP_E_INPUT7
\r
94 //! - \b COMP_E_INPUT8
\r
95 //! - \b COMP_E_INPUT9
\r
96 //! - \b COMP_E_INPUT10
\r
97 //! - \b COMP_E_INPUT11
\r
98 //! - \b COMP_E_INPUT12
\r
99 //! - \b COMP_E_INPUT13
\r
100 //! - \b COMP_E_INPUT14
\r
101 //! - \b COMP_E_INPUT15
\r
102 //! - \b COMP_E_VREF
\r
103 uint16_t negTerminalInput;
\r
104 //! Controls the output filter delay state, which is either off or enabled
\r
105 //! with a specified delay level. This parameter is device specific and
\r
106 //! delay levels should be found in the device's datasheet.
\r
107 //! \n Valid values are:
\r
108 //! - \b COMP_E_FILTEROUTPUT_OFF [Default]
\r
109 //! - \b COMP_E_FILTEROUTPUT_DLYLVL1
\r
110 //! - \b COMP_E_FILTEROUTPUT_DLYLVL2
\r
111 //! - \b COMP_E_FILTEROUTPUT_DLYLVL3
\r
112 //! - \b COMP_E_FILTEROUTPUT_DLYLVL4
\r
113 uint8_t outputFilterEnableAndDelayLevel;
\r
114 //! Controls if the output will be inverted or not
\r
115 //! \n Valid values are:
\r
116 //! - \b COMP_E_NORMALOUTPUTPOLARITY
\r
117 //! - \b COMP_E_INVERTEDOUTPUTPOLARITY
\r
118 uint16_t invertedOutputPolarity;
\r
119 } Comp_E_initParam;
\r
121 //*****************************************************************************
\r
123 // The following are values that can be passed to the
\r
124 // outputFilterEnableAndDelayLevel parameter for functions: Comp_E_init(); the
\r
125 // param parameter for functions: Comp_E_init().
\r
127 //*****************************************************************************
\r
128 #define COMP_E_FILTEROUTPUT_OFF 0x00
\r
129 #define COMP_E_FILTEROUTPUT_DLYLVL1 (CEF + CEFDLY_0)
\r
130 #define COMP_E_FILTEROUTPUT_DLYLVL2 (CEF + CEFDLY_1)
\r
131 #define COMP_E_FILTEROUTPUT_DLYLVL3 (CEF + CEFDLY_2)
\r
132 #define COMP_E_FILTEROUTPUT_DLYLVL4 (CEF + CEFDLY_3)
\r
134 //*****************************************************************************
\r
136 // The following are values that can be passed to the posTerminalInput
\r
137 // parameter for functions: Comp_E_init(); the inputPort parameter for
\r
138 // functions: Comp_E_disableInputBuffer(), and Comp_E_enableInputBuffer(); the
\r
139 // param parameter for functions: Comp_E_init(), and Comp_E_init(); the
\r
140 // negTerminalInput parameter for functions: Comp_E_init().
\r
142 //*****************************************************************************
\r
143 #define COMP_E_INPUT0 (0x01)
\r
144 #define COMP_E_INPUT1 (0x02)
\r
145 #define COMP_E_INPUT2 (0x04)
\r
146 #define COMP_E_INPUT3 (0x08)
\r
147 #define COMP_E_INPUT4 (0x10)
\r
148 #define COMP_E_INPUT5 (0x20)
\r
149 #define COMP_E_INPUT6 (0x40)
\r
150 #define COMP_E_INPUT7 (0x80)
\r
151 #define COMP_E_INPUT8 (0x100)
\r
152 #define COMP_E_INPUT9 (0x200)
\r
153 #define COMP_E_INPUT10 (0x400)
\r
154 #define COMP_E_INPUT11 (0x800)
\r
155 #define COMP_E_INPUT12 (0x1000)
\r
156 #define COMP_E_INPUT13 (0x2000)
\r
157 #define COMP_E_INPUT14 (0x4000)
\r
158 #define COMP_E_INPUT15 (0x8000)
\r
159 #define COMP_E_VREF (0x9F)
\r
161 //*****************************************************************************
\r
163 // The following are values that can be passed to the invertedOutputPolarity
\r
164 // parameter for functions: Comp_E_init(); the param parameter for functions:
\r
167 //*****************************************************************************
\r
168 #define COMP_E_NORMALOUTPUTPOLARITY (!(CEOUTPOL))
\r
169 #define COMP_E_INVERTEDOUTPUTPOLARITY (CEOUTPOL)
\r
171 //*****************************************************************************
\r
173 // The following are values that can be passed to the
\r
174 // supplyVoltageReferenceBase parameter for functions:
\r
175 // Comp_E_setReferenceVoltage().
\r
177 //*****************************************************************************
\r
178 #define COMP_E_REFERENCE_AMPLIFIER_DISABLED (CEREFL_0)
\r
179 #define COMP_E_VREFBASE1_2V (CEREFL_1)
\r
180 #define COMP_E_VREFBASE2_0V (CEREFL_2)
\r
181 #define COMP_E_VREFBASE2_5V (CEREFL_3)
\r
183 //*****************************************************************************
\r
185 // The following are values that can be passed to the referenceAccuracy
\r
186 // parameter for functions: Comp_E_setReferenceAccuracy().
\r
188 //*****************************************************************************
\r
189 #define COMP_E_ACCURACY_STATIC (!CEREFACC)
\r
190 #define COMP_E_ACCURACY_CLOCKED (CEREFACC)
\r
192 //*****************************************************************************
\r
194 // The following are values that can be passed to the powerMode parameter for
\r
195 // functions: Comp_E_setPowerMode().
\r
197 //*****************************************************************************
\r
198 #define COMP_E_HIGH_SPEED_MODE (CEPWRMD_0)
\r
199 #define COMP_E_NORMAL_MODE (CEPWRMD_1)
\r
200 #define COMP_E_ULTRA_LOW_POWER_MODE (CEPWRMD_2)
\r
202 //*****************************************************************************
\r
204 // The following are values that can be passed to the interruptMask parameter
\r
205 // for functions: Comp_E_enableInterrupt(), and Comp_E_disableInterrupt().
\r
207 //*****************************************************************************
\r
208 #define COMP_E_OUTPUT_INTERRUPT (CEIE)
\r
209 #define COMP_E_INVERTED_POLARITY_INTERRUPT (CEIIE)
\r
210 #define COMP_E_READY_INTERRUPT (CERDYIE)
\r
212 //*****************************************************************************
\r
214 // The following are values that can be passed to the interruptFlagMask
\r
215 // parameter for functions: Comp_E_clearInterrupt(), and
\r
216 // Comp_E_getInterruptStatus() as well as returned by the
\r
217 // Comp_E_getInterruptStatus() function.
\r
219 //*****************************************************************************
\r
220 #define COMP_E_OUTPUT_INTERRUPT_FLAG (CEIFG)
\r
221 #define COMP_E_INTERRUPT_FLAG_INVERTED_POLARITY (CEIIFG)
\r
222 #define COMP_E_INTERRUPT_FLAG_READY (CERDYIFG)
\r
224 //*****************************************************************************
\r
226 // The following are values that can be passed to the edgeDirection parameter
\r
227 // for functions: Comp_E_setInterruptEdgeDirection().
\r
229 //*****************************************************************************
\r
230 #define COMP_E_FALLINGEDGE (!(CEIES))
\r
231 #define COMP_E_RISINGEDGE (CEIES)
\r
233 //*****************************************************************************
\r
235 // The following are values that can be passed toThe following are values that
\r
236 // can be returned by the Comp_E_outputValue() function.
\r
238 //*****************************************************************************
\r
239 #define COMP_E_LOW (0x0)
\r
240 #define COMP_E_HIGH (CEOUT)
\r
242 //*****************************************************************************
\r
244 // Prototypes for the APIs.
\r
246 //*****************************************************************************
\r
248 //*****************************************************************************
\r
250 //! \brief Initializes the Comp_E Module.
\r
252 //! Upon successful initialization of the Comp_E module, this function will
\r
253 //! have reset all necessary register bits and set the given options in the
\r
254 //! registers. To actually use the Comp_E module, the Comp_E_enable() function
\r
255 //! must be explicitly called before use. If a Reference Voltage is set to a
\r
256 //! terminal, the Voltage should be set using the setReferenceVoltage()
\r
259 //! \param baseAddress is the base address of the COMP_E module.
\r
260 //! \param param is the pointer to struct for initialization.
\r
262 //! \return STATUS_SUCCESS or STATUS_FAILURE of the initialization process
\r
264 //*****************************************************************************
\r
265 extern bool Comp_E_init(uint16_t baseAddress,
\r
266 Comp_E_initParam *param);
\r
268 //*****************************************************************************
\r
270 //! \brief Generates a Reference Voltage to the terminal selected during
\r
271 //! initialization.
\r
273 //! Use this function to generate a voltage to serve as a reference to the
\r
274 //! terminal selected at initialization. The voltage is determined by the
\r
275 //! equation: Vbase * (Numerator / 32). If the upper and lower limit voltage
\r
276 //! numerators are equal, then a static reference is defined, whereas they are
\r
277 //! different then a hysteresis effect is generated.
\r
279 //! \param baseAddress is the base address of the COMP_E module.
\r
280 //! \param supplyVoltageReferenceBase decides the source and max amount of
\r
281 //! Voltage that can be used as a reference.
\r
282 //! Valid values are:
\r
283 //! - \b COMP_E_REFERENCE_AMPLIFIER_DISABLED
\r
284 //! - \b COMP_E_VREFBASE1_2V
\r
285 //! - \b COMP_E_VREFBASE2_0V
\r
286 //! - \b COMP_E_VREFBASE2_5V
\r
287 //! \n Modified bits are \b CEREFL of \b CECTL2 register.
\r
288 //! \param lowerLimitSupplyVoltageFractionOf32 is the numerator of the equation
\r
289 //! to generate the reference voltage for the lower limit reference
\r
291 //! \n Modified bits are \b CEREF0 of \b CECTL2 register.
\r
292 //! \param upperLimitSupplyVoltageFractionOf32 is the numerator of the equation
\r
293 //! to generate the reference voltage for the upper limit reference
\r
295 //! \n Modified bits are \b CEREF1 of \b CECTL2 register.
\r
299 //*****************************************************************************
\r
300 extern void Comp_E_setReferenceVoltage(uint16_t baseAddress,
\r
301 uint16_t supplyVoltageReferenceBase,
\r
302 uint16_t lowerLimitSupplyVoltageFractionOf32,
\r
303 uint16_t upperLimitSupplyVoltageFractionOf32);
\r
305 //*****************************************************************************
\r
307 //! \brief Sets the reference accuracy
\r
309 //! The reference accuracy is set to the desired setting. Clocked is better for
\r
310 //! low power operations but has a lower accuracy.
\r
312 //! \param baseAddress is the base address of the COMP_E module.
\r
313 //! \param referenceAccuracy is the reference accuracy setting of the COMP_E.
\r
314 //! Valid values are:
\r
315 //! - \b COMP_E_ACCURACY_STATIC
\r
316 //! - \b COMP_E_ACCURACY_CLOCKED - for low power / low accuracy
\r
317 //! \n Modified bits are \b CEREFACC of \b CECTL2 register.
\r
321 //*****************************************************************************
\r
322 extern void Comp_E_setReferenceAccuracy(uint16_t baseAddress,
\r
323 uint16_t referenceAccuracy);
\r
325 //*****************************************************************************
\r
327 //! \brief Sets the power mode
\r
329 //! \param baseAddress is the base address of the COMP_E module.
\r
330 //! \param powerMode decides the power mode
\r
331 //! Valid values are:
\r
332 //! - \b COMP_E_HIGH_SPEED_MODE
\r
333 //! - \b COMP_E_NORMAL_MODE
\r
334 //! - \b COMP_E_ULTRA_LOW_POWER_MODE
\r
335 //! \n Modified bits are \b CEPWRMD of \b CECTL1 register.
\r
339 //*****************************************************************************
\r
340 extern void Comp_E_setPowerMode(uint16_t baseAddress,
\r
341 uint16_t powerMode);
\r
343 //*****************************************************************************
\r
345 //! \brief Enables selected Comp_E interrupt sources.
\r
347 //! Enables the indicated Comp_E interrupt sources. Only the sources that are
\r
348 //! enabled can be reflected to the processor interrupt; disabled sources have
\r
349 //! no effect on the processor. <b>Does not clear interrupt flags.</b>
\r
351 //! \param baseAddress is the base address of the COMP_E module.
\r
352 //! \param interruptMask
\r
353 //! Mask value is the logical OR of any of the following:
\r
354 //! - \b COMP_E_OUTPUT_INTERRUPT - Output interrupt
\r
355 //! - \b COMP_E_INVERTED_POLARITY_INTERRUPT - Output interrupt inverted
\r
357 //! - \b COMP_E_READY_INTERRUPT - Ready interrupt
\r
361 //*****************************************************************************
\r
362 extern void Comp_E_enableInterrupt(uint16_t baseAddress,
\r
363 uint16_t interruptMask);
\r
365 //*****************************************************************************
\r
367 //! \brief Disables selected Comp_E interrupt sources.
\r
369 //! Disables the indicated Comp_E interrupt sources. Only the sources that are
\r
370 //! enabled can be reflected to the processor interrupt; disabled sources have
\r
371 //! no effect on the processor.
\r
373 //! \param baseAddress is the base address of the COMP_E module.
\r
374 //! \param interruptMask
\r
375 //! Mask value is the logical OR of any of the following:
\r
376 //! - \b COMP_E_OUTPUT_INTERRUPT - Output interrupt
\r
377 //! - \b COMP_E_INVERTED_POLARITY_INTERRUPT - Output interrupt inverted
\r
379 //! - \b COMP_E_READY_INTERRUPT - Ready interrupt
\r
383 //*****************************************************************************
\r
384 extern void Comp_E_disableInterrupt(uint16_t baseAddress,
\r
385 uint16_t interruptMask);
\r
387 //*****************************************************************************
\r
389 //! \brief Clears Comp_E interrupt flags.
\r
391 //! The Comp_E interrupt source is cleared, so that it no longer asserts. The
\r
392 //! highest interrupt flag is automatically cleared when an interrupt vector
\r
393 //! generator is used.
\r
395 //! \param baseAddress is the base address of the COMP_E module.
\r
396 //! \param interruptFlagMask
\r
397 //! Mask value is the logical OR of any of the following:
\r
398 //! - \b COMP_E_OUTPUT_INTERRUPT_FLAG - Output interrupt flag
\r
399 //! - \b COMP_E_INTERRUPT_FLAG_INVERTED_POLARITY - Output interrupt flag
\r
400 //! inverted polarity
\r
401 //! - \b COMP_E_INTERRUPT_FLAG_READY - Ready interrupt flag
\r
405 //*****************************************************************************
\r
406 extern void Comp_E_clearInterrupt(uint16_t baseAddress,
\r
407 uint16_t interruptFlagMask);
\r
409 //*****************************************************************************
\r
411 //! \brief Gets the current Comp_E interrupt status.
\r
413 //! This returns the interrupt status for the Comp_E module based on which flag
\r
416 //! \param baseAddress is the base address of the COMP_E module.
\r
417 //! \param interruptFlagMask
\r
418 //! Mask value is the logical OR of any of the following:
\r
419 //! - \b COMP_E_OUTPUT_INTERRUPT_FLAG - Output interrupt flag
\r
420 //! - \b COMP_E_INTERRUPT_FLAG_INVERTED_POLARITY - Output interrupt flag
\r
421 //! inverted polarity
\r
422 //! - \b COMP_E_INTERRUPT_FLAG_READY - Ready interrupt flag
\r
424 //! \return Logical OR of any of the following:
\r
425 //! - \b Comp_E_OUTPUT_INTERRUPT_FLAG Output interrupt flag
\r
426 //! - \b Comp_E_INTERRUPT_FLAG_INVERTED_POLARITY Output interrupt flag
\r
427 //! inverted polarity
\r
428 //! - \b Comp_E_INTERRUPT_FLAG_READY Ready interrupt flag
\r
429 //! \n indicating the status of the masked flags
\r
431 //*****************************************************************************
\r
432 extern uint8_t Comp_E_getInterruptStatus(uint16_t baseAddress,
\r
433 uint16_t interruptFlagMask);
\r
435 //*****************************************************************************
\r
437 //! \brief Explicitly sets the edge direction that would trigger an interrupt.
\r
439 //! This function will set which direction the output will have to go, whether
\r
440 //! rising or falling, to generate an interrupt based on a non-inverted
\r
443 //! \param baseAddress is the base address of the COMP_E module.
\r
444 //! \param edgeDirection determines which direction the edge would have to go
\r
445 //! to generate an interrupt based on the non-inverted interrupt flag.
\r
446 //! Valid values are:
\r
447 //! - \b COMP_E_FALLINGEDGE [Default] - sets the bit to generate an
\r
448 //! interrupt when the output of the Comp_E falls from HIGH to LOW if
\r
449 //! the normal interrupt bit is set(and LOW to HIGH if the inverted
\r
450 //! interrupt enable bit is set).
\r
451 //! - \b COMP_E_RISINGEDGE - sets the bit to generate an interrupt when
\r
452 //! the output of the Comp_E rises from LOW to HIGH if the normal
\r
453 //! interrupt bit is set(and HIGH to LOW if the inverted interrupt
\r
454 //! enable bit is set).
\r
455 //! \n Modified bits are \b CEIES of \b CECTL1 register.
\r
459 //*****************************************************************************
\r
460 extern void Comp_E_setInterruptEdgeDirection(uint16_t baseAddress,
\r
461 uint16_t edgeDirection);
\r
463 //*****************************************************************************
\r
465 //! \brief Toggles the edge direction that would trigger an interrupt.
\r
467 //! This function will toggle which direction the output will have to go,
\r
468 //! whether rising or falling, to generate an interrupt based on a non-inverted
\r
469 //! interrupt. If the direction was rising, it is now falling, if it was
\r
470 //! falling, it is now rising.
\r
472 //! \param baseAddress is the base address of the COMP_E module.
\r
474 //! Modified bits are \b CEIES of \b CECTL1 register.
\r
478 //*****************************************************************************
\r
479 extern void Comp_E_toggleInterruptEdgeDirection(uint16_t baseAddress);
\r
481 //*****************************************************************************
\r
483 //! \brief Turns on the Comp_E module.
\r
485 //! This function sets the bit that enables the operation of the Comp_E module.
\r
487 //! \param baseAddress is the base address of the COMP_E module.
\r
491 //*****************************************************************************
\r
492 extern void Comp_E_enable(uint16_t baseAddress);
\r
494 //*****************************************************************************
\r
496 //! \brief Turns off the Comp_E module.
\r
498 //! This function clears the CEON bit disabling the operation of the Comp_E
\r
499 //! module, saving from excess power consumption.
\r
501 //! \param baseAddress is the base address of the COMP_E module.
\r
503 //! Modified bits are \b CEON of \b CECTL1 register.
\r
507 //*****************************************************************************
\r
508 extern void Comp_E_disable(uint16_t baseAddress);
\r
510 //*****************************************************************************
\r
512 //! \brief Shorts the two input pins chosen during initialization.
\r
514 //! This function sets the bit that shorts the devices attached to the input
\r
515 //! pins chosen from the initialization of the Comp_E.
\r
517 //! \param baseAddress is the base address of the COMP_E module.
\r
519 //! Modified bits are \b CESHORT of \b CECTL1 register.
\r
523 //*****************************************************************************
\r
524 extern void Comp_E_shortInputs(uint16_t baseAddress);
\r
526 //*****************************************************************************
\r
528 //! \brief Disables the short of the two input pins chosen during
\r
529 //! initialization.
\r
531 //! This function clears the bit that shorts the devices attached to the input
\r
532 //! pins chosen from the initialization of the Comp_E.
\r
534 //! \param baseAddress is the base address of the COMP_E module.
\r
536 //! Modified bits are \b CESHORT of \b CECTL1 register.
\r
540 //*****************************************************************************
\r
541 extern void Comp_E_unshortInputs(uint16_t baseAddress);
\r
543 //*****************************************************************************
\r
545 //! \brief Disables the input buffer of the selected input port to effectively
\r
546 //! allow for analog signals.
\r
548 //! This function sets the bit to disable the buffer for the specified input
\r
549 //! port to allow for analog signals from any of the Comp_E input pins. This
\r
550 //! bit is automatically set when the input is initialized to be used with the
\r
551 //! Comp_E module. This function should be used whenever an analog input is
\r
552 //! connected to one of these pins to prevent parasitic voltage from causing
\r
553 //! unexpected results.
\r
555 //! \param baseAddress is the base address of the COMP_E module.
\r
556 //! \param inputPort is the port in which the input buffer will be disabled.
\r
557 //! Mask value is the logical OR of any of the following:
\r
558 //! - \b COMP_E_INPUT0 [Default]
\r
559 //! - \b COMP_E_INPUT1
\r
560 //! - \b COMP_E_INPUT2
\r
561 //! - \b COMP_E_INPUT3
\r
562 //! - \b COMP_E_INPUT4
\r
563 //! - \b COMP_E_INPUT5
\r
564 //! - \b COMP_E_INPUT6
\r
565 //! - \b COMP_E_INPUT7
\r
566 //! - \b COMP_E_INPUT8
\r
567 //! - \b COMP_E_INPUT9
\r
568 //! - \b COMP_E_INPUT10
\r
569 //! - \b COMP_E_INPUT11
\r
570 //! - \b COMP_E_INPUT12
\r
571 //! - \b COMP_E_INPUT13
\r
572 //! - \b COMP_E_INPUT14
\r
573 //! - \b COMP_E_INPUT15
\r
574 //! - \b COMP_E_VREF
\r
575 //! \n Modified bits are \b CEPDx of \b CECTL3 register.
\r
579 //*****************************************************************************
\r
580 extern void Comp_E_disableInputBuffer(uint16_t baseAddress,
\r
581 uint16_t inputPort);
\r
583 //*****************************************************************************
\r
585 //! \brief Enables the input buffer of the selected input port to allow for
\r
586 //! digital signals.
\r
588 //! This function clears the bit to enable the buffer for the specified input
\r
589 //! port to allow for digital signals from any of the Comp_E input pins. This
\r
590 //! should not be reset if there is an analog signal connected to the specified
\r
591 //! input pin to prevent from unexpected results.
\r
593 //! \param baseAddress is the base address of the COMP_E module.
\r
594 //! \param inputPort is the port in which the input buffer will be enabled.
\r
595 //! Mask value is the logical OR of any of the following:
\r
596 //! - \b COMP_E_INPUT0 [Default]
\r
597 //! - \b COMP_E_INPUT1
\r
598 //! - \b COMP_E_INPUT2
\r
599 //! - \b COMP_E_INPUT3
\r
600 //! - \b COMP_E_INPUT4
\r
601 //! - \b COMP_E_INPUT5
\r
602 //! - \b COMP_E_INPUT6
\r
603 //! - \b COMP_E_INPUT7
\r
604 //! - \b COMP_E_INPUT8
\r
605 //! - \b COMP_E_INPUT9
\r
606 //! - \b COMP_E_INPUT10
\r
607 //! - \b COMP_E_INPUT11
\r
608 //! - \b COMP_E_INPUT12
\r
609 //! - \b COMP_E_INPUT13
\r
610 //! - \b COMP_E_INPUT14
\r
611 //! - \b COMP_E_INPUT15
\r
612 //! - \b COMP_E_VREF
\r
613 //! \n Modified bits are \b CEPDx of \b CECTL3 register.
\r
617 //*****************************************************************************
\r
618 extern void Comp_E_enableInputBuffer(uint16_t baseAddress,
\r
619 uint16_t inputPort);
\r
621 //*****************************************************************************
\r
623 //! \brief Toggles the bit that swaps which terminals the inputs go to, while
\r
624 //! also inverting the output of the Comp_E.
\r
626 //! This function toggles the bit that controls which input goes to which
\r
627 //! terminal. After initialization, this bit is set to 0, after toggling it
\r
628 //! once the inputs are routed to the opposite terminal and the output is
\r
631 //! \param baseAddress is the base address of the COMP_E module.
\r
635 //*****************************************************************************
\r
636 extern void Comp_E_swapIO(uint16_t baseAddress);
\r
638 //*****************************************************************************
\r
640 //! \brief Returns the output value of the Comp_E module.
\r
642 //! Returns the output value of the Comp_E module.
\r
644 //! \param baseAddress is the base address of the COMP_E module.
\r
646 //! \return One of the following:
\r
647 //! - \b Comp_E_LOW
\r
648 //! - \b Comp_E_HIGH
\r
649 //! \n indicating the output value of the Comp_E module
\r
651 //*****************************************************************************
\r
652 extern uint16_t Comp_E_outputValue(uint16_t baseAddress);
\r
654 //*****************************************************************************
\r
656 // Mark the end of the C bindings section for C++ compilers.
\r
658 //*****************************************************************************
\r
664 #endif // __MSP430WARE_COMP_E_H__
\r