Analog voltage comparator.
More...
|
bool | COMP_E_initModule (uint32_t comparator, const COMP_E_Config *config) |
|
void | COMP_E_setReferenceVoltage (uint32_t comparator, uint_fast16_t supplyVoltageReferenceBase, uint_fast16_t lowerLimitSupplyVoltageFractionOf32, uint_fast16_t upperLimitSupplyVoltageFractionOf32) |
|
void | COMP_E_setReferenceAccuracy (uint32_t comparator, uint_fast16_t referenceAccuracy) |
|
void | COMP_E_setPowerMode (uint32_t comparator, uint_fast16_t powerMode) |
|
void | COMP_E_enableModule (uint32_t comparator) |
|
void | COMP_E_disableModule (uint32_t comparator) |
|
void | COMP_E_shortInputs (uint32_t comparator) |
|
void | COMP_E_unshortInputs (uint32_t comparator) |
|
void | COMP_E_disableInputBuffer (uint32_t comparator, uint_fast16_t inputPort) |
|
void | COMP_E_enableInputBuffer (uint32_t comparator, uint_fast16_t inputPort) |
|
void | COMP_E_swapIO (uint32_t comparator) |
|
uint8_t | COMP_E_outputValue (uint32_t comparator) |
|
void | COMP_E_enableInterrupt (uint32_t comparator, uint_fast16_t mask) |
|
void | COMP_E_disableInterrupt (uint32_t comparator, uint_fast16_t mask) |
|
void | COMP_E_clearInterruptFlag (uint32_t comparator, uint_fast16_t mask) |
|
uint_fast16_t | COMP_E_getInterruptStatus (uint32_t comparator) |
|
uint_fast16_t | COMP_E_getEnabledInterruptStatus (uint32_t comparator) |
|
void | COMP_E_setInterruptEdgeDirection (uint32_t comparator, uint_fast8_t edgeDirection) |
|
void | COMP_E_toggleInterruptEdgeDirection (uint32_t comparator) |
|
void | COMP_E_registerInterrupt (uint32_t comparator, void(*intHandler)(void)) |
|
void | COMP_E_unregisterInterrupt (uint32_t comparator) |
|
Analog voltage comparator.
Module Operation
The Comparator (Comp) API provides a set of functions for using the SDK COMP_E modules. Functions are provided to initialize the COMP_E modules, setup reference voltages for input, and manage interrupts for the COMP_E modules.
The COMP_E module provides the ability to compare two analog signals and use the output in software and on an output pin. The output represents whether the signal on the positive terminal is higher than the signal on the negative terminal. The COMP_E moduke may be used to generate a hysteresis. There are 16 different inputs that can be used, as well as the ability to short 2 input together. The COMP_E module also has control over the REF_A module to generate a reference voltage as an input.
The COMP_E module can generate multiple interrupts. An interrupt may be asserted for the output, with separate interrupts on whether the output rises, or falls.
Programming Example
The DriverLib package contains a variety of different code examples that demonstrate the usage of the COMP_E module. These code examples are accessible under the examples/ folder of the SDK release as well as through TI Resource Explorer if using Code Composer Studio. These code examples provide a comprehensive list of use cases as well as practical applications involving each module.
Below is a simple example of how to setup the COMP_E module to setup a comparator window with a Vcompare of 1.2v using the internal reference.
First, below is an example of setting up the COMP_E module configuration structure:
Below are the actual DriverLib calls to configure/setup the Comp module:
#define COMP_E_CMSIS |
( |
|
x | ) |
((COMP_E_Type *) x) |
Referenced by COMP_E_clearInterruptFlag(), COMP_E_disableInputBuffer(), COMP_E_disableInterrupt(), COMP_E_disableModule(), COMP_E_enableInputBuffer(), COMP_E_enableInterrupt(), COMP_E_enableModule(), COMP_E_getEnabledInterruptStatus(), COMP_E_getInterruptStatus(), COMP_E_initModule(), COMP_E_outputValue(), COMP_E_setInterruptEdgeDirection(), COMP_E_setPowerMode(), COMP_E_setReferenceAccuracy(), COMP_E_setReferenceVoltage(), COMP_E_shortInputs(), COMP_E_swapIO(), COMP_E_toggleInterruptEdgeDirection(), and COMP_E_unshortInputs().
#define COMP_E_FILTEROUTPUT_OFF 0x00 |
#define COMP_E_FILTEROUTPUT_DLYLVL1 (COMP_E_CTL1_F + COMP_E_CTL1_FDLY_0) |
#define COMP_E_FILTEROUTPUT_DLYLVL2 (COMP_E_CTL1_F + COMP_E_CTL1_FDLY_1) |
#define COMP_E_FILTEROUTPUT_DLYLVL3 (COMP_E_CTL1_F + COMP_E_CTL1_FDLY_2) |
#define COMP_E_FILTEROUTPUT_DLYLVL4 (COMP_E_CTL1_F + COMP_E_CTL1_FDLY_3) |
#define COMP_E_INPUT0 (0x01) |
#define COMP_E_INPUT1 (0x02) |
#define COMP_E_INPUT2 (0x04) |
#define COMP_E_INPUT3 (0x08) |
#define COMP_E_INPUT4 (0x10) |
#define COMP_E_INPUT5 (0x20) |
#define COMP_E_INPUT6 (0x40) |
#define COMP_E_INPUT7 (0x80) |
#define COMP_E_INPUT8 (0x100) |
#define COMP_E_INPUT9 (0x200) |
#define COMP_E_INPUT10 (0x400) |
#define COMP_E_INPUT11 (0x800) |
#define COMP_E_INPUT12 (0x1000) |
#define COMP_E_INPUT13 (0x2000) |
#define COMP_E_INPUT14 (0x4000) |
#define COMP_E_INPUT15 (0x8000) |
#define COMP_E_VREF (0x9F) |
#define COMP_E_NORMALOUTPUTPOLARITY (!(COMP_E_CTL1_OUTPOL)) |
#define COMP_E_INVERTEDOUTPUTPOLARITY (COMP_E_CTL1_OUTPOL) |
#define COMP_E_REFERENCE_AMPLIFIER_DISABLED (COMP_E_CTL2_CEREFL_0) |
#define COMP_E_VREFBASE1_2V (COMP_E_CTL2_CEREFL_1) |
#define COMP_E_VREFBASE2_0V (COMP_E_CTL2_CEREFL_2) |
#define COMP_E_VREFBASE2_5V (COMP_E_CTL2_CEREFL_3) |
#define COMP_E_ACCURACY_STATIC (!COMP_E_CTL2_REFACC) |
#define COMP_E_ACCURACY_CLOCKED (COMP_E_CTL2_REFACC) |
#define COMP_E_HIGH_SPEED_MODE (COMP_E_CTL1_PWRMD_0) |
#define COMP_E_NORMAL_MODE (COMP_E_CTL1_PWRMD_1) |
#define COMP_E_ULTRA_LOW_POWER_MODE (COMP_E_CTL1_PWRMD_2) |
#define COMP_E_OUTPUT_INTERRUPT (COMP_E_INT_IE) |
#define COMP_E_INVERTED_POLARITY_INTERRUPT (COMP_E_INT_IIE) |
#define COMP_E_READY_INTERRUPT (COMP_E_INT_RDYIE) |
#define COMP_E_OUTPUT_INTERRUPT_FLAG (COMP_E_INT_IFG) |
#define COMP_E_INTERRUPT_FLAG_INVERTED_POLARITY (COMP_E_INT_IIFG) |
#define COMP_E_INTERRUPT_FLAG_READY (COMP_E_INT_RDYIFG) |
#define COMP_E_FALLINGEDGE (COMP_E_CTL1_IES) |
#define COMP_E_RISINGEDGE (!(COMP_E_CTL1_IES)) |
#define COMP_E_HIGH (COMP_E_CTL1_OUT) |
bool COMP_E_initModule |
( |
uint32_t |
comparator, |
|
|
const COMP_E_Config * |
config |
|
) |
| |
Initializes the Comparator Module.
- Parameters
-
comparator | is the instance of the Comparator module. Valid parameters vary from part to part, but can include:
- COMP_E0_BASE
- COMP_E1_BASE
|
config | Configuration structure for the Comparator module |
Configuration options for COMP_E_Config structure.
- Parameters
-
positiveTerminalInput | selects the input to the positive terminal. Valid values are
- COMP_E_INPUT0 [Default]
- COMP_E_INPUT1
- COMP_E_INPUT2
- COMP_E_INPUT3
- COMP_E_INPUT4
- COMP_E_INPUT5
- COMP_E_INPUT6
- COMP_E_INPUT7
- COMP_E_INPUT8
- COMP_E_INPUT9
- COMP_E_INPUT10
- COMP_E_INPUT11
- COMP_E_INPUT12
- COMP_E_INPUT13
- COMP_E_INPUT14
- COMP_E_INPUT15
- COMP_E_VREF
Modified bits are CEIPSEL and CEIPEN of CECTL0 register, CERSEL of CECTL2 register, and CEPDx of CECTL3 register.
|
negativeTerminalInput | selects the input to the negative terminal.
Valid values are:
- COMP_E_INPUT0 [Default]
- COMP_E_INPUT1
- COMP_E_INPUT2
- COMP_E_INPUT3
- COMP_E_INPUT4
- COMP_E_INPUT5
- COMP_E_INPUT6
- COMP_E_INPUT7
- COMP_E_INPUT8
- COMP_E_INPUT9
- COMP_E_INPUT10
- COMP_E_INPUT11
- COMP_E_INPUT12
- COMP_E_INPUT13
- COMP_E_INPUT14
- COMP_E_INPUT15
- COMP_E_VREF
Modified bits are CEIMSEL and CEIMEN of CECTL0 register, CERSEL of CECTL2 register, and CEPDx of CECTL3 register.
|
outputFilterEnableAndDelayLevel | controls the output filter delay state, which is either off or enabled with a specified delay level.
Valid values are
- COMP_E_FILTEROUTPUT_OFF [Default]
- COMP_E_FILTEROUTPUT_DLYLVL1
- COMP_E_FILTEROUTPUT_DLYLVL2
- COMP_E_FILTEROUTPUT_DLYLVL3
- COMP_E_FILTEROUTPUT_DLYLVL4
This parameter is device specific and delay levels should be found in the device's datasheet.
Modified bits are CEF and CEFDLY of CECTL1 register.
|
invertedOutputPolarity | controls if the output will be inverted or not. Valid values are
- COMP_E_NORMALOUTPUTPOLARITY - indicates the output should be normal. [Default]
- COMP_E_INVERTEDOUTPUTPOLARITY - the output should be inverted.
Modified bits are CEOUTPOL of CECTL1 register.
|
powerMode | controls the power mode of the module
- COMP_E_HIGH_SPEED_MODE [default]
- COMP_E_NORMAL_MODE
- COMP_E_ULTRA_LOW_POWER_MODE Upon successful initialization of the Comparator module, this function will have reset all necessary register bits and set the given options in the registers. To actually use the comparator module, the COMP_E_enableModule() function must be explicitly called before use. If a Reference Voltage is set to a terminal, the Voltage should be set using the COMP_E_setReferenceVoltage() function.
|
- Returns
- true or false of the initialization process.
References ASSERT, COMP_E_CMSIS, COMP_E_FILTEROUTPUT_DLYLVL4, COMP_E_VREF, _COMP_E_Config::invertedOutputPolarity, _COMP_E_Config::negativeTerminalInput, _COMP_E_Config::outputFilterEnableAndDelayLevel, _COMP_E_Config::positiveTerminalInput, and _COMP_E_Config::powerMode.
void COMP_E_setReferenceVoltage |
( |
uint32_t |
comparator, |
|
|
uint_fast16_t |
supplyVoltageReferenceBase, |
|
|
uint_fast16_t |
lowerLimitSupplyVoltageFractionOf32, |
|
|
uint_fast16_t |
upperLimitSupplyVoltageFractionOf32 |
|
) |
| |
Generates a Reference Voltage to the terminal selected during initialization.
- Parameters
-
comparator | is the instance of the Comparator module. Valid parameters vary from part to part, but can include:
- COMP_E0_BASE
- COMP_E1_BASE
|
supplyVoltageReferenceBase | decides the source and max amount of Voltage that can be used as a reference. Valid values are
- COMP_E_REFERENCE_AMPLIFIER_DISABLED
- COMP_E_VREFBASE1_2V
- COMP_E_VREFBASE2_0V
- COMP_E_VREFBASE2_5V
|
upperLimitSupplyVoltageFractionOf32 | is the numerator of the equation to generate the reference voltage for the upper limit reference voltage. Valid values are between 1 and 32. |
lowerLimitSupplyVoltageFractionOf32 | is the numerator of the equation to generate the reference voltage for the lower limit reference voltage. Valid values are between 1 and 32.
Modified bits are CEREF0 of CECTL2 register. |
Use this function to generate a voltage to serve as a reference to the terminal selected at initialization. The voltage is determined by the equation: Vbase * (Numerator / 32). If the upper and lower limit voltage numerators are equal, then a static reference is defined, whereas they are different then a hysteresis effect is generated.
- Returns
- NONE
References ASSERT, COMP_E_CMSIS, COMP_E_REFERENCE_AMPLIFIER_DISABLED, and COMP_E_VREFBASE2_5V.
void COMP_E_setReferenceAccuracy |
( |
uint32_t |
comparator, |
|
|
uint_fast16_t |
referenceAccuracy |
|
) |
| |
Sets the reference accuracy
- Parameters
-
comparator | is the instance of the Comparator module. Valid parameters vary from part to part, but can include:
- COMP_E0_BASE
- COMP_E1_BASE
|
referenceAccuracy | is the reference accuracy setting of the comparator. Clocked is for low power/low accuracy. Valid values are
- COMP_E_ACCURACY_STATIC
- COMP_E_ACCURACY_CLOCKED
Modified bits are CEREFACC of CECTL2 register.
|
The reference accuracy is set to the desired setting. Clocked is better for low power operations but has a lower accuracy.
- Returns
- NONE
References ASSERT, COMP_E_ACCURACY_CLOCKED, COMP_E_ACCURACY_STATIC, and COMP_E_CMSIS.
void COMP_E_setPowerMode |
( |
uint32_t |
comparator, |
|
|
uint_fast16_t |
powerMode |
|
) |
| |
Sets the power mode
- Parameters
-
comparator | is the instance of the Comparator module. Valid parameters vary from part to part, but can include:
- COMP_E0_BASE
- COMP_E1_BASE
|
powerMode | decides the power mode Valid values are
- COMP_E_HIGH_SPEED_MODE
- COMP_E_NORMAL_MODE
- COMP_E_ULTRA_LOW_POWER_MODE
Modified bits are CEPWRMD of CECTL1 register.
|
- Returns
- NONE
References COMP_E_CMSIS.
void COMP_E_enableModule |
( |
uint32_t |
comparator | ) |
|
Turns on the Comparator module.
- Parameters
-
comparator | is the instance of the Comparator module. Valid parameters vary from part to part, but can include:
- COMP_E0_BASE
- COMP_E1_BASE
|
This function sets the bit that enables the operation of the Comparator module.
- Returns
- NONE
References COMP_E_CMSIS.
void COMP_E_disableModule |
( |
uint32_t |
comparator | ) |
|
Turns off the Comparator module.
- Parameters
-
comparator | is the instance of the Comparator module. Valid parameters vary from part to part, but can include:
- COMP_E0_BASE
- COMP_E1_BASE
|
This function clears the CEON bit disabling the operation of the Comparator module, saving from excess power consumption.
Modified bits are CEON of CECTL1 register.
- Returns
- NONE
References COMP_E_CMSIS.
void COMP_E_shortInputs |
( |
uint32_t |
comparator | ) |
|
Shorts the two input pins chosen during initialization.
- Parameters
-
comparator | is the instance of the Comparator module. Valid parameters vary from part to part, but can include:
- COMP_E0_BASE
- COMP_E1_BASE
|
This function sets the bit that shorts the devices attached to the input pins chosen from the initialization of the comparator.
Modified bits are CESHORT of CECTL1 register.
- Returns
- NONE
References COMP_E_CMSIS.
void COMP_E_unshortInputs |
( |
uint32_t |
comparator | ) |
|
Disables the short of the two input pins chosen during initialization.
- Parameters
-
comparator | is the instance of the Comparator module. Valid parameters vary from part to part, but can include:
- COMP_E0_BASE
- COMP_E1_BASE
|
This function clears the bit that shorts the devices attached to the input pins chosen from the initialization of the comparator.
Modified bits are CESHORT of CECTL1 register.
- Returns
- NONE
References COMP_E_CMSIS.
void COMP_E_disableInputBuffer |
( |
uint32_t |
comparator, |
|
|
uint_fast16_t |
inputPort |
|
) |
| |
Disables the input buffer of the selected input port to effectively allow for analog signals.
- Parameters
-
comparator | is the instance of the Comparator module. Valid parameters vary from part to part, but can include:
- COMP_E0_BASE
- COMP_E1_BASE
|
inputPort | is the port in which the input buffer will be disabled. Valid values are a logical OR of the following:
- COMP_E_INPUT0 [Default]
- COMP_E_INPUT1
- COMP_E_INPUT2
- COMP_E_INPUT3
- COMP_E_INPUT4
- COMP_E_INPUT5
- COMP_E_INPUT6
- COMP_E_INPUT7
- COMP_E_INPUT8
- COMP_E_INPUT9
- COMP_E_INPUT10
- COMP_E_INPUT11
- COMP_E_INPUT12
- COMP_E_INPUT13
- COMP_E_INPUT14
- COMP_E_INPUT15
Modified bits are CEPDx of CECTL3 register.
|
This function sets the bit to disable the buffer for the specified input port to allow for analog signals from any of the comparator input pins. This bit is automatically set when the input is initialized to be used with the comparator module. This function should be used whenever an analog input is connected to one of these pins to prevent parasitic voltage from causing unexpected results.
- Returns
- NONE
References ASSERT, COMP_E_CMSIS, and COMP_E_INPUT15.
void COMP_E_enableInputBuffer |
( |
uint32_t |
comparator, |
|
|
uint_fast16_t |
inputPort |
|
) |
| |
Enables the input buffer of the selected input port to allow for digital signals.
- Parameters
-
comparator | is the instance of the Comparator module. Valid parameters vary from part to part, but can include:
- COMP_E0_BASE
- COMP_E1_BASE
|
inputPort | is the port in which the input buffer will be enabled. Valid values are a logical OR of the following:
- COMP_E_INPUT0 [Default]
- COMP_E_INPUT1
- COMP_E_INPUT2
- COMP_E_INPUT3
- COMP_E_INPUT4
- COMP_E_INPUT5
- COMP_E_INPUT6
- COMP_E_INPUT7
- COMP_E_INPUT8
- COMP_E_INPUT9
- COMP_E_INPUT10
- COMP_E_INPUT11
- COMP_E_INPUT12
- COMP_E_INPUT13
- COMP_E_INPUT14
- COMP_E_INPUT15
Modified bits are CEPDx of CECTL3 register.
|
This function clears the bit to enable the buffer for the specified input port to allow for digital signals from any of the comparator input pins. This should not be reset if there is an analog signal connected to the specified input pin to prevent from unexpected results.
- Returns
- NONE
References ASSERT, COMP_E_CMSIS, and COMP_E_INPUT15.
void COMP_E_swapIO |
( |
uint32_t |
comparator | ) |
|
Toggles the bit that swaps which terminals the inputs go to, while also inverting the output of the comparator.
- Parameters
-
comparator | is the instance of the Comparator module. Valid parameters vary from part to part, but can include:
|
This function toggles the bit that controls which input goes to which terminal. After initialization, this bit is set to 0, after toggling it once the inputs are routed to the opposite terminal and the output is inverted.
Modified bits are CEEX of CECTL1 register.
- Returns
- NONE
References COMP_E_CMSIS.
uint8_t COMP_E_outputValue |
( |
uint32_t |
comparator | ) |
|
Returns the output value of the Comparator module.
- Parameters
-
comparator | is the instance of the Comparator module. Valid parameters vary from part to part, but can include:
- COMP_E0_BASE
- COMP_E1_BASE
|
Returns the output value of the Comparator module.
- Returns
- COMP_E_HIGH or COMP_E_LOW as the output value of the Comparator module.
References COMP_E_CMSIS.
void COMP_E_enableInterrupt |
( |
uint32_t |
comparator, |
|
|
uint_fast16_t |
mask |
|
) |
| |
Enables selected Comparator interrupt sources.
- Parameters
-
comparator | is the instance of the Comparator module. Valid parameters vary from part to part, but can include:
- COMP_E0_BASE
- COMP_E1_BASE
|
mask | is the bit mask of the interrupt sources to be enabled. Mask value is the logical OR of any of the following
- COMP_E_OUTPUT_INTERRUPT - Output interrupt
- COMP_E_INVERTED_POLARITY_INTERRUPT - Output interrupt inverted polarity
- COMP_E_READY_INTERRUPT - Ready interrupt
|
Enables the indicated Comparator interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor. The default trigger for the non-inverted interrupt is a rising edge of the output, this can be changed with the interruptSetEdgeDirection() function.
- Returns
- NONE
References COMP_E_CMSIS.
void COMP_E_disableInterrupt |
( |
uint32_t |
comparator, |
|
|
uint_fast16_t |
mask |
|
) |
| |
Disables selected Comparator interrupt sources.
- Parameters
-
comparator | is the instance of the Comparator module. Valid parameters vary from part to part, but can include:
- COMP_E0_BASE
- COMP_E1_BASE
|
mask | is the bit mask of the interrupt sources to be disabled. Mask value is the logical OR of any of the following
- COMP_E_OUTPUT_INTERRUPT - Output interrupt
- COMP_E_INVERTED_POLARITY_INTERRUPT - Output interrupt inverted polarity
- COMP_E_READY_INTERRUPT - Ready interrupt
|
Disables the indicated Comparator interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.
- Returns
- NONE
References COMP_E_CMSIS.
void COMP_E_clearInterruptFlag |
( |
uint32_t |
comparator, |
|
|
uint_fast16_t |
mask |
|
) |
| |
Clears Comparator interrupt flags.
- Parameters
-
comparator | is the instance of the Comparator module. Valid parameters vary from part to part, but can include:
- COMP_E0_BASE
- COMP_E1_BASE
|
mask | is a bit mask of the interrupt sources to be cleared. Mask value is the logical OR of any of the following
- COMP_E_INTERRUPT_FLAG - Output interrupt flag
- COMP_E_INTERRUPT_FLAG_INVERTED_POLARITY - Output interrupt flag inverted polarity
- COMP_E_INTERRUPT_FLAG_READY - Ready interrupt flag
|
The Comparator interrupt source is cleared, so that it no longer asserts. The highest interrupt flag is automatically cleared when an interrupt vector generator is used.
- Returns
- NONE
References COMP_E_CMSIS.
uint_fast16_t COMP_E_getInterruptStatus |
( |
uint32_t |
comparator | ) |
|
uint_fast16_t COMP_E_getEnabledInterruptStatus |
( |
uint32_t |
comparator | ) |
|
Enables selected Comparator interrupt sources masked with the enabled interrupts. This function is useful to call in ISRs to get a list of pending interrupts that are actually enabled and could have caused the ISR.
- Parameters
-
comparator | is the instance of the Comparator module. Valid parameters vary from part to part, but can include:
- COMP_E0_BASE
- COMP_E1_BASE
|
Enables the indicated Comparator interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor. The default trigger for the non-inverted interrupt is a rising edge of the output, this can be changed with the COMP_E_setInterruptEdgeDirection() function.
- Returns
- NONE
References COMP_E_CMSIS, and COMP_E_getInterruptStatus().
void COMP_E_setInterruptEdgeDirection |
( |
uint32_t |
comparator, |
|
|
uint_fast8_t |
edgeDirection |
|
) |
| |
Explicitly sets the edge direction that would trigger an interrupt.
- Parameters
-
comparator | is the instance of the Comparator module. Valid parameters vary from part to part, but can include:
- COMP_E0_BASE
- COMP_E1_BASE
|
edgeDirection | determines which direction the edge would have to go to generate an interrupt based on the non-inverted interrupt flag. Valid values are
- COMP_E_FALLINGEDGE - sets the bit to generate an interrupt when the output of the comparator falls from HIGH to LOW if the normal interrupt bit is set(and LOW to HIGH if the inverted interrupt enable bit is set). [Default]
- COMP_E_RISINGEDGE - sets the bit to generate an interrupt when the output of the comparator rises from LOW to HIGH if the normal interrupt bit is set(and HIGH to LOW if the inverted interrupt enable bit is set).
Modified bits are CEIES of CECTL1 register.
|
This function will set which direction the output will have to go, whether rising or falling, to generate an interrupt based on a non-inverted interrupt.
- Returns
- NONE
References ASSERT, COMP_E_CMSIS, COMP_E_FALLINGEDGE, and COMP_E_RISINGEDGE.
void COMP_E_toggleInterruptEdgeDirection |
( |
uint32_t |
comparator | ) |
|
Toggles the edge direction that would trigger an interrupt.
- Parameters
-
comparator | is the instance of the Comparator module. Valid parameters vary from part to part, but can include:
- COMP_E0_BASE
- COMP_E1_BASE
|
This function will toggle which direction the output will have to go, whether rising or falling, to generate an interrupt based on a non-inverted interrupt. If the direction was rising, it is now falling, if it was falling, it is now rising.
Modified bits are CEIES of CECTL1 register.
- Returns
- NONE
References COMP_E_CMSIS.
void COMP_E_registerInterrupt |
( |
uint32_t |
comparator, |
|
|
void(*)(void) |
intHandler |
|
) |
| |
Registers an interrupt handler for the Comparator E interrupt.
- Parameters
-
intHandler | is a pointer to the function to be called when the Comparator interrupt occurs. |
comparator | is the instance of the Comparator module. Valid parameters vary from part to part, but can include:
- COMP_E0_BASE
- COMP_E1_BASE
|
This function registers the handler to be called when a Comparator interrupt occurs. This function enables the global interrupt in the interrupt controller; specific Comparator interrupts must be enabled via COMP_E_enableInterrupt(). It is the interrupt handler's responsibility to clear the interrupt source via COMP_E_clearInterruptFlag().
- Returns
- None.
References ASSERT, INT_COMP_E0, INT_COMP_E1, Interrupt_enableInterrupt(), and Interrupt_registerInterrupt().
void COMP_E_unregisterInterrupt |
( |
uint32_t |
comparator | ) |
|
Unregisters the interrupt handler for the Comparator E interrupt
- Parameters
-
comparator | is the instance of the Comparator module. Valid parameters vary from part to part, but can include:
- COMP_E0_BASE
- COMP_E1_BASE
|
This function unregisters the handler to be called when Comparator E interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler no longer is called.
- See Also
- Interrupt_registerInterrupt() for important information about registering interrupt handlers.
- Returns
- None.
References ASSERT, INT_COMP_E0, INT_COMP_E1, Interrupt_disableInterrupt(), and Interrupt_unregisterInterrupt().