2 * -------------------------------------------
3 * MSP432 DriverLib - v3_10_00_09
4 * -------------------------------------------
6 * --COPYRIGHT--,BSD,BSD
7 * Copyright (c) 2014, Texas Instruments Incorporated
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
14 * * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
17 * * Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
21 * * Neither the name of Texas Instruments Incorporated nor the names of
22 * its contributors may be used to endorse or promote products derived
23 * from this software without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
27 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
29 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
32 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
35 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 //*****************************************************************************
42 //! \addtogroup comp_api
45 //*****************************************************************************
47 //*****************************************************************************
49 // If building with a C++ compiler, make all of the definitions in this header
52 //*****************************************************************************
62 /* Module defines for Comp */
63 #define COMP_E_CMSIS(x) ((COMP_E_Type *) x)
65 #define COMP_E_FILTEROUTPUT_OFF 0x00
66 #define COMP_E_FILTEROUTPUT_DLYLVL1 (COMP_E_CTL1_F + COMP_E_CTL1_FDLY_0)
67 #define COMP_E_FILTEROUTPUT_DLYLVL2 (COMP_E_CTL1_F + COMP_E_CTL1_FDLY_1)
68 #define COMP_E_FILTEROUTPUT_DLYLVL3 (COMP_E_CTL1_F + COMP_E_CTL1_FDLY_2)
69 #define COMP_E_FILTEROUTPUT_DLYLVL4 (COMP_E_CTL1_F + COMP_E_CTL1_FDLY_3)
71 #define COMP_E_INPUT0 (0x01)
72 #define COMP_E_INPUT1 (0x02)
73 #define COMP_E_INPUT2 (0x04)
74 #define COMP_E_INPUT3 (0x08)
75 #define COMP_E_INPUT4 (0x10)
76 #define COMP_E_INPUT5 (0x20)
77 #define COMP_E_INPUT6 (0x40)
78 #define COMP_E_INPUT7 (0x80)
79 #define COMP_E_INPUT8 (0x100)
80 #define COMP_E_INPUT9 (0x200)
81 #define COMP_E_INPUT10 (0x400)
82 #define COMP_E_INPUT11 (0x800)
83 #define COMP_E_INPUT12 (0x1000)
84 #define COMP_E_INPUT13 (0x2000)
85 #define COMP_E_INPUT14 (0x4000)
86 #define COMP_E_INPUT15 (0x8000)
87 #define COMP_E_VREF (0x9F)
89 #define COMP_E_NORMALOUTPUTPOLARITY (!(COMP_E_CTL1_OUTPOL))
90 #define COMP_E_INVERTEDOUTPUTPOLARITY (COMP_E_CTL1_OUTPOL)
92 #define COMP_E_REFERENCE_AMPLIFIER_DISABLED (COMP_E_CTL2_CEREFL_0)
93 #define COMP_E_VREFBASE1_2V (COMP_E_CTL2_CEREFL_1)
94 #define COMP_E_VREFBASE2_0V (COMP_E_CTL2_CEREFL_2)
95 #define COMP_E_VREFBASE2_5V (COMP_E_CTL2_CEREFL_3)
97 #define COMP_E_ACCURACY_STATIC (!COMP_E_CTL2_REFACC)
98 #define COMP_E_ACCURACY_CLOCKED (COMP_E_CTL2_REFACC)
100 #define COMP_E_HIGH_SPEED_MODE (COMP_E_CTL1_PWRMD_0)
101 #define COMP_E_NORMAL_MODE (COMP_E_CTL1_PWRMD_1)
102 #define COMP_E_ULTRA_LOW_POWER_MODE (COMP_E_CTL1_PWRMD_2)
104 #define COMP_E_OUTPUT_INTERRUPT (COMP_E_INT_IE)
105 #define COMP_E_INVERTED_POLARITY_INTERRUPT (COMP_E_INT_IIE)
106 #define COMP_E_READY_INTERRUPT (COMP_E_INT_RDYIE)
108 #define COMP_E_OUTPUT_INTERRUPT_FLAG (COMP_E_INT_IFG)
109 #define COMP_E_INTERRUPT_FLAG_INVERTED_POLARITY (COMP_E_INT_IIFG)
110 #define COMP_E_INTERRUPT_FLAG_READY (COMP_E_INT_RDYIFG)
112 #define COMP_E_FALLINGEDGE (!(COMP_E_CTL1_IES))
113 #define COMP_E_RISINGEDGE (COMP_E_CTL1_IES)
115 #define COMP_E_LOW (0x0)
116 #define COMP_E_HIGH (COMP_E_CTL1_OUT)
118 //*****************************************************************************
120 //! ypedef COMP_E_Config
121 //! \brief Type definition for \link _COMP_E_Config \endlink structure
123 //! \struct _COMP_E_Config
124 //! \brief Configuration structure for Comparator module. See
125 //! \link COMP_E_initModule \endlink for parameter documentation.
127 //*****************************************************************************
128 typedef struct _COMP_E_Config
130 uint_fast16_t positiveTerminalInput;
131 uint_fast16_t negativeTerminalInput;
132 uint_fast8_t outputFilterEnableAndDelayLevel;
133 uint_fast8_t invertedOutputPolarity;
134 uint_fast16_t powerMode;
137 //*****************************************************************************
139 //! Initializes the Comparator Module.
141 //! \param comparator is the instance of the Comparator module. Valid
142 //! parameters vary from part to part, but can include:
143 //! - \b COMP_E0_BASE
144 //! - \b COMP_E1_BASE
145 //! \param config Configuration structure for the Comparator module
148 //! <b>Configuration options for \link COMP_E_Config \endlink structure.</b>
151 //! \param positiveTerminalInput selects the input to the positive terminal.
153 //! - \b COMP_E_INPUT0 [Default]
154 //! - \b COMP_E_INPUT1
155 //! - \b COMP_E_INPUT2
156 //! - \b COMP_E_INPUT3
157 //! - \b COMP_E_INPUT4
158 //! - \b COMP_E_INPUT5
159 //! - \b COMP_E_INPUT6
160 //! - \b COMP_E_INPUT7
161 //! - \b COMP_E_INPUT8
162 //! - \b COMP_E_INPUT9
163 //! - \b COMP_E_INPUT10
164 //! - \b COMP_E_INPUT11
165 //! - \b COMP_E_INPUT12
166 //! - \b COMP_E_INPUT13
167 //! - \b COMP_E_INPUT14
168 //! - \b COMP_E_INPUT15
170 //! \n Modified bits are \b CEIPSEL and \b CEIPEN of \b CECTL0 register,
171 //! \b CERSEL of \b CECTL2 register, and CEPDx of \b CECTL3 register.
172 //! \param negativeTerminalInput selects the input to the negative terminal.
173 //! \n Valid values are:
174 //! - \b COMP_E_INPUT0 [Default]
175 //! - \b COMP_E_INPUT1
176 //! - \b COMP_E_INPUT2
177 //! - \b COMP_E_INPUT3
178 //! - \b COMP_E_INPUT4
179 //! - \b COMP_E_INPUT5
180 //! - \b COMP_E_INPUT6
181 //! - \b COMP_E_INPUT7
182 //! - \b COMP_E_INPUT8
183 //! - \b COMP_E_INPUT9
184 //! - \b COMP_E_INPUT10
185 //! - \b COMP_E_INPUT11
186 //! - \b COMP_E_INPUT12
187 //! - \b COMP_E_INPUT13
188 //! - \b COMP_E_INPUT14
189 //! - \b COMP_E_INPUT15
191 //! \n Modified bits are \b CEIMSEL and \b CEIMEN of \b CECTL0 register,
192 //! \b CERSEL of \b CECTL2 register, and CEPDx of \b CECTL3 register.
193 //! \param outputFilterEnableAndDelayLevel controls the output filter delay
194 //! state, which is either off or enabled with a specified delay level.
195 //! \n Valid values are
196 //! - \b COMP_E_FILTEROUTPUT_OFF [Default]
197 //! - \b COMP_E_FILTEROUTPUT_DLYLVL1
198 //! - \b COMP_E_FILTEROUTPUT_DLYLVL2
199 //! - \b COMP_E_FILTEROUTPUT_DLYLVL3
200 //! - \b COMP_E_FILTEROUTPUT_DLYLVL4
201 //! \n This parameter is device specific and delay levels should be found
202 //! in the device's datasheet.
203 //! \n Modified bits are \b CEF and \b CEFDLY of \b CECTL1 register.
204 //! \param invertedOutputPolarity controls if the output will be inverted or
205 //! not. Valid values are
206 //! - \b COMP_E_NORMALOUTPUTPOLARITY - indicates the output should be
207 //! normal. [Default]
208 //! - \b COMP_E_INVERTEDOUTPUTPOLARITY - the output should be inverted.
209 //! \n Modified bits are \b CEOUTPOL of \b CECTL1 register.
210 //! \param powerMode controls the power mode of the module
211 //! - \b COMP_E_HIGH_SPEED_MODE [default]
212 //! - \b COMP_E_NORMAL_MODE
213 //! - \b COMP_E_ULTRA_LOW_POWER_MODE
214 //! Upon successful initialization of the Comparator module, this function will
215 //! have reset all necessary register bits and set the given options in the
216 //! registers. To actually use the comparator module, the COMP_E_enableModule()
217 //! function must be explicitly called before use.
218 //! If a Reference Voltage is set to a terminal, the Voltage should be set
219 //! using the COMP_E_setReferenceVoltage() function.
221 //! \return true or false of the initialization process.
223 //*****************************************************************************
224 extern bool COMP_E_initModule(uint32_t comparator, const COMP_E_Config *config);
226 //*****************************************************************************
228 //! Generates a Reference Voltage to the terminal selected during
231 //! \param comparator is the instance of the Comparator module. Valid
232 //! parameters vary from part to part, but can include:
233 //! - \b COMP_E0_BASE
234 //! - \b COMP_E1_BASE
235 //! \param supplyVoltageReferenceBase decides the source and max amount of
236 //! Voltage that can be used as a reference.
238 //! - \b COMP_E_REFERENCE_AMPLIFIER_DISABLED
239 //! - \b COMP_E_VREFBASE1_2V
240 //! - \b COMP_E_VREFBASE2_0V
241 //! - \b COMP_E_VREFBASE2_5V
242 //! \param upperLimitSupplyVoltageFractionOf32 is the numerator of the
243 //! equation to generate the reference voltage for the upper limit
244 //! reference voltage. Valid values are between 0 and 32.
245 //! \param lowerLimitSupplyVoltageFractionOf32 is the numerator of the
246 //! equation to generate the reference voltage for the lower limit
247 //! reference voltage. Valid values are between 0 and 32.
248 //! <br>Modified bits are \b CEREF0 of \b CECTL2 register.
250 //! Use this function to generate a voltage to serve as a reference to the
251 //! terminal selected at initialization. The voltage is determined by the
252 //! equation: Vbase * (Numerator / 32). If the upper and lower limit voltage
253 //! numerators are equal, then a static reference is defined, whereas they are
254 //! different then a hysteresis effect is generated.
258 //*****************************************************************************
259 extern void COMP_E_setReferenceVoltage(uint32_t comparator,
260 uint_fast16_t supplyVoltageReferenceBase,
261 uint_fast16_t lowerLimitSupplyVoltageFractionOf32,
262 uint_fast16_t upperLimitSupplyVoltageFractionOf32);
264 //*****************************************************************************
266 //! Sets the reference accuracy
268 //! \param comparator is the instance of the Comparator module. Valid
269 //! parameters vary from part to part, but can include:
270 //! - \b COMP_E0_BASE
271 //! - \b COMP_E1_BASE
272 //! \param referenceAccuracy is the reference accuracy setting of the
273 //! comparator. Clocked is for low power/low accuracy.
275 //! - \b COMP_E_ACCURACY_STATIC
276 //! - \b COMP_E_ACCURACY_CLOCKED
277 //! <br>Modified bits are \b CEREFACC of \b CECTL2 register.
279 //! The reference accuracy is set to the desired setting. Clocked is better for
280 //! low power operations but has a lower accuracy.
284 //*****************************************************************************
285 extern void COMP_E_setReferenceAccuracy(uint32_t comparator,
286 uint_fast16_t referenceAccuracy);
288 //*****************************************************************************
290 //! Sets the power mode
292 //! \param comparator is the instance of the Comparator module. Valid
293 //! parameters vary from part to part, but can include:
294 //! - \b COMP_E0_BASE
295 //! - \b COMP_E1_BASE
296 //! \param powerMode decides the power mode
298 //! - \b COMP_E_HIGH_SPEED_MODE
299 //! - \b COMP_E_NORMAL_MODE
300 //! - \b COMP_E_ULTRA_LOW_POWER_MODE
301 //! <br>Modified bits are \b CEPWRMD of \b CECTL1 register.
305 //*****************************************************************************
306 extern void COMP_E_setPowerMode(uint32_t comparator, uint_fast16_t powerMode);
308 //*****************************************************************************
310 //! Turns on the Comparator module.
312 //! \param comparator is the instance of the Comparator module. Valid
313 //! parameters vary from part to part, but can include:
314 //! - \b COMP_E0_BASE
315 //! - \b COMP_E1_BASE
317 //! This function sets the bit that enables the operation of the
318 //! Comparator module.
322 //*****************************************************************************
323 extern void COMP_E_enableModule(uint32_t comparator);
325 //*****************************************************************************
327 //! Turns off the Comparator module.
329 //! \param comparator is the instance of the Comparator module. Valid
330 //! parameters vary from part to part, but can include:
331 //! - \b COMP_E0_BASE
332 //! - \b COMP_E1_BASE
334 //! This function clears the CEON bit disabling the operation of the Comparator
335 //! module, saving from excess power consumption.
337 //! Modified bits are \b CEON of \b CECTL1 register.
340 //*****************************************************************************
341 extern void COMP_E_disableModule(uint32_t comparator);
343 //*****************************************************************************
345 //! Shorts the two input pins chosen during initialization.
347 //! \param comparator is the instance of the Comparator module. Valid
348 //! parameters vary from part to part, but can include:
349 //! - \b COMP_E0_BASE
350 //! - \b COMP_E1_BASE
352 //! This function sets the bit that shorts the devices attached to the input
353 //! pins chosen from the initialization of the comparator.
355 //! Modified bits are \b CESHORT of \b CECTL1 register.
358 //*****************************************************************************
359 extern void COMP_E_shortInputs(uint32_t comparator);
361 //*****************************************************************************
363 //! Disables the short of the two input pins chosen during initialization.
365 //! \param comparator is the instance of the Comparator module. Valid
366 //! parameters vary from part to part, but can include:
367 //! - \b COMP_E0_BASE
368 //! - \b COMP_E1_BASE
370 //! This function clears the bit that shorts the devices attached to the input
371 //! pins chosen from the initialization of the comparator.
373 //! Modified bits are \b CESHORT of \b CECTL1 register.
376 //*****************************************************************************
377 extern void COMP_E_unshortInputs(uint32_t comparator);
379 //*****************************************************************************
381 //! Disables the input buffer of the selected input port to effectively allow
382 //! for analog signals.
384 //! \param comparator is the instance of the Comparator module. Valid
385 //! parameters vary from part to part, but can include:
386 //! - \b COMP_E0_BASE
387 //! - \b COMP_E1_BASE
388 //! \param inputPort is the port in which the input buffer will be disabled.
389 //! Valid values are a logical OR of the following:
390 //! - \b COMP_E_INPUT0 [Default]
391 //! - \b COMP_E_INPUT1
392 //! - \b COMP_E_INPUT2
393 //! - \b COMP_E_INPUT3
394 //! - \b COMP_E_INPUT4
395 //! - \b COMP_E_INPUT5
396 //! - \b COMP_E_INPUT6
397 //! - \b COMP_E_INPUT7
398 //! - \b COMP_E_INPUT8
399 //! - \b COMP_E_INPUT9
400 //! - \b COMP_E_INPUT10
401 //! - \b COMP_E_INPUT11
402 //! - \b COMP_E_INPUT12
403 //! - \b COMP_E_INPUT13
404 //! - \b COMP_E_INPUT14
405 //! - \b COMP_E_INPUT15
406 //! <br> Modified bits are \b CEPDx of \b CECTL3 register.
408 //! This function sets the bit to disable the buffer for the specified input
409 //! port to allow for analog signals from any of the comparator input pins. This
410 //! bit is automatically set when the input is initialized to be used with the
411 //! comparator module. This function should be used whenever an analog input is
412 //! connected to one of these pins to prevent parasitic voltage from causing
413 //! unexpected results.
417 //*****************************************************************************
418 extern void COMP_E_disableInputBuffer(uint32_t comparator,
419 uint_fast16_t inputPort);
421 //*****************************************************************************
423 //! Enables the input buffer of the selected input port to allow for digital
426 //! \param comparator is the instance of the Comparator module. Valid
427 //! parameters vary from part to part, but can include:
428 //! - \b COMP_E0_BASE
429 //! - \b COMP_E1_BASE
430 //! \param inputPort is the port in which the input buffer will be enabled.
431 //! Valid values are a logical OR of the following:
432 //! - \b COMP_E_INPUT0 [Default]
433 //! - \b COMP_E_INPUT1
434 //! - \b COMP_E_INPUT2
435 //! - \b COMP_E_INPUT3
436 //! - \b COMP_E_INPUT4
437 //! - \b COMP_E_INPUT5
438 //! - \b COMP_E_INPUT6
439 //! - \b COMP_E_INPUT7
440 //! - \b COMP_E_INPUT8
441 //! - \b COMP_E_INPUT9
442 //! - \b COMP_E_INPUT10
443 //! - \b COMP_E_INPUT11
444 //! - \b COMP_E_INPUT12
445 //! - \b COMP_E_INPUT13
446 //! - \b COMP_E_INPUT14
447 //! - \b COMP_E_INPUT15
448 //! <br> Modified bits are \b CEPDx of \b CECTL3 register.
450 //! This function clears the bit to enable the buffer for the specified input
451 //! port to allow for digital signals from any of the comparator input pins.
452 //! This should not be reset if there is an analog signal connected to the
453 //! specified input pin to prevent from unexpected results.
457 //*****************************************************************************
458 extern void COMP_E_enableInputBuffer(uint32_t comparator,
459 uint_fast16_t inputPort);
461 //*****************************************************************************
463 //! Toggles the bit that swaps which terminals the inputs go to, while also
464 //! inverting the output of the comparator.
466 //! \param comparator is the instance of the Comparator module. Valid
467 //! parameters vary from part to part, but can include:
471 //! This function toggles the bit that controls which input goes to which
472 //! terminal. After initialization, this bit is set to 0, after toggling it once
473 //! the inputs are routed to the opposite terminal and the output is inverted.
475 //! Modified bits are \b CEEX of \b CECTL1 register.
478 //*****************************************************************************
479 extern void COMP_E_swapIO(uint32_t comparator);
481 //*****************************************************************************
483 //! Returns the output value of the Comparator module.
485 //! \param comparator is the instance of the Comparator module. Valid parameters
486 //! vary from part to part, but can include:
487 //! - \b COMP_E0_BASE
488 //! - \b COMP_E1_BASE
490 //! Returns the output value of the Comparator module.
492 //! \return COMP_E_HIGH or COMP_E_LOW as the output value of the Comparator
495 //*****************************************************************************
496 extern uint8_t COMP_E_outputValue(uint32_t comparator);
498 //*****************************************************************************
500 //! Enables selected Comparator interrupt sources.
502 //! \param comparator is the instance of the Comparator module. Valid
503 //! parameters vary from part to part, but can include:
504 //! - \b COMP_E0_BASE
505 //! - \b COMP_E1_BASE
506 //! \param mask is the bit mask of the interrupt sources to be enabled.
507 //! Mask value is the logical OR of any of the following
508 //! - \b COMP_E_OUTPUT_INTERRUPT - Output interrupt
509 //! - \b COMP_E_INVERTED_POLARITY_INTERRUPT - Output interrupt inverted
511 //! - \b COMP_E_READY_INTERRUPT - Ready interrupt
513 //! Enables the indicated Comparator interrupt sources. Only the sources that
514 //! are enabled can be reflected to the processor interrupt; disabled sources
515 //! have no effect on the processor. The default trigger for the non-inverted
516 //! interrupt is a rising edge of the output, this can be changed with the
517 //! interruptSetEdgeDirection() function.
521 //*****************************************************************************
522 extern void COMP_E_enableInterrupt(uint32_t comparator, uint_fast16_t mask);
524 //*****************************************************************************
526 //! Disables selected Comparator interrupt sources.
528 //! \param comparator is the instance of the Comparator module. Valid
529 //! parameters vary from part to part, but can include:
530 //! - \b COMP_E0_BASE
531 //! - \b COMP_E1_BASE
532 //! \param mask is the bit mask of the interrupt sources to be disabled.
533 //! Mask value is the logical OR of any of the following
534 //! - \b COMP_E_OUTPUT_INTERRUPT - Output interrupt
535 //! - \b COMP_E_INVERTED_POLARITY_INTERRUPT - Output interrupt inverted
537 //! - \b COMP_E_READY_INTERRUPT - Ready interrupt
539 //! Disables the indicated Comparator interrupt sources. Only the sources that
540 //! are enabled can be reflected to the processor interrupt; disabled sources
541 //! have no effect on the processor.
545 //*****************************************************************************
546 extern void COMP_E_disableInterrupt(uint32_t comparator, uint_fast16_t mask);
548 //*****************************************************************************
550 //! Clears Comparator interrupt flags.
552 //! \param comparator is the instance of the Comparator module. Valid
553 //! parameters vary from part to part, but can include:
554 //! - \b COMP_E0_BASE
555 //! - \b COMP_E1_BASE
556 //! \param mask is a bit mask of the interrupt sources to be cleared.
557 //! Mask value is the logical OR of any of the following
558 //! - \b COMP_E_INTERRUPT_FLAG - Output interrupt flag
559 //! - \b COMP_E_INTERRUPT_FLAG_INVERTED_POLARITY - Output interrupt flag
560 //! inverted polarity
561 //! - \b COMP_E_INTERRUPT_FLAG_READY - Ready interrupt flag
563 //! The Comparator interrupt source is cleared, so that it no longer asserts.
564 //! The highest interrupt flag is automatically cleared when an interrupt vector
565 //! generator is used.
569 //*****************************************************************************
570 extern void COMP_E_clearInterruptFlag(uint32_t comparator, uint_fast16_t mask);
572 //*****************************************************************************
574 //! Gets the current Comparator interrupt status.
576 //! \param comparator is the instance of the Comparator module. Valid
577 //! parameters vary from part to part, but can include:
578 //! - \b COMP_E0_BASE
579 //! - \b COMP_E1_BASE
581 //! This returns the interrupt status for the Comparator module based on which
584 //! \return The current interrupt flag status for the corresponding mask.
586 //*****************************************************************************
587 extern uint_fast16_t COMP_E_getInterruptStatus(uint32_t comparator);
589 //*****************************************************************************
591 //! Enables selected Comparator interrupt sources masked with the enabled
592 //! interrupts. This function is useful to call in ISRs to get a list
593 //! of pending interrupts that are actually enabled and could have caused the
596 //! \param comparator is the instance of the Comparator module. Valid
597 //! parameters vary from part to part, but can include:
598 //! - \b COMP_E0_BASE
599 //! - \b COMP_E1_BASE
601 //! Enables the indicated Comparator interrupt sources. Only the sources that
602 //! are enabled can be reflected to the processor interrupt; disabled sources
603 //! have no effect on the processor. The default trigger for the non-inverted
604 //! interrupt is a rising edge of the output, this can be changed with the
605 //! COMP_E_setInterruptEdgeDirection() function.
609 //*****************************************************************************
610 extern uint_fast16_t COMP_E_getEnabledInterruptStatus(uint32_t comparator);
612 //*****************************************************************************
614 //! Explicitly sets the edge direction that would trigger an interrupt.
616 //! \param comparator is the instance of the Comparator module. Valid
617 //! parameters vary from part to part, but can include:
618 //! - \b COMP_E0_BASE
619 //! - \b COMP_E1_BASE
620 //! \param edgeDirection determines which direction the edge would have to go
621 //! to generate an interrupt based on the non-inverted interrupt flag.
623 //! - \b COMP_E_FALLINGEDGE - sets the bit to generate an interrupt when
624 //! the output of the comparator falls from HIGH to LOW if the
625 //! normal interrupt bit is set(and LOW to HIGH if the inverted
626 //! interrupt enable bit is set). [Default]
627 //! - \b COMP_E_RISINGEDGE - sets the bit to generate an interrupt when the
628 //! output of the comparator rises from LOW to HIGH if the normal
629 //! interrupt bit is set(and HIGH to LOW if the inverted interrupt
630 //! enable bit is set).
631 //! <br>Modified bits are \b CEIES of \b CECTL1 register.
633 //! This function will set which direction the output will have to go, whether
634 //! rising or falling, to generate an interrupt based on a non-inverted
639 //*****************************************************************************
640 extern void COMP_E_setInterruptEdgeDirection(uint32_t comparator,
641 uint_fast8_t edgeDirection);
643 //*****************************************************************************
645 //! Toggles the edge direction that would trigger an interrupt.
647 //! \param comparator is the instance of the Comparator module. Valid
648 //! parameters vary from part to part, but can include:
649 //! - \b COMP_E0_BASE
650 //! - \b COMP_E1_BASE
652 //! This function will toggle which direction the output will have to go,
653 //! whether rising or falling, to generate an interrupt based on a non-inverted
654 //! interrupt. If the direction was rising, it is now falling, if it was
655 //! falling, it is now rising.
657 //! Modified bits are \b CEIES of \b CECTL1 register.
661 //*****************************************************************************
662 extern void COMP_E_toggleInterruptEdgeDirection(uint32_t comparator);
664 //*****************************************************************************
666 //! Registers an interrupt handler for the Comparator E interrupt.
668 //! \param intHandler is a pointer to the function to be called when the
669 //! Comparator interrupt occurs.
671 //! \param comparator is the instance of the Comparator module. Valid
672 //! parameters vary from part to part, but can include:
673 //! - \b COMP_E0_BASE
674 //! - \b COMP_E1_BASE
676 //! This function registers the handler to be called when a Comparator
677 //! interrupt occurs. This function enables the global interrupt in the
678 //! interrupt controller; specific Comparator interrupts must be enabled
679 //! via COMP_E_enableInterrupt(). It is the interrupt handler's responsibility to
680 //! clear the interrupt source via COMP_E_clearInterruptFlag().
684 //*****************************************************************************
685 extern void COMP_E_registerInterrupt(uint32_t comparator,
686 void (*intHandler)(void));
688 //*****************************************************************************
690 //! Unregisters the interrupt handler for the Comparator E interrupt
692 //! \param comparator is the instance of the Comparator module. Valid
693 //! parameters vary from part to part, but can include:
694 //! - \b COMP_E0_BASE
695 //! - \b COMP_E1_BASE
697 //! This function unregisters the handler to be called when Comparator E
698 //! interrupt occurs. This function also masks off the interrupt in the
699 //! interrupt controller so that the interrupt handler no longer is called.
701 //! \sa Interrupt_registerInterrupt() for important information about
702 //! registering interrupt handlers.
706 //*****************************************************************************
707 extern void COMP_E_unregisterInterrupt(uint32_t comparator);
709 /* Backwards Compatibility Layer */
710 #define COMP_E_enable(a) COMP_E_enableModule(a)
711 #define COMP_E_disable(a) COMP_E_disableModule(a)
712 #define COMP_E_IOSwap(a) COMP_E_swapIO(a)
713 #define COMP_E_interruptToggleEdgeDirection(a) COMP_E_toggleInterruptEdgeDirection(a)
714 #define COMP_E_clearInterrupt(a,b) COMP_E_clearInterruptFlag(a,b)
716 //*****************************************************************************
718 // Mark the end of the C bindings section for C++ compilers.
720 //*****************************************************************************
725 //*****************************************************************************
727 // Close the Doxygen group.
730 //*****************************************************************************
733 #endif /* COMP_E_H_ */