MSP430 DriverLib for MSP430F5xx_6xx Devices  2.91.13.01
comp_b.h
1 //*****************************************************************************
2 //
3 // comp_b.h - Driver for the COMP_B Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_COMP_B_H__
8 #define __MSP430WARE_COMP_B_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_COMPB__
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 #include "inc/hw_memmap.h"
26 //*****************************************************************************
27 //
28 //! \brief Used in the Comp_B_init() function as the param parameter.
29 //
30 //*****************************************************************************
31 typedef struct Comp_B_initParam {
32  //! Selects the input to the positive terminal.
33  //! \n Valid values are:
34  //! - \b COMP_B_INPUT0 [Default]
35  //! - \b COMP_B_INPUT1
36  //! - \b COMP_B_INPUT2
37  //! - \b COMP_B_INPUT3
38  //! - \b COMP_B_INPUT4
39  //! - \b COMP_B_INPUT5
40  //! - \b COMP_B_INPUT6
41  //! - \b COMP_B_INPUT7
42  //! - \b COMP_B_INPUT8
43  //! - \b COMP_B_INPUT9
44  //! - \b COMP_B_INPUT10
45  //! - \b COMP_B_INPUT11
46  //! - \b COMP_B_INPUT12
47  //! - \b COMP_B_INPUT13
48  //! - \b COMP_B_INPUT14
49  //! - \b COMP_B_INPUT15
50  //! - \b COMP_B_VREF
52  //! Selects the input to the negative terminal.
53  //! \n Valid values are:
54  //! - \b COMP_B_INPUT0 [Default]
55  //! - \b COMP_B_INPUT1
56  //! - \b COMP_B_INPUT2
57  //! - \b COMP_B_INPUT3
58  //! - \b COMP_B_INPUT4
59  //! - \b COMP_B_INPUT5
60  //! - \b COMP_B_INPUT6
61  //! - \b COMP_B_INPUT7
62  //! - \b COMP_B_INPUT8
63  //! - \b COMP_B_INPUT9
64  //! - \b COMP_B_INPUT10
65  //! - \b COMP_B_INPUT11
66  //! - \b COMP_B_INPUT12
67  //! - \b COMP_B_INPUT13
68  //! - \b COMP_B_INPUT14
69  //! - \b COMP_B_INPUT15
70  //! - \b COMP_B_VREF
72  //! Selects the power mode at which the Comp_B module will operate at.
73  //! \n Valid values are:
74  //! - \b COMP_B_POWERMODE_HIGHSPEED [Default]
75  //! - \b COMP_B_POWERMODE_NORMALMODE
76  //! - \b COMP_B_POWERMODE_ULTRALOWPOWER
77  uint16_t powerModeSelect;
78  //! Controls the output filter delay state, which is either off or enabled
79  //! with a specified delay level. This parameter is device specific and
80  //! delay levels should be found in the device's datasheet.
81  //! \n Valid values are:
82  //! - \b COMP_B_FILTEROUTPUT_OFF [Default]
83  //! - \b COMP_B_FILTEROUTPUT_DLYLVL1
84  //! - \b COMP_B_FILTEROUTPUT_DLYLVL2
85  //! - \b COMP_B_FILTEROUTPUT_DLYLVL3
86  //! - \b COMP_B_FILTEROUTPUT_DLYLVL4
88  //! Controls if the output will be inverted or not
89  //! \n Valid values are:
90  //! - \b COMP_B_NORMALOUTPUTPOLARITY [Default]
91  //! - \b COMP_B_INVERTEDOUTPUTPOLARITY
94 
95 //*****************************************************************************
96 //
97 //! \brief Used in the Comp_B_configureReferenceVoltage() function as the param
98 //! parameter.
99 //
100 //*****************************************************************************
102  //! Decides the source and max amount of Voltage that can be used as a
103  //! reference.
104  //! \n Valid values are:
105  //! - \b COMP_B_VREFBASE_VCC
106  //! - \b COMP_B_VREFBASE1_5V
107  //! - \b COMP_B_VREFBASE2_0V
108  //! - \b COMP_B_VREFBASE2_5V
110  //! Is the numerator of the equation to generate the reference voltage for
111  //! the lower limit reference voltage.
113  //! Is the numerator of the equation to generate the reference voltage for
114  //! the upper limit reference voltage.
116  //! is the reference accuracy setting of the Comp_B. Clocked is for low
117  //! power/low accuracy.
118  //! \n Valid values are:
119  //! - \b COMP_B_ACCURACY_STATIC
120  //! - \b COMP_B_ACCURACY_CLOCKED
123 
124 
125 //*****************************************************************************
126 //
127 // The following are values that can be passed to the powerModeSelect parameter
128 // for functions: Comp_B_init(); the param parameter for functions:
129 // Comp_B_init().
130 //
131 //*****************************************************************************
132 #define COMP_B_POWERMODE_HIGHSPEED (CBPWRMD_0)
133 #define COMP_B_POWERMODE_NORMALMODE (CBPWRMD_1)
134 #define COMP_B_POWERMODE_ULTRALOWPOWER (CBPWRMD_2)
135 
136 //*****************************************************************************
137 //
138 // The following are values that can be passed to the positiveTerminalInput
139 // parameter for functions: Comp_B_init(); the inputPort parameter for
140 // functions: Comp_B_disableInputBuffer(), and Comp_B_enableInputBuffer(); the
141 // param parameter for functions: Comp_B_init(), and Comp_B_init(); the
142 // negativeTerminalInput parameter for functions: Comp_B_init().
143 //
144 //*****************************************************************************
145 #define COMP_B_INPUT0 (CBIPSEL_0)
146 #define COMP_B_INPUT1 (CBIPSEL_1)
147 #define COMP_B_INPUT2 (CBIPSEL_2)
148 #define COMP_B_INPUT3 (CBIPSEL_3)
149 #define COMP_B_INPUT4 (CBIPSEL_4)
150 #define COMP_B_INPUT5 (CBIPSEL_5)
151 #define COMP_B_INPUT6 (CBIPSEL_6)
152 #define COMP_B_INPUT7 (CBIPSEL_7)
153 #define COMP_B_INPUT8 (CBIPSEL_8)
154 #define COMP_B_INPUT9 (CBIPSEL_9)
155 #define COMP_B_INPUT10 (CBIPSEL_10)
156 #define COMP_B_INPUT11 (CBIPSEL_11)
157 #define COMP_B_INPUT12 (CBIPSEL_12)
158 #define COMP_B_INPUT13 (CBIPSEL_13)
159 #define COMP_B_INPUT14 (CBIPSEL_14)
160 #define COMP_B_INPUT15 (CBIPSEL_15)
161 #define COMP_B_VREF (0x10)
162 
163 //*****************************************************************************
164 //
165 // The following are values that can be passed to the
166 // outputFilterEnableAndDelayLevel parameter for functions: Comp_B_init(); the
167 // param parameter for functions: Comp_B_init().
168 //
169 //*****************************************************************************
170 #define COMP_B_FILTEROUTPUT_OFF 0x00
171 #define COMP_B_FILTEROUTPUT_DLYLVL1 (CBF + CBFDLY_0)
172 #define COMP_B_FILTEROUTPUT_DLYLVL2 (CBF + CBFDLY_1)
173 #define COMP_B_FILTEROUTPUT_DLYLVL3 (CBF + CBFDLY_2)
174 #define COMP_B_FILTEROUTPUT_DLYLVL4 (CBF + CBFDLY_3)
175 
176 //*****************************************************************************
177 //
178 // The following are values that can be passed to the invertedOutputPolarity
179 // parameter for functions: Comp_B_init(); the param parameter for functions:
180 // Comp_B_init().
181 //
182 //*****************************************************************************
183 #define COMP_B_NORMALOUTPUTPOLARITY (!(CBOUTPOL))
184 #define COMP_B_INVERTEDOUTPUTPOLARITY (CBOUTPOL)
185 
186 //*****************************************************************************
187 //
188 // The following are values that can be passed to the param parameter for
189 // functions: Comp_B_configureReferenceVoltage().
190 //
191 //*****************************************************************************
192 #define COMP_B_ACCURACY_STATIC (!CBREFACC)
193 #define COMP_B_ACCURACY_CLOCKED (CBREFACC)
194 
195 //*****************************************************************************
196 //
197 // The following are values that can be passed to the param parameter for
198 // functions: Comp_B_configureReferenceVoltage().
199 //
200 //*****************************************************************************
201 #define COMP_B_VREFBASE_VCC (CBREFL_0)
202 #define COMP_B_VREFBASE1_5V (CBREFL_1)
203 #define COMP_B_VREFBASE2_0V (CBREFL_2)
204 #define COMP_B_VREFBASE2_5V (CBREFL_3)
205 
206 //*****************************************************************************
207 //
208 // The following are values that can be passed to the interruptMask parameter
209 // for functions: Comp_B_enableInterrupt(), and Comp_B_disableInterrupt().
210 //
211 //*****************************************************************************
212 #define COMP_B_OUTPUT_INT CBIE
213 #define COMP_B_OUTPUTINVERTED_INT CBIIE
214 
215 //*****************************************************************************
216 //
217 // The following are values that can be passed to the interruptFlagMask
218 // parameter for functions: Comp_B_clearInterrupt(), and
219 // Comp_B_getInterruptStatus() as well as returned by the
220 // Comp_B_getInterruptStatus() function.
221 //
222 //*****************************************************************************
223 #define COMP_B_OUTPUT_FLAG CBIFG
224 #define COMP_B_OUTPUTINVERTED_FLAG CBIIFG
225 
226 //*****************************************************************************
227 //
228 // The following are values that can be passed to the edgeDirection parameter
229 // for functions: Comp_B_setInterruptEdgeDirection().
230 //
231 //*****************************************************************************
232 #define COMP_B_RISINGEDGE (!(CBIES))
233 #define COMP_B_FALLINGEDGE (CBIES)
234 
235 //*****************************************************************************
236 //
237 // The following are values that can be passed toThe following are values that
238 // can be returned by the Comp_B_outputValue() function.
239 //
240 //*****************************************************************************
241 #define COMP_B_LOW (0x0)
242 #define COMP_B_HIGH (CBOUT)
243 
244 //*****************************************************************************
245 //
246 // The following are values that can be passed to the selectType parameter for
247 // functions: Comp_B_selectReferenceVoltage().
248 //
249 //*****************************************************************************
250 #define COMP_B_VREF_AUTO_SELECT 0x0000
251 #define COMP_B_VREF_MANUAL_SELECT CBMRVS
252 
253 //*****************************************************************************
254 //
255 // The following are values that can be passed to the selectVRef parameter for
256 // functions: Comp_B_selectReferenceVoltage().
257 //
258 //*****************************************************************************
259 #define COMP_B_SELECT_VREF0 0x0000
260 #define COMP_B_SELECT_VREF1 CBMRVL
261 
262 //*****************************************************************************
263 //
264 // Prototypes for the APIs.
265 //
266 //*****************************************************************************
267 
268 //*****************************************************************************
269 //
270 //! \brief Initializes the Comp_B Module.
271 //!
272 //! Upon successful initialization of the Comp_B module, this function will
273 //! have reset all necessary register bits and set the given options in the
274 //! registers. To actually use the Comp_B module, the Comp_B_enable() function
275 //! must be explicitly called before use. If a Reference Voltage is set to a
276 //! terminal, the Voltage should be set using the Comp_B_setReferenceVoltage()
277 //! function.
278 //!
279 //! \param baseAddress is the base address of the COMP_B module.
280 //! \param param is the pointer to struct for initialization.
281 //!
282 //! \return STATUS_SUCCESS or STATUS_FAILURE of the initialization process.
283 //
284 //*****************************************************************************
285 extern bool Comp_B_init(uint16_t baseAddress,
286  Comp_B_initParam *param);
287 
288 //*****************************************************************************
289 //
290 //! \brief Generates a Reference Voltage to the terminal selected during
291 //! initialization.
292 //!
293 //! Use this function to generate a voltage to serve as a reference to the
294 //! terminal selected at initialization. The voltage is determined by the
295 //! equation: Vbase * (Numerator / 32). If the upper and lower limit voltage
296 //! numerators are equal, then a static reference is defined, whereas they are
297 //! different then a hysteresis effect is generated.
298 //!
299 //! \param baseAddress is the base address of the COMP_B module.
300 //! \param param is the pointer to struct for reference voltage configuration.
301 //!
302 //! \return None
303 //
304 //*****************************************************************************
305 extern void Comp_B_configureReferenceVoltage(uint16_t baseAddress,
307 
308 //*****************************************************************************
309 //
310 //! \brief Enables selected Comp_B interrupt sources.
311 //!
312 //! Enables the indicated Comp_B interrupt sources. Only the sources that are
313 //! enabled can be reflected to the processor interrupt; disabled sources have
314 //! no effect on the processor. Does not clear interrupt flags.
315 //!
316 //! \param baseAddress is the base address of the COMP_B module.
317 //! \param interruptMask is the bit mask of the interrupt sources to be
318 //! enabled.
319 //! Mask value is the logical OR of any of the following:
320 //! - \b COMP_B_OUTPUT_INT - Output interrupt
321 //! - \b COMP_B_OUTPUTINVERTED_INT - Output interrupt inverted polarity
322 //! \n Modified bits of \b CBINT register.
323 //!
324 //! \return None
325 //
326 //*****************************************************************************
327 extern void Comp_B_enableInterrupt(uint16_t baseAddress,
328  uint16_t interruptMask);
329 
330 //*****************************************************************************
331 //
332 //! \brief Disables selected Comp_B interrupt sources.
333 //!
334 //! Disables the indicated Comp_B interrupt sources. Only the sources that are
335 //! enabled can be reflected to the processor interrupt; disabled sources have
336 //! no effect on the processor.
337 //!
338 //! \param baseAddress is the base address of the COMP_B module.
339 //! \param interruptMask is the bit mask of the interrupt sources to be
340 //! disabled.
341 //! Mask value is the logical OR of any of the following:
342 //! - \b COMP_B_OUTPUT_INT - Output interrupt
343 //! - \b COMP_B_OUTPUTINVERTED_INT - Output interrupt inverted polarity
344 //! \n Modified bits of \b CBINT register.
345 //!
346 //! \return None
347 //
348 //*****************************************************************************
349 extern void Comp_B_disableInterrupt(uint16_t baseAddress,
350  uint16_t interruptMask);
351 
352 //*****************************************************************************
353 //
354 //! \brief Clears Comp_B interrupt flags.
355 //!
356 //! The Comp_B interrupt source is cleared, so that it no longer asserts. The
357 //! highest interrupt flag is automatically cleared when an interrupt vector
358 //! generator is used.
359 //!
360 //! \param baseAddress is the base address of the COMP_B module.
361 //! \param interruptFlagMask is a bit mask of the interrupt sources to be
362 //! cleared.
363 //! Mask value is the logical OR of any of the following:
364 //! - \b COMP_B_OUTPUT_FLAG - Output interrupt
365 //! - \b COMP_B_OUTPUTINVERTED_FLAG - Output interrupt inverted polarity
366 //! \n Modified bits of \b CBINT register.
367 //!
368 //! \return None
369 //
370 //*****************************************************************************
371 extern void Comp_B_clearInterrupt(uint16_t baseAddress,
372  uint16_t interruptFlagMask);
373 
374 //*****************************************************************************
375 //
376 //! \brief Gets the current Comp_B interrupt status.
377 //!
378 //! This returns the interrupt status for the Comp_B module based on which flag
379 //! is passed.
380 //!
381 //! \param baseAddress is the base address of the COMP_B module.
382 //! \param interruptFlagMask is the masked interrupt flag status to be
383 //! returned.
384 //! Mask value is the logical OR of any of the following:
385 //! - \b COMP_B_OUTPUT_FLAG - Output interrupt
386 //! - \b COMP_B_OUTPUTINVERTED_FLAG - Output interrupt inverted polarity
387 //!
388 //! \return Logical OR of any of the following:
389 //! - \b COMP_B_OUTPUT_FLAG Output interrupt
390 //! - \b COMP_B_OUTPUTINVERTED_FLAG Output interrupt inverted polarity
391 //! \n indicating the status of the masked interrupts
392 //
393 //*****************************************************************************
394 extern uint8_t Comp_B_getInterruptStatus(uint16_t baseAddress,
395  uint16_t interruptFlagMask);
396 
397 //*****************************************************************************
398 //
399 //! \brief Explicitly sets the edge direction that would trigger an interrupt.
400 //!
401 //! This function will set which direction the output will have to go, whether
402 //! rising or falling, to generate an interrupt based on a non-inverted
403 //! interrupt.
404 //!
405 //! \param baseAddress is the base address of the COMP_B module.
406 //! \param edgeDirection determines which direction the edge would have to go
407 //! to generate an interrupt based on the non-inverted interrupt flag.
408 //! Valid values are:
409 //! - \b COMP_B_RISINGEDGE [Default] - sets the bit to generate an
410 //! interrupt when the output of the Comp_B falls from LOW to HIGH if
411 //! the normal interrupt bit is set(and HIGH to LOW if the inverted
412 //! interrupt enable bit is set).
413 //! - \b COMP_B_FALLINGEDGE - sets the bit to generate an interrupt when
414 //! the output of the Comp_B rises from HIGH to LOW if the normal
415 //! interrupt bit is set(and LOW to HIGH if the inverted interrupt
416 //! enable bit is set).
417 //! \n Modified bits are \b CBIES of \b CBCTL1 register.
418 //!
419 //! \return None
420 //
421 //*****************************************************************************
422 extern void Comp_B_setInterruptEdgeDirection(uint16_t baseAddress,
423  uint16_t edgeDirection);
424 
425 //*****************************************************************************
426 //
427 //! \brief Toggles the edge direction that would trigger an interrupt.
428 //!
429 //! This function will toggle which direction the output will have to go,
430 //! whether rising or falling, to generate an interrupt based on a non-inverted
431 //! interrupt. If the direction was rising, it is now falling, if it was
432 //! falling, it is now rising.
433 //!
434 //! \param baseAddress is the base address of the COMP_B module.
435 //!
436 //! \return None
437 //
438 //*****************************************************************************
439 extern void Comp_B_toggleInterruptEdgeDirection(uint16_t baseAddress);
440 
441 //*****************************************************************************
442 //
443 //! \brief Turns on the Comp_B module.
444 //!
445 //! This function sets the bit that enables the operation of the Comp_B module.
446 //!
447 //! \param baseAddress is the base address of the COMP_B module.
448 //!
449 //! \return None
450 //
451 //*****************************************************************************
452 extern void Comp_B_enable(uint16_t baseAddress);
453 
454 //*****************************************************************************
455 //
456 //! \brief Turns off the Comp_B module.
457 //!
458 //! This function clears the CBON bit disabling the operation of the Comp_B
459 //! module, saving from excess power consumption.
460 //!
461 //! \param baseAddress is the base address of the COMP_B module.
462 //!
463 //! \return None
464 //
465 //*****************************************************************************
466 extern void Comp_B_disable(uint16_t baseAddress);
467 
468 //*****************************************************************************
469 //
470 //! \brief Shorts the two input pins chosen during initialization.
471 //!
472 //! This function sets the bit that shorts the devices attached to the input
473 //! pins chosen from the initialization of the Comp_B.
474 //!
475 //! \param baseAddress is the base address of the COMP_B module.
476 //!
477 //! \return None
478 //
479 //*****************************************************************************
480 extern void Comp_B_shortInputs(uint16_t baseAddress);
481 
482 //*****************************************************************************
483 //
484 //! \brief Disables the short of the two input pins chosen during
485 //! initialization.
486 //!
487 //! This function clears the bit that shorts the devices attached to the input
488 //! pins chosen from the initialization of the Comp_B.
489 //!
490 //! \param baseAddress is the base address of the COMP_B module.
491 //!
492 //! \return None
493 //
494 //*****************************************************************************
495 extern void Comp_B_unshortInputs(uint16_t baseAddress);
496 
497 //*****************************************************************************
498 //
499 //! \brief Disables the input buffer of the selected input port to effectively
500 //! allow for analog signals.
501 //!
502 //! This function sets the bit to disable the buffer for the specified input
503 //! port to allow for analog signals from any of the Comp_B input pins. This
504 //! bit is automatically set when the input is initialized to be used with the
505 //! Comp_B module. This function should be used whenever an analog input is
506 //! connected to one of these pins to prevent parasitic voltage from causing
507 //! unexpected results.
508 //!
509 //! \param baseAddress is the base address of the COMP_B module.
510 //! \param inputPort is the port in which the input buffer will be disabled.
511 //! Valid values are:
512 //! - \b COMP_B_INPUT0 [Default]
513 //! - \b COMP_B_INPUT1
514 //! - \b COMP_B_INPUT2
515 //! - \b COMP_B_INPUT3
516 //! - \b COMP_B_INPUT4
517 //! - \b COMP_B_INPUT5
518 //! - \b COMP_B_INPUT6
519 //! - \b COMP_B_INPUT7
520 //! - \b COMP_B_INPUT8
521 //! - \b COMP_B_INPUT9
522 //! - \b COMP_B_INPUT10
523 //! - \b COMP_B_INPUT11
524 //! - \b COMP_B_INPUT12
525 //! - \b COMP_B_INPUT13
526 //! - \b COMP_B_INPUT14
527 //! - \b COMP_B_INPUT15
528 //! - \b COMP_B_VREF
529 //! \n Modified bits are \b CBPDx of \b CBCTL3 register.
530 //!
531 //! \return None
532 //
533 //*****************************************************************************
534 extern void Comp_B_disableInputBuffer(uint16_t baseAddress,
535  uint8_t inputPort);
536 
537 //*****************************************************************************
538 //
539 //! \brief Enables the input buffer of the selected input port to allow for
540 //! digital signals.
541 //!
542 //! This function clears the bit to enable the buffer for the specified input
543 //! port to allow for digital signals from any of the Comp_B input pins. This
544 //! should not be reset if there is an analog signal connected to the specified
545 //! input pin to prevent from unexpected results.
546 //!
547 //! \param baseAddress is the base address of the COMP_B module.
548 //! \param inputPort is the port in which the input buffer will be enabled.
549 //! Valid values are:
550 //! - \b COMP_B_INPUT0 [Default]
551 //! - \b COMP_B_INPUT1
552 //! - \b COMP_B_INPUT2
553 //! - \b COMP_B_INPUT3
554 //! - \b COMP_B_INPUT4
555 //! - \b COMP_B_INPUT5
556 //! - \b COMP_B_INPUT6
557 //! - \b COMP_B_INPUT7
558 //! - \b COMP_B_INPUT8
559 //! - \b COMP_B_INPUT9
560 //! - \b COMP_B_INPUT10
561 //! - \b COMP_B_INPUT11
562 //! - \b COMP_B_INPUT12
563 //! - \b COMP_B_INPUT13
564 //! - \b COMP_B_INPUT14
565 //! - \b COMP_B_INPUT15
566 //! - \b COMP_B_VREF
567 //! \n Modified bits are \b CBPDx of \b CBCTL3 register.
568 //!
569 //! \return None
570 //
571 //*****************************************************************************
572 extern void Comp_B_enableInputBuffer(uint16_t baseAddress,
573  uint8_t inputPort);
574 
575 //*****************************************************************************
576 //
577 //! \brief Toggles the bit that swaps which terminals the inputs go to, while
578 //! also inverting the output of the Comp_B.
579 //!
580 //! This function toggles the bit that controls which input goes to which
581 //! terminal. After initialization, this bit is set to 0, after toggling it
582 //! once the inputs are routed to the opposite terminal and the output is
583 //! inverted.
584 //!
585 //! \param baseAddress is the base address of the COMP_B module.
586 //!
587 //! \return None
588 //
589 //*****************************************************************************
590 extern void Comp_B_swapIO(uint16_t baseAddress);
591 
592 //*****************************************************************************
593 //
594 //! \brief Returns the output value of the Comp_B module.
595 //!
596 //! Returns the output value of the Comp_B module.
597 //!
598 //! \param baseAddress is the base address of the COMP_B module.
599 //!
600 //! \return One of the following:
601 //! - \b COMP_B_LOW
602 //! - \b COMP_B_HIGH
603 //! \n indicating the output value of the Comp_B module
604 //
605 //*****************************************************************************
606 extern uint16_t Comp_B_outputValue(uint16_t baseAddress);
607 
608 //*****************************************************************************
609 //
610 //! \brief Modifies how comparator output selects between VREF0 or VREF1.
611 //!
612 //! Only applicable in certain Comp_B reference sources. Consult
613 //! Comp_B_configureReferenceVoltage for details. If COMP_B_VREF_AUTO_SELECT,
614 //! then comparator output state chooses between VREF0 and VREF1. If
615 //! COMP_B_VREF_MANUAL_SELECT, then selectVRef param chooses.
616 //!
617 //! \param baseAddress is the base address of the COMP_B module.
618 //! \param selectType determines whether VREF instance is chosen automatically
619 //! or manually
620 //! Valid values are:
621 //! - \b COMP_B_VREF_AUTO_SELECT [Default] - VREF instance is chosen by
622 //! comparator output state.
623 //! - \b COMP_B_VREF_MANUAL_SELECT - VREF instance is chosen by user
624 //! (CBCTL1. CBMRVL bit)
625 //! \n Modified bits are \b CBMRVS of \b CBCTL1 register.
626 //! \param selectVRef selects VREF0 or VREF1. Only applicable if VREF instance
627 //! is set up to be chosen manually
628 //! Valid values are:
629 //! - \b COMP_B_SELECT_VREF0 [Default]
630 //! - \b COMP_B_SELECT_VREF1
631 //! \n Modified bits are \b CBMRVL of \b CBCTL1 register.
632 //!
633 //
634 //*****************************************************************************
635 extern void Comp_B_selectReferenceVoltage(uint16_t baseAddress,
636  uint16_t selectType,
637  uint16_t selectVRef);
638 
639 //*****************************************************************************
640 //
641 // Mark the end of the C bindings section for C++ compilers.
642 //
643 //*****************************************************************************
644 #ifdef __cplusplus
645 }
646 #endif
647 
648 #endif
649 #endif // __MSP430WARE_COMP_B_H__
uint16_t lowerLimitSupplyVoltageFractionOf32
Definition: comp_b.h:112
uint16_t powerModeSelect
Definition: comp_b.h:77
void Comp_B_enableInterrupt(uint16_t baseAddress, uint16_t interruptMask)
Enables selected Comp_B interrupt sources.
Definition: comp_b.c:106
void Comp_B_enableInputBuffer(uint16_t baseAddress, uint8_t inputPort)
Enables the input buffer of the selected input port to allow for digital signals. ...
Definition: comp_b.c:174
uint16_t upperLimitSupplyVoltageFractionOf32
Definition: comp_b.h:115
uint16_t Comp_B_outputValue(uint16_t baseAddress)
Returns the output value of the Comp_B module.
Definition: comp_b.c:185
void Comp_B_setInterruptEdgeDirection(uint16_t baseAddress, uint16_t edgeDirection)
Explicitly sets the edge direction that would trigger an interrupt.
Definition: comp_b.c:131
void Comp_B_swapIO(uint16_t baseAddress)
Toggles the bit that swaps which terminals the inputs go to, while also inverting the output of the C...
Definition: comp_b.c:180
bool Comp_B_init(uint16_t baseAddress, Comp_B_initParam *param)
Initializes the Comp_B Module.
Definition: comp_b.c:21
uint16_t invertedOutputPolarity
Definition: comp_b.h:92
uint8_t negativeTerminalInput
Definition: comp_b.h:71
void Comp_B_toggleInterruptEdgeDirection(uint16_t baseAddress)
Toggles the edge direction that would trigger an interrupt.
Definition: comp_b.c:143
uint8_t positiveTerminalInput
Definition: comp_b.h:51
void Comp_B_selectReferenceVoltage(uint16_t baseAddress, uint16_t selectType, uint16_t selectVRef)
Modifies how comparator output selects between VREF0 or VREF1.
Definition: comp_b.c:191
void Comp_B_shortInputs(uint16_t baseAddress)
Shorts the two input pins chosen during initialization.
Definition: comp_b.c:158
uint8_t outputFilterEnableAndDelayLevel
Definition: comp_b.h:87
void Comp_B_configureReferenceVoltage(uint16_t baseAddress, Comp_B_configureReferenceVoltageParam *param)
Generates a Reference Voltage to the terminal selected during initialization.
Definition: comp_b.c:72
void Comp_B_disableInterrupt(uint16_t baseAddress, uint16_t interruptMask)
Disables selected Comp_B interrupt sources.
Definition: comp_b.c:113
uint8_t Comp_B_getInterruptStatus(uint16_t baseAddress, uint16_t interruptFlagMask)
Gets the current Comp_B interrupt status.
Definition: comp_b.c:125
uint16_t referenceAccuracy
Definition: comp_b.h:121
void Comp_B_disable(uint16_t baseAddress)
Turns off the Comp_B module.
Definition: comp_b.c:153
void Comp_B_unshortInputs(uint16_t baseAddress)
Disables the short of the two input pins chosen during initialization.
Definition: comp_b.c:163
uint16_t supplyVoltageReferenceBase
Definition: comp_b.h:109
void Comp_B_disableInputBuffer(uint16_t baseAddress, uint8_t inputPort)
Disables the input buffer of the selected input port to effectively allow for analog signals...
Definition: comp_b.c:168
void Comp_B_enable(uint16_t baseAddress)
Turns on the Comp_B module.
Definition: comp_b.c:148
Used in the Comp_B_configureReferenceVoltage() function as the param parameter.
Definition: comp_b.h:101
void Comp_B_clearInterrupt(uint16_t baseAddress, uint16_t interruptFlagMask)
Clears Comp_B interrupt flags.
Definition: comp_b.c:119
Used in the Comp_B_init() function as the param parameter.
Definition: comp_b.h:31

Copyright 2020, Texas Instruments Incorporated