ComparatorMSP432E4.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 /* !****************************************************************************
34  * @file ComparatorMSP432E4.h
35  * @brief Comparator driver implementation for MSP432E4 family devices
36  *
37  * This Comparator driver is meant to operate on a Comparator peripheral
38  * for MSP432E4.
39  *
40  * Refer to @ref Comparator.h for a complete description of APIs & example use.
41  *
42  *******************************************************************************
43  */
44 
45 #ifndef ti_drivers_comparator_ComparatorMSP432E4__include
46 #define ti_drivers_comparator_ComparatorMSP432E4__include
47 
48 #include <stdint.h>
49 #include <stdbool.h>
50 #include <stddef.h>
51 
52 #include <ti/drivers/dpl/HwiP.h>
54 
55 #include <ti/devices/msp432e4/driverlib/comp.h>
56 
63 #define ComparatorMSP432E4_EVENT_RISING (Comparator_EVENT_RESERVED + 1)
64 #define ComparatorMSP432E4_EVENT_FALLING (Comparator_EVENT_RESERVED + 2)
65 #define ComparatorMSP432E4_EVENT_EDGE (Comparator_EVENT_RESERVED + 3)
66 #define ComparatorMSP432E4_EVENT_HIGH (Comparator_EVENT_RESERVED + 4)
67 #define ComparatorMSP432E4_EVENT_LOW (Comparator_EVENT_RESERVED + 5)
68 
77 #define COMP0_OUTPUT_PIN_PD0 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTD, 0, 0)
78 #define COMP0_OUTPUT_PIN_PL2 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTL, 2, 0)
79 #define COMP1_OUTPUT_PIN_PD1 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTD, 1, 0)
80 #define COMP1_OUTPUT_PIN_PL3 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTL, 3, 0)
81 #define COMP2_OUTPUT_PIN_PD2 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTD, 2, 0)
82 #define COMP_NO_OUTPUT (0)
83 
87 #ifdef __cplusplus
88 extern "C" {
89 #endif
90 
91 
98 typedef enum {
101  ComparatorMSP432E4_REF_0_1375V = COMP_REF_0_1375V,
102  ComparatorMSP432E4_REF_0_275V = COMP_REF_0_275V,
103  ComparatorMSP432E4_REF_0_4125V = COMP_REF_0_4125V,
105  ComparatorMSP432E4_REF_0_6875V = COMP_REF_0_6875V,
106  ComparatorMSP432E4_REF_0_825V = COMP_REF_0_825V,
107  ComparatorMSP432E4_REF_0_928125V = COMP_REF_0_928125V,
108  ComparatorMSP432E4_REF_0_9625V = COMP_REF_0_9625V,
109  ComparatorMSP432E4_REF_1_03125V = COMP_REF_1_03125V,
110  ComparatorMSP432E4_REF_1_134375V = COMP_REF_1_134375V,
112  ComparatorMSP432E4_REF_1_2375V = COMP_REF_1_2375V,
113  ComparatorMSP432E4_REF_1_340625V = COMP_REF_1_340625V,
114  ComparatorMSP432E4_REF_1_375V = COMP_REF_1_375V,
115  ComparatorMSP432E4_REF_1_44375V = COMP_REF_1_44375V,
116  ComparatorMSP432E4_REF_1_5125V = COMP_REF_1_5125V,
117  ComparatorMSP432E4_REF_1_546875V = COMP_REF_1_546875V,
119  ComparatorMSP432E4_REF_1_753125V = COMP_REF_1_753125V,
120  ComparatorMSP432E4_REF_1_7875V = COMP_REF_1_7875V,
121  ComparatorMSP432E4_REF_1_85625V = COMP_REF_1_85625V,
122  ComparatorMSP432E4_REF_1_925V = COMP_REF_1_925V,
123  ComparatorMSP432E4_REF_1_959375V = COMP_REF_1_959375V,
124  ComparatorMSP432E4_REF_2_0625V = COMP_REF_2_0625V,
125  ComparatorMSP432E4_REF_2_165625V = COMP_REF_2_165625V,
126  ComparatorMSP432E4_REF_2_26875V = COMP_REF_2_26875V,
127  ComparatorMSP432E4_REF_2_371875V = COMP_REF_2_371875V
129 
138 typedef enum {
146 
156 typedef enum {
158  ComparatorMSP432E4_INPUT_PIN0 = COMP_ASRCP_PIN0,
161 
179 typedef struct {
181  uint32_t intNum;
182  uint32_t intPriority;
184  uint32_t compNum;
185  ComparatorMSP432E4_PositiveInputChannel positiveTerminal;
186  ComparatorMSP432E4_ADCTriggerLevel triggerLevel;
187  ComparatorMSP432E4_ReferenceLevel refLevel;
189  uint32_t outputPin;
191 
198 typedef struct {
199  bool isOpen; /* Determine if Comparator is open */
200  bool isRunning; /* Determine if Comparator instance is already running */
201  uint32_t controlReg; /* No getter function for comparator settings,
202  record here to simplify get/setParams API */
203  HwiP_Handle hwi;
207 
209 
210 
211 #ifdef __cplusplus
212 }
213 #endif
214 
215 
216 #endif /* COMPARATORMSP432E4_H_ */
const Comparator_FxnTable ComparatorMSP432E4_fxnTable
Definition: ComparatorMSP432E4.h:126
The definition of a comparator function table that contains the required set of functions to control ...
Definition: Comparator.h:453
Definition: ComparatorMSP432E4.h:107
ComparatorMSP432E4 Object.
Definition: ComparatorMSP432E4.h:198
uint32_t outputPin
Definition: ComparatorMSP432E4.h:189
ComparatorMSP432E4 Hardware attributes.
Definition: ComparatorMSP432E4.h:179
void(* Comparator_CallBackFxn)(Comparator_Handle handle, int32_t event)
Comparator callback function.
Definition: Comparator.h:375
HwiP_Handle hwi
Definition: ComparatorMSP432E4.h:203
Definition: ComparatorMSP432E4.h:123
Definition: ComparatorMSP432E4.h:157
Definition: ComparatorMSP432E4.h:114
Definition: ComparatorMSP432E4.h:142
Definition: ComparatorMSP432E4.h:101
Definition: ComparatorMSP432E4.h:124
Definition: ComparatorMSP432E4.h:120
Definition: ComparatorMSP432E4.h:108
ComparatorMSP432E4_PositiveInputChannel positiveTerminal
Definition: ComparatorMSP432E4.h:185
Definition: ComparatorMSP432E4.h:159
ComparatorMSP432E4_ADCTriggerLevel triggerLevel
Definition: ComparatorMSP432E4.h:186
Definition: ComparatorMSP432E4.h:109
Definition: ComparatorMSP432E4.h:112
uint32_t controlReg
Definition: ComparatorMSP432E4.h:201
Definition: ComparatorMSP432E4.h:111
Definition: ComparatorMSP432E4.h:125
Definition: ComparatorMSP432E4.h:144
Definition: ComparatorMSP432E4.h:99
Definition: ComparatorMSP432E4.h:140
uint32_t compNum
Definition: ComparatorMSP432E4.h:184
Definition: ComparatorMSP432E4.h:143
Comparator_InterruptLevel interruptLevel
Definition: ComparatorMSP432E4.h:205
Definition: ComparatorMSP432E4.h:118
Definition: ComparatorMSP432E4.h:119
Definition: ComparatorMSP432E4.h:110
bool isRunning
Definition: ComparatorMSP432E4.h:200
Definition: ComparatorMSP432E4.h:103
Definition: ComparatorMSP432E4.h:106
Definition: ComparatorMSP432E4.h:141
Definition: ComparatorMSP432E4.h:122
ComparatorMSP432E4_PositiveInputChannel
ComparatorMSP432E4 Positive Input Channel These fields are intended to serve as the options for the C...
Definition: ComparatorMSP432E4.h:156
ComparatorMSP432E4_ADCTriggerLevel
ComparatorMSP432E4 Trigger Level These fields are used by ComparatorMSP432E4_HWAttrs to specify the c...
Definition: ComparatorMSP432E4.h:138
Definition: ComparatorMSP432E4.h:113
uint32_t intNum
Definition: ComparatorMSP432E4.h:181
MSP432E4 GPIO driver.
Definition: ComparatorMSP432E4.h:139
Definition: ComparatorMSP432E4.h:116
Definition: ComparatorMSP432E4.h:127
Definition: ComparatorMSP432E4.h:121
ComparatorMSP432E4_ReferenceLevel refLevel
Definition: ComparatorMSP432E4.h:187
bool isOpen
Definition: ComparatorMSP432E4.h:199
Comparator_InterruptLevel
Comparator Interrupt Level.
Definition: Comparator.h:345
Definition: ComparatorMSP432E4.h:117
Comparator_CallBackFxn callbackFxn
Definition: ComparatorMSP432E4.h:204
Definition: ComparatorMSP432E4.h:104
Definition: ComparatorMSP432E4.h:102
ComparatorMSP432E4_ReferenceLevel
ComparatorMSP432E4 Reference Level These fields are used by MSP432E4 HWAttrs to specify the voltage o...
Definition: ComparatorMSP432E4.h:98
Definition: ComparatorMSP432E4.h:100
uint32_t intPriority
Definition: ComparatorMSP432E4.h:182
Definition: ComparatorMSP432E4.h:115
Definition: ComparatorMSP432E4.h:105
Definition: ComparatorMSP432E4.h:158
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale