Functions | |
void | EComp_init (uint16_t baseAddress, EComp_initParam *param) |
Initializes the EComp. More... | |
void | EComp_selectHysteresisMode (uint16_t baseAddress, uint16_t hysteresisMode) |
Sets the hysteresis mode. More... | |
void | EComp_selectPowerMode (uint16_t baseAddress, uint16_t powerMode) |
Sets the power mode. More... | |
void | EComp_enable (uint16_t baseAddress) |
Turns on the EComp module. More... | |
void | EComp_disable (uint16_t baseAddress) |
Turns off the EComp module. More... | |
void | EComp_enableInterrupt (uint16_t baseAddress, uint16_t interruptMask) |
Enables selected EComp interrupt sources. More... | |
void | EComp_disableInterrupt (uint16_t baseAddress, uint16_t interruptMask) |
Disables selected EComp interrupt sources. More... | |
void | EComp_clearInterrupt (uint16_t baseAddress, uint16_t interruptFlagMask) |
Clears EComp interrupt flags. More... | |
uint8_t | EComp_getInterruptStatus (uint16_t baseAddress, uint16_t interruptFlagMask) |
Gets the current EComp interrupt status. More... | |
void | EComp_setInterruptEdgeDirection (uint16_t baseAddress, uint16_t edgeDirection) |
Explicitly sets the edge direction that would trigger an interrupt. More... | |
void | EComp_toggleInterruptEdgeDirection (uint16_t baseAddress) |
Toggles the edge direction that would trigger an interrupt. More... | |
uint8_t | EComp_outputValue (uint16_t baseAddress) |
Returns the output value of the EComp module. More... | |
void | EComp_configureDAC (uint16_t baseAddress, EComp_configureDACParam *param) |
Configures the built-in DAC for internal reference. More... | |
void | EComp_enableDAC (uint16_t baseAddress) |
Enables DAC output. More... | |
void | EComp_disableDAC (uint16_t baseAddress) |
Disables DAC output. More... | |
void EComp_clearInterrupt | ( | uint16_t | baseAddress, |
uint16_t | interruptFlagMask | ||
) |
Clears EComp interrupt flags.
The EComp interrupt source is cleared, so that it no longer asserts. The highest interrupt flag is automatically cleared when an interrupt vector generator is used.
baseAddress | is the base address of the ECOMP module. |
interruptFlagMask | Mask value is the logical OR of any of the following:
|
void EComp_configureDAC | ( | uint16_t | baseAddress, |
EComp_configureDACParam * | param | ||
) |
Configures the built-in DAC for internal reference.
This function will configure the built-in DAC register bits including reference voltage and DAC buffer source.
baseAddress | is the base address of the ECOMP module. |
References EComp_configureDACParam::bufferSource, EComp_configureDACParam::firstBufferData, EComp_configureDACParam::referenceVoltage, and EComp_configureDACParam::secondBufferData.
void EComp_disable | ( | uint16_t | baseAddress | ) |
Turns off the EComp module.
This function clears the CPEN bit disabling the operation of the EComp module, saving from excess power consumption.
baseAddress | is the base address of the ECOMP module. |
Modified bits are CPEN of CPCTL1 register.
void EComp_disableDAC | ( | uint16_t | baseAddress | ) |
Disables DAC output.
This function will disable DAC output. When it is disabled, the DAC always output low.
baseAddress | is the base address of the ECOMP module. |
void EComp_disableInterrupt | ( | uint16_t | baseAddress, |
uint16_t | interruptMask | ||
) |
Disables selected EComp interrupt sources.
Disables the indicated EComp interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor. Does not clear interrupt flags.
baseAddress | is the base address of the ECOMP module. |
interruptMask | Mask value is the logical OR of any of the following:
|
void EComp_enable | ( | uint16_t | baseAddress | ) |
Turns on the EComp module.
This function sets the bit that enables the operation of the EComp module.
baseAddress | is the base address of the ECOMP module. |
Modified bits are CPEN of CPCTL1 register.
void EComp_enableDAC | ( | uint16_t | baseAddress | ) |
Enables DAC output.
This function will enable DAC output.
baseAddress | is the base address of the ECOMP module. |
void EComp_enableInterrupt | ( | uint16_t | baseAddress, |
uint16_t | interruptMask | ||
) |
Enables selected EComp interrupt sources.
Enables the indicated EComp interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor. Does not clear interrupt flags.
baseAddress | is the base address of the ECOMP module. |
interruptMask | Mask value is the logical OR of any of the following:
|
uint8_t EComp_getInterruptStatus | ( | uint16_t | baseAddress, |
uint16_t | interruptFlagMask | ||
) |
Gets the current EComp interrupt status.
This returns the interrupt status for the EComp_E module based on which flag is passed.
baseAddress | is the base address of the ECOMP module. |
interruptFlagMask | Mask value is the logical OR of any of the following:
|
void EComp_init | ( | uint16_t | baseAddress, |
EComp_initParam * | param | ||
) |
Initializes the EComp.
Upon successful initialization of the EComp module, this function will have reset all necessary register bits and set the given options in the registers. To actually use the EComp_E module, the EComp_enable() function must be explicitly called before use. (If a Reference Voltage is set to a terminal, the Voltage should be set using the EComp_configureDAC() function.)
baseAddress | is the base address of the ECOMP module. |
References EComp_initParam::invertedOutputPolarity, EComp_initParam::negativeTerminalInput, EComp_initParam::outputFilterEnableAndDelayLevel, and EComp_initParam::positiveTerminalInput.
uint8_t EComp_outputValue | ( | uint16_t | baseAddress | ) |
Returns the output value of the EComp module.
Returns the output value of the EComp module.
baseAddress | is the base address of the ECOMP module. |
void EComp_selectHysteresisMode | ( | uint16_t | baseAddress, |
uint16_t | hysteresisMode | ||
) |
Sets the hysteresis mode.
This function sets the hysteresis mode.
baseAddress | is the base address of the ECOMP module. |
hysteresisMode | decides the hysteresis mode Valid values are:
|
Modified bits are CPHSEL of CPCTL1 register.
void EComp_selectPowerMode | ( | uint16_t | baseAddress, |
uint16_t | powerMode | ||
) |
Sets the power mode.
This function sets the power mode.
baseAddress | is the base address of the ECOMP module. |
powerMode | decides the power mode Valid values are:
|
void EComp_setInterruptEdgeDirection | ( | uint16_t | baseAddress, |
uint16_t | edgeDirection | ||
) |
Explicitly sets the edge direction that would trigger an interrupt.
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.
baseAddress | is the base address of the ECOMP module. |
edgeDirection | determines which direction the edge would have to go to generate an interrupt based on the non-inverted interrupt flag. Valid values are:
|
void EComp_toggleInterruptEdgeDirection | ( | uint16_t | baseAddress | ) |
Toggles the edge direction that would trigger an interrupt.
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.
baseAddress | is the base address of the ECOMP module. |
Modified bits are CPIES of CPCTL1 register.