comp_e.h
Go to the documentation of this file.
1 #ifndef COMP_E_H_
2 #define COMP_E_H_
3 
4 //*****************************************************************************
5 //
8 //
9 //*****************************************************************************
10 
11 //*****************************************************************************
12 //
13 // If building with a C++ compiler, make all of the definitions in this header
14 // have a C binding.
15 //
16 //*****************************************************************************
17 #ifdef __cplusplus
18 extern "C"
19 {
20 #endif
21 
22 #include <stdint.h>
23 #include "register_remap.h"
24 #include <stdbool.h>
25 #include <msp432.h>
26 
27 /* Module defines for Comp */
28 #define COMP_E_CMSIS(x) ((COMP_E0_Type *) x)
29 
30 #define COMP_E_FILTEROUTPUT_OFF 0x00
31 #define COMP_E_FILTEROUTPUT_DLYLVL1 (CEF + CEFDLY_0)
32 #define COMP_E_FILTEROUTPUT_DLYLVL2 (CEF + CEFDLY_1)
33 #define COMP_E_FILTEROUTPUT_DLYLVL3 (CEF + CEFDLY_2)
34 #define COMP_E_FILTEROUTPUT_DLYLVL4 (CEF + CEFDLY_3)
35 
36 #define COMP_E_INPUT0 (0x01)
37 #define COMP_E_INPUT1 (0x02)
38 #define COMP_E_INPUT2 (0x04)
39 #define COMP_E_INPUT3 (0x08)
40 #define COMP_E_INPUT4 (0x10)
41 #define COMP_E_INPUT5 (0x20)
42 #define COMP_E_INPUT6 (0x40)
43 #define COMP_E_INPUT7 (0x80)
44 #define COMP_E_INPUT8 (0x100)
45 #define COMP_E_INPUT9 (0x200)
46 #define COMP_E_INPUT10 (0x400)
47 #define COMP_E_INPUT11 (0x800)
48 #define COMP_E_INPUT12 (0x1000)
49 #define COMP_E_INPUT13 (0x2000)
50 #define COMP_E_INPUT14 (0x4000)
51 #define COMP_E_INPUT15 (0x8000)
52 #define COMP_E_VREF (0x9F)
53 
54 #define COMP_E_NORMALOUTPUTPOLARITY (!(CEOUTPOL))
55 #define COMP_E_INVERTEDOUTPUTPOLARITY (CEOUTPOL)
56 
57 #define COMP_E_REFERENCE_AMPLIFIER_DISABLED (CEREFL_0)
58 #define COMP_E_VREFBASE1_2V (CEREFL_1)
59 #define COMP_E_VREFBASE2_0V (CEREFL_2)
60 #define COMP_E_VREFBASE2_5V (CEREFL_3)
61 
62 #define COMP_E_ACCURACY_STATIC (!CEREFACC)
63 #define COMP_E_ACCURACY_CLOCKED (CEREFACC)
64 
65 #define COMP_E_HIGH_SPEED_MODE (CEPWRMD_0)
66 #define COMP_E_NORMAL_MODE (CEPWRMD_1)
67 #define COMP_E_ULTRA_LOW_POWER_MODE (CEPWRMD_2)
68 
69 #define COMP_E_OUTPUT_INTERRUPT (CEIE)
70 #define COMP_E_INVERTED_POLARITY_INTERRUPT (CEIIE)
71 #define COMP_E_READY_INTERRUPT (CERDYIE)
72 
73 #define COMP_E_OUTPUT_INTERRUPT_FLAG (CEIFG)
74 #define COMP_E_INTERRUPT_FLAG_INVERTED_POLARITY (CEIIFG)
75 #define COMP_E_INTERRUPT_FLAG_READY (CERDYIFG)
76 
77 #define COMP_E_FALLINGEDGE (!(CEIES))
78 #define COMP_E_RISINGEDGE (CEIES)
79 
80 #define COMP_E_LOW (0x0)
81 #define COMP_E_HIGH (CEOUT)
82 
83 //*****************************************************************************
84 //
91 //
92 //*****************************************************************************
93 typedef struct _COMP_E_Config
94 {
95  uint_fast16_t positiveTerminalInput;
96  uint_fast16_t negativeTerminalInput;
98  uint_fast8_t invertedOutputPolarity;
99  uint_fast16_t powerMode;
100 } COMP_E_Config;
101 
102 //*****************************************************************************
103 //
187 //
188 //*****************************************************************************
189 extern bool COMP_E_initModule(uint32_t comparator, const COMP_E_Config *config);
190 
191 //*****************************************************************************
192 //
222 //
223 //*****************************************************************************
224 extern void COMP_E_setReferenceVoltage(uint32_t comparator,
225  uint_fast16_t supplyVoltageReferenceBase,
226  uint_fast16_t lowerLimitSupplyVoltageFractionOf32,
227  uint_fast16_t upperLimitSupplyVoltageFractionOf32);
228 
229 //*****************************************************************************
230 //
248 //
249 //*****************************************************************************
250 extern void COMP_E_setReferenceAccuracy(uint32_t comparator,
251  uint_fast16_t referenceAccuracy);
252 
253 //*****************************************************************************
254 //
269 //
270 //*****************************************************************************
271 extern void COMP_E_setPowerMode(uint32_t comparator, uint_fast16_t powerMode);
272 
273 //*****************************************************************************
274 //
286 //
287 //*****************************************************************************
288 extern void COMP_E_enableModule(uint32_t comparator);
289 
290 //*****************************************************************************
291 //
304 //
305 //*****************************************************************************
306 extern void COMP_E_disableModule(uint32_t comparator);
307 
308 //*****************************************************************************
309 //
322 //
323 //*****************************************************************************
324 extern void COMP_E_shortInputs(uint32_t comparator);
325 
326 //*****************************************************************************
327 //
340 //
341 //*****************************************************************************
342 extern void COMP_E_unshortInputs(uint32_t comparator);
343 
344 //*****************************************************************************
345 //
381 //
382 //*****************************************************************************
383 extern void COMP_E_disableInputBuffer(uint32_t comparator,
384  uint_fast16_t inputPort);
385 
386 //*****************************************************************************
387 //
421 //
422 //*****************************************************************************
423 extern void COMP_E_enableInputBuffer(uint32_t comparator,
424  uint_fast16_t inputPort);
425 
426 //*****************************************************************************
427 //
442 //
443 //*****************************************************************************
444 extern void COMP_E_swapIO(uint32_t comparator);
445 
446 //*****************************************************************************
447 //
459 //
460 //*****************************************************************************
461 extern uint8_t COMP_E_outputValue(uint32_t comparator);
462 
463 //*****************************************************************************
464 //
485 //
486 //*****************************************************************************
487 extern void COMP_E_enableInterrupt(uint32_t comparator, uint_fast16_t mask);
488 
489 //*****************************************************************************
490 //
509 //
510 //*****************************************************************************
511 extern void COMP_E_disableInterrupt(uint32_t comparator, uint_fast16_t mask);
512 
513 //*****************************************************************************
514 //
533 //
534 //*****************************************************************************
535 extern void COMP_E_clearInterruptFlag(uint32_t comparator, uint_fast16_t mask);
536 
537 //*****************************************************************************
538 //
550 //
551 //*****************************************************************************
552 extern uint_fast16_t COMP_E_getInterruptStatus(uint32_t comparator);
553 
554 //*****************************************************************************
555 //
573 //
574 //*****************************************************************************
575 extern uint_fast16_t COMP_E_getEnabledInterruptStatus(uint32_t comparator);
576 
577 //*****************************************************************************
578 //
603 //
604 //*****************************************************************************
605 extern void COMP_E_setInterruptEdgeDirection(uint32_t comparator,
606  uint_fast8_t edgeDirection);
607 
608 //*****************************************************************************
609 //
625 //
626 //*****************************************************************************
627 extern void COMP_E_toggleInterruptEdgeDirection(uint32_t comparator);
628 
629 //*****************************************************************************
630 //
648 //
649 //*****************************************************************************
650 extern void COMP_E_registerInterrupt(uint32_t comparator,
651  void (*intHandler)(void));
652 
653 //*****************************************************************************
654 //
670 //
671 //*****************************************************************************
672 extern void COMP_E_unregisterInterrupt(uint32_t comparator);
673 
674 /* Backwards Compatibility Layer */
675 #define COMP_E_enable(a) COMP_E_enableModule(a)
676 #define COMP_E_disable(a) COMP_E_disableModule(a)
677 #define COMP_E_IOSwap(a) COMP_E_swapIO(a)
678 #define COMP_E_interruptToggleEdgeDirection(a) COMP_E_toggleInterruptEdgeDirection(a)
679 #define COMP_E_clearInterrupt(a,b) COMP_E_clearInterruptFlag(a,b)
680 
681 //*****************************************************************************
682 //
683 // Mark the end of the C bindings section for C++ compilers.
684 //
685 //*****************************************************************************
686 #ifdef __cplusplus
687 }
688 #endif
689 
690 //*****************************************************************************
691 //
692 // Close the Doxygen group.
694 //
695 //*****************************************************************************
696 
697 
698 #endif /* COMP_E_H_ */
void COMP_E_clearInterruptFlag(uint32_t comparator, uint_fast16_t mask)
Definition: comp_e.c:218
uint_fast8_t outputFilterEnableAndDelayLevel
Definition: comp_e.h:97
void COMP_E_setReferenceAccuracy(uint32_t comparator, uint_fast16_t referenceAccuracy)
Definition: comp_e.c:137
void COMP_E_swapIO(uint32_t comparator)
Definition: comp_e.c:191
void COMP_E_enableInterrupt(uint32_t comparator, uint_fast16_t mask)
Definition: comp_e.c:201
void COMP_E_setInterruptEdgeDirection(uint32_t comparator, uint_fast8_t edgeDirection)
Definition: comp_e.c:230
void COMP_E_enableInputBuffer(uint32_t comparator, uint_fast16_t inputPort)
Definition: comp_e.c:184
void COMP_E_unshortInputs(uint32_t comparator)
Definition: comp_e.c:172
void COMP_E_disableModule(uint32_t comparator)
Definition: comp_e.c:162
void COMP_E_unregisterInterrupt(uint32_t comparator)
Definition: comp_e.c:264
Configuration structure for Comparator module. See COMP_E_initModule for parameter documentation...
Definition: comp_e.h:93
uint8_t COMP_E_outputValue(uint32_t comparator)
Definition: comp_e.c:196
uint_fast16_t COMP_E_getInterruptStatus(uint32_t comparator)
Definition: comp_e.c:223
uint_fast16_t positiveTerminalInput
Definition: comp_e.h:95
uint_fast16_t powerMode
Definition: comp_e.h:99
void COMP_E_toggleInterruptEdgeDirection(uint32_t comparator)
Definition: comp_e.c:242
void COMP_E_setReferenceVoltage(uint32_t comparator, uint_fast16_t supplyVoltageReferenceBase, uint_fast16_t lowerLimitSupplyVoltageFractionOf32, uint_fast16_t upperLimitSupplyVoltageFractionOf32)
Definition: comp_e.c:105
struct _COMP_E_Config COMP_E_Config
Type definition for _COMP_E_Config structure.
uint_fast16_t COMP_E_getEnabledInterruptStatus(uint32_t comparator)
Definition: comp_e.c:207
bool COMP_E_initModule(uint32_t comparator, const COMP_E_Config *config)
Definition: comp_e.c:50
void COMP_E_enableModule(uint32_t comparator)
Definition: comp_e.c:157
void COMP_E_disableInputBuffer(uint32_t comparator, uint_fast16_t inputPort)
Definition: comp_e.c:177
void COMP_E_registerInterrupt(uint32_t comparator, void(*intHandler)(void))
Definition: comp_e.c:247
uint_fast8_t invertedOutputPolarity
Definition: comp_e.h:98
void COMP_E_disableInterrupt(uint32_t comparator, uint_fast16_t mask)
Definition: comp_e.c:213
void COMP_E_shortInputs(uint32_t comparator)
Definition: comp_e.c:167
void COMP_E_setPowerMode(uint32_t comparator, uint_fast16_t powerMode)
Definition: comp_e.c:151
uint_fast16_t negativeTerminalInput
Definition: comp_e.h:96

Copyright 2014, Texas Instruments Incorporated