]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil/driverlib/comp_e.h
Final V8.2.1 release ready for tagging:
[freertos] / FreeRTOS / Demo / CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil / driverlib / comp_e.h
1 /*
2  * -------------------------------------------
3  *    MSP432 DriverLib - v01_04_00_18 
4  * -------------------------------------------
5  *
6  * --COPYRIGHT--,BSD,BSD
7  * Copyright (c) 2015, Texas Instruments Incorporated
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  *
14  * *  Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  *
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.
20  *
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.
24  *
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.
36  * --/COPYRIGHT--*/
37 #ifndef COMP_E_H_
38 #define COMP_E_H_
39
40 //*****************************************************************************
41 //
42 //! \addtogroup comp_api
43 //! @{
44 //
45 //*****************************************************************************
46
47 //*****************************************************************************
48 //
49 // If building with a C++ compiler, make all of the definitions in this header
50 // have a C binding.
51 //
52 //*****************************************************************************
53 #ifdef __cplusplus
54 extern "C"
55 {
56 #endif
57
58 #include <stdint.h>
59 #include <stdbool.h>
60 #include <msp.h>
61
62 /* Module defines for Comp */
63 #define COMP_E_CMSIS(x) ((COMP_E0_Type *) x)
64
65 #define COMP_E_FILTEROUTPUT_OFF                                            0x00
66 #define COMP_E_FILTEROUTPUT_DLYLVL1                            (CEF + CEFDLY_0)
67 #define COMP_E_FILTEROUTPUT_DLYLVL2                            (CEF + CEFDLY_1)
68 #define COMP_E_FILTEROUTPUT_DLYLVL3                            (CEF + CEFDLY_2)
69 #define COMP_E_FILTEROUTPUT_DLYLVL4                            (CEF + CEFDLY_3)
70
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)
88
89 #define COMP_E_NORMALOUTPUTPOLARITY                               (!(CEOUTPOL))
90 #define COMP_E_INVERTEDOUTPUTPOLARITY                                (CEOUTPOL)
91
92 #define COMP_E_REFERENCE_AMPLIFIER_DISABLED                          (CEREFL_0)
93 #define COMP_E_VREFBASE1_2V                                          (CEREFL_1)
94 #define COMP_E_VREFBASE2_0V                                          (CEREFL_2)
95 #define COMP_E_VREFBASE2_5V                                          (CEREFL_3)
96
97 #define COMP_E_ACCURACY_STATIC                                      (!CEREFACC)
98 #define COMP_E_ACCURACY_CLOCKED                                      (CEREFACC)
99
100 #define COMP_E_HIGH_SPEED_MODE                                      (CEPWRMD_0)
101 #define COMP_E_NORMAL_MODE                                          (CEPWRMD_1)
102 #define COMP_E_ULTRA_LOW_POWER_MODE                                 (CEPWRMD_2)
103
104 #define COMP_E_OUTPUT_INTERRUPT                                          (CEIE)
105 #define COMP_E_INVERTED_POLARITY_INTERRUPT                              (CEIIE)
106 #define COMP_E_READY_INTERRUPT                                        (CERDYIE)
107
108 #define COMP_E_OUTPUT_INTERRUPT_FLAG                                    (CEIFG)
109 #define COMP_E_INTERRUPT_FLAG_INVERTED_POLARITY                        (CEIIFG)
110 #define COMP_E_INTERRUPT_FLAG_READY                                  (CERDYIFG)
111
112 #define COMP_E_FALLINGEDGE                                           (!(CEIES))
113 #define COMP_E_RISINGEDGE                                               (CEIES)
114
115 #define COMP_E_LOW                                                        (0x0)
116 #define COMP_E_HIGH                                                     (CEOUT)
117
118 //*****************************************************************************
119 //
120 //! \typedef COMP_E_Config
121 //! \brief Type definition for \link _COMP_E_Config \endlink structure
122 //!
123 //! \struct _COMP_E_Config
124 //! \brief Configuration structure for Comparator module. See 
125 //!        \link COMP_E_initModule \endlink for parameter documentation.
126 //
127 //*****************************************************************************
128 typedef struct _COMP_E_Config
129 {
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;
135 } COMP_E_Config;
136
137 //*****************************************************************************
138 //
139 //! Initializes the Comparator Module.
140 //!
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
144 //!         - \b COMP_E1
145 //! \param config Configuration structure for the Comparator module
146 //!
147 //! <hr>
148 //! <b>Configuration options for \link COMP_E_Config \endlink structure.</b>
149 //! <hr>
150 //!
151 //! \param positiveTerminalInput selects the input to the positive terminal.
152 //!        Valid values are
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
169 //!        - \b COMP_E_VREF
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
190 //!        - \b COMP_E_VREF
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.
220 //!
221 //! \return true or false of the initialization process.
222 //
223 //*****************************************************************************
224 extern bool COMP_E_initModule(uint32_t comparator, const COMP_E_Config *config);
225
226 //*****************************************************************************
227 //
228 //! Generates a Reference Voltage to the terminal selected during
229 //! initialization.
230 //!
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
234 //!         - \b COMP_E1
235 //! \param supplyVoltageReferenceBase decides the source and max amount of
236 //!       Voltage that can be used as a reference.
237 //!        Valid values are
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.
249 //!
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.
255 //!
256 //! \return NONE
257 //
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);
263
264 //*****************************************************************************
265 //
266 //! Sets the reference accuracy
267 //!
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
271 //!         - \b COMP_E1
272 //! \param referenceAccuracy is the reference accuracy setting of the
273 //!      comparator. Clocked is for low power/low accuracy.
274 //!      Valid values are
275 //!      - \b COMP_E_ACCURACY_STATIC
276 //!      - \b COMP_E_ACCURACY_CLOCKED
277 //!      <br>Modified bits are \b CEREFACC of \b CECTL2 register.
278 //!
279 //! The reference accuracy is set to the desired setting. Clocked is better for
280 //!  low power operations but has a lower accuracy.
281 //!
282 //! \return NONE
283 //
284 //*****************************************************************************
285 extern void COMP_E_setReferenceAccuracy(uint32_t comparator,
286         uint_fast16_t referenceAccuracy);
287
288 //*****************************************************************************
289 //
290 //! Sets the power mode
291 //!
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
295 //!         - \b COMP_E1
296 //! \param powerMode decides the power mode
297 //!        Valid values are
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.
302 //!
303 //! \return NONE
304 //
305 //*****************************************************************************
306 extern void COMP_E_setPowerMode(uint32_t comparator, uint_fast16_t powerMode);
307
308 //*****************************************************************************
309 //
310 //! Turns on the Comparator module.
311 //!
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
315 //!         - \b COMP_E1
316 //!
317 //! This function sets the bit that enables the operation of the
318 //! Comparator module.
319 //!
320 //! \return NONE
321 //
322 //*****************************************************************************
323 extern void COMP_E_enableModule(uint32_t comparator);
324
325 //*****************************************************************************
326 //
327 //! Turns off the Comparator module.
328 //!
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
332 //!         - \b COMP_E1
333 //!
334 //! This function clears the CEON bit disabling the operation of the Comparator
335 //! module, saving from excess power consumption.
336 //!
337 //! Modified bits are \b CEON of \b CECTL1 register.
338 //! \return NONE
339 //
340 //*****************************************************************************
341 extern void COMP_E_disableModule(uint32_t comparator);
342
343 //*****************************************************************************
344 //
345 //! Shorts the two input pins chosen during initialization.
346 //!
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
350 //!         - \b COMP_E1
351 //!
352 //! This function sets the bit that shorts the devices attached to the input
353 //! pins chosen from the initialization of the comparator.
354 //!
355 //! Modified bits are \b CESHORT of \b CECTL1 register.
356 //! \return NONE
357 //
358 //*****************************************************************************
359 extern void COMP_E_shortInputs(uint32_t comparator);
360
361 //*****************************************************************************
362 //
363 //! Disables the short of the two input pins chosen during initialization.
364 //!
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
368 //!         - \b COMP_E1
369 //!
370 //! This function clears the bit that shorts the devices attached to the input
371 //! pins chosen from the initialization of the comparator.
372 //!
373 //! Modified bits are \b CESHORT of \b CECTL1 register.
374 //! \return NONE
375 //
376 //*****************************************************************************
377 extern void COMP_E_unshortInputs(uint32_t comparator);
378
379 //*****************************************************************************
380 //
381 //! Disables the input buffer of the selected input port to effectively allow
382 //! for analog signals.
383 //!
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
387 //!         - \b COMP_E1
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.
407 //!
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.
414 //!
415 //! \return NONE
416 //
417 //*****************************************************************************
418 extern void COMP_E_disableInputBuffer(uint32_t comparator,
419         uint_fast16_t inputPort);
420
421 //*****************************************************************************
422 //
423 //! Enables the input buffer of the selected input port to allow for digital
424 //! signals.
425 //!
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
429 //!         - \b COMP_E1
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.
449 //!
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.
454 //!
455 //! \return NONE
456 //
457 //*****************************************************************************
458 extern void COMP_E_enableInputBuffer(uint32_t comparator,
459         uint_fast16_t inputPort);
460
461 //*****************************************************************************
462 //
463 //! Toggles the bit that swaps which terminals the inputs go to, while also
464 //! inverting the output of the comparator.
465 //!
466 //! \param comparator is the instance of the Comparator module. Valid
467 //! parameters vary from part to part, but can include:
468 //!         - \ bCOMP_E0
469 //!         - \ bCOMP_E1
470 //!
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.
474 //!
475 //! Modified bits are \b CEEX of \b CECTL1 register.
476 //! \return NONE
477 //
478 //*****************************************************************************
479 extern void COMP_E_swapIO(uint32_t comparator);
480
481 //*****************************************************************************
482 //
483 //! Returns the output value of the Comparator module.
484 //!
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
488 //!         - \b COMP_E1
489 //!
490 //! Returns the output value of the Comparator module.
491 //!
492 //! \return COMP_E_HIGH or COMP_E_LOW as the output value of the Comparator
493 //!          module.
494 //
495 //*****************************************************************************
496 extern uint8_t COMP_E_outputValue(uint32_t comparator);
497
498 //*****************************************************************************
499 //
500 //! Enables selected Comparator interrupt sources.
501 //!
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
505 //!         - \b COMP_E1
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
510 //!                                                 polarity
511 //!        - \b COMP_E_READY_INTERRUPT - Ready interrupt
512 //!
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.
518 //!
519 //! \return NONE
520 //
521 //*****************************************************************************
522 extern void COMP_E_enableInterrupt(uint32_t comparator, uint_fast16_t mask);
523
524 //*****************************************************************************
525 //
526 //! Disables selected Comparator interrupt sources.
527 //!
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
531 //!         - \b COMP_E1
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
536 //!                                                 polarity
537 //!        - \b COMP_E_READY_INTERRUPT - Ready interrupt
538 //!
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.
542 //!
543 //! \return NONE
544 //
545 //*****************************************************************************
546 extern void COMP_E_disableInterrupt(uint32_t comparator, uint_fast16_t mask);
547
548 //*****************************************************************************
549 //
550 //! Clears Comparator interrupt flags.
551 //!
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
555 //!         - \b COMP_E1
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
562 //!
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.
566 //!
567 //! \return NONE
568 //
569 //*****************************************************************************
570 extern void COMP_E_clearInterruptFlag(uint32_t comparator, uint_fast16_t mask);
571
572 //*****************************************************************************
573 //
574 //! Gets the current Comparator interrupt status.
575 //!
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
579 //!         - \b COMP_E1
580 //!
581 //! This returns the interrupt status for the Comparator module based on which
582 //! flag is passed.
583 //!
584 //! \return The current interrupt flag status for the corresponding mask.
585 //
586 //*****************************************************************************
587 extern uint_fast16_t COMP_E_getInterruptStatus(uint32_t comparator);
588
589 //*****************************************************************************
590 //
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
594 //! ISR.
595 //!
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
599 //!         - \b COMP_E1
600 //!
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.
606 //!
607 //! \return NONE
608 //
609 //*****************************************************************************
610 extern uint_fast16_t COMP_E_getEnabledInterruptStatus(uint32_t comparator);
611
612 //*****************************************************************************
613 //
614 //! Explicitly sets the edge direction that would trigger an interrupt.
615 //!
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
619 //!         - \b COMP_E1
620 //! \param edgeDirection determines which direction the edge would have to go
621 //!       to generate an interrupt based on the non-inverted interrupt flag.
622 //!        Valid values are
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.
632 //!
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
635 //! interrupt.
636 //!
637 //! \return NONE
638 //
639 //*****************************************************************************
640 extern void COMP_E_setInterruptEdgeDirection(uint32_t comparator,
641         uint_fast8_t edgeDirection);
642
643 //*****************************************************************************
644 //
645 //! Toggles the edge direction that would trigger an interrupt.
646 //!
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
650 //!         - \b COMP_E1
651 //!
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.
656 //!
657 //! Modified bits are \b CEIES of \b CECTL1 register.
658 //!
659 //! \return NONE
660 //
661 //*****************************************************************************
662 extern void COMP_E_toggleInterruptEdgeDirection(uint32_t comparator);
663
664 //*****************************************************************************
665 //
666 //! Registers an interrupt handler for the Comparator E interrupt.
667 //!
668 //! \param intHandler is a pointer to the function to be called when the
669 //! Comparator interrupt occurs.
670 //!
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
674 //!         - \b COMP_E1
675 //!
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().
681 //!
682 //! \return None.
683 //
684 //*****************************************************************************
685 extern void COMP_E_registerInterrupt(uint32_t comparator,
686         void (*intHandler)(void));
687
688 //*****************************************************************************
689 //
690 //! Unregisters the interrupt handler for the Comparator E interrupt
691 //!
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
695 //!         - \b COMP_E1
696 //!
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.
700 //!
701 //! \sa Interrupt_registerInterrupt() for important information about
702 //! registering interrupt handlers.
703 //!
704 //! \return None.
705 //
706 //*****************************************************************************
707 extern void COMP_E_unregisterInterrupt(uint32_t comparator);
708
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)
715
716 //*****************************************************************************
717 //
718 // Mark the end of the C bindings section for C++ compilers.
719 //
720 //*****************************************************************************
721 #ifdef __cplusplus
722 }
723 #endif
724
725 //*****************************************************************************
726 //
727 // Close the Doxygen group.
728 //! @}
729 //
730 //*****************************************************************************
731
732
733 #endif /* COMP_E_H_ */