7 #ifndef __MSP430WARE_COMP_B_H__
8 #define __MSP430WARE_COMP_B_H__
12 #ifdef __MSP430_HAS_COMPB__
31 typedef struct Comp_B_initParam {
51 uint8_t positiveTerminalInput;
71 uint8_t negativeTerminalInput;
77 uint16_t powerModeSelect;
87 uint8_t outputFilterEnableAndDelayLevel;
92 uint16_t invertedOutputPolarity;
101 typedef struct Comp_B_configureReferenceVoltageParam {
109 uint16_t supplyVoltageReferenceBase;
112 uint16_t lowerLimitSupplyVoltageFractionOf32;
115 uint16_t upperLimitSupplyVoltageFractionOf32;
121 uint16_t referenceAccuracy;
122 } Comp_B_configureReferenceVoltageParam;
132 #define COMP_B_POWERMODE_HIGHSPEED (CBPWRMD_0)
133 #define COMP_B_POWERMODE_NORMALMODE (CBPWRMD_1)
134 #define COMP_B_POWERMODE_ULTRALOWPOWER (CBPWRMD_2)
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)
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)
183 #define COMP_B_NORMALOUTPUTPOLARITY (!(CBOUTPOL))
184 #define COMP_B_INVERTEDOUTPUTPOLARITY (CBOUTPOL)
192 #define COMP_B_ACCURACY_STATIC (!CBREFACC)
193 #define COMP_B_ACCURACY_CLOCKED (CBREFACC)
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)
212 #define COMP_B_OUTPUT_INT CBIE
213 #define COMP_B_OUTPUTINVERTED_INT CBIIE
223 #define COMP_B_OUTPUT_FLAG CBIFG
224 #define COMP_B_OUTPUTINVERTED_FLAG CBIIFG
232 #define COMP_B_RISINGEDGE (!(CBIES))
233 #define COMP_B_FALLINGEDGE (CBIES)
241 #define COMP_B_LOW (0x0)
242 #define COMP_B_HIGH (CBOUT)
250 #define COMP_B_VREF_AUTO_SELECT 0x0000
251 #define COMP_B_VREF_MANUAL_SELECT CBMRVS
259 #define COMP_B_SELECT_VREF0 0x0000
260 #define COMP_B_SELECT_VREF1 CBMRVL
285 extern bool Comp_B_init(uint16_t baseAddress,
286 Comp_B_initParam *
param);
305 extern void Comp_B_configureReferenceVoltage(uint16_t baseAddress,
306 Comp_B_configureReferenceVoltageParam *
param);
327 extern void Comp_B_enableInterrupt(uint16_t baseAddress,
328 uint16_t interruptMask);
349 extern void Comp_B_disableInterrupt(uint16_t baseAddress,
350 uint16_t interruptMask);
371 extern void Comp_B_clearInterrupt(uint16_t baseAddress,
372 uint16_t interruptFlagMask);
394 extern uint8_t Comp_B_getInterruptStatus(uint16_t baseAddress,
395 uint16_t interruptFlagMask);
422 extern void Comp_B_setInterruptEdgeDirection(uint16_t baseAddress,
423 uint16_t edgeDirection);
439 extern void Comp_B_toggleInterruptEdgeDirection(uint16_t baseAddress);
452 extern void Comp_B_enable(uint16_t baseAddress);
466 extern void Comp_B_disable(uint16_t baseAddress);
480 extern void Comp_B_shortInputs(uint16_t baseAddress);
495 extern void Comp_B_unshortInputs(uint16_t baseAddress);
534 extern void Comp_B_disableInputBuffer(uint16_t baseAddress,
572 extern void Comp_B_enableInputBuffer(uint16_t baseAddress,
590 extern void Comp_B_swapIO(uint16_t baseAddress);
606 extern uint16_t Comp_B_outputValue(uint16_t baseAddress);
635 extern void Comp_B_selectReferenceVoltage(uint16_t baseAddress,
637 uint16_t selectVRef);
MPU_initThreeSegmentsParam param