MSP430 DriverLib for MSP430FR2xx_4xx Devices  2.91.13.01
ecomp

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...
 

Detailed Description

Function Documentation

§ EComp_clearInterrupt()

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.

Parameters
baseAddressis the base address of the ECOMP module.
interruptFlagMaskMask value is the logical OR of any of the following:
  • ECOMP_OUTPUT_INTERRUPT_FLAG - Output interrupt flag
  • ECOMP_INVERTED_POLARITY_INTERRUPT_FLAG - Output interrupt flag inverted polarity
Returns
None

§ EComp_configureDAC()

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.

Parameters
baseAddressis the base address of the ECOMP module.
Returns
None

References EComp_configureDACParam::bufferSource, EComp_configureDACParam::firstBufferData, EComp_configureDACParam::referenceVoltage, and EComp_configureDACParam::secondBufferData.

§ EComp_disable()

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.

Parameters
baseAddressis the base address of the ECOMP module.

Modified bits are CPEN of CPCTL1 register.

Returns
None

§ EComp_disableDAC()

void EComp_disableDAC ( uint16_t  baseAddress)

Disables DAC output.

This function will disable DAC output. When it is disabled, the DAC always output low.

Parameters
baseAddressis the base address of the ECOMP module.
Returns
None

§ EComp_disableInterrupt()

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.

Parameters
baseAddressis the base address of the ECOMP module.
interruptMaskMask value is the logical OR of any of the following:
  • ECOMP_OUTPUT_INTERRUPT - Output interrupt
  • ECOMP_INVERTED_POLARITY_INTERRUPT - Output interrupt inverted polarity
Returns
None

§ EComp_enable()

void EComp_enable ( uint16_t  baseAddress)

Turns on the EComp module.

This function sets the bit that enables the operation of the EComp module.

Parameters
baseAddressis the base address of the ECOMP module.

Modified bits are CPEN of CPCTL1 register.

Returns
None

§ EComp_enableDAC()

void EComp_enableDAC ( uint16_t  baseAddress)

Enables DAC output.

This function will enable DAC output.

Parameters
baseAddressis the base address of the ECOMP module.
Returns
None

§ EComp_enableInterrupt()

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.

Parameters
baseAddressis the base address of the ECOMP module.
interruptMaskMask value is the logical OR of any of the following:
  • ECOMP_OUTPUT_INTERRUPT - Output interrupt
  • ECOMP_INVERTED_POLARITY_INTERRUPT - Output interrupt inverted polarity
Returns
None

§ EComp_getInterruptStatus()

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.

Parameters
baseAddressis the base address of the ECOMP module.
interruptFlagMaskMask value is the logical OR of any of the following:
  • ECOMP_OUTPUT_INTERRUPT_FLAG - Output interrupt flag
  • ECOMP_INVERTED_POLARITY_INTERRUPT_FLAG - Output interrupt flag inverted polarity
Returns
Logical OR of any of the following:
  • ECOMP_OUTPUT_INTERRUPT_FLAG Output interrupt flag
  • ECOMP_INVERTED_POLARITY_INTERRUPT_FLAG Output interrupt flag inverted polarity
    indicating the status of the masked flags

§ EComp_init()

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.)

Parameters
baseAddressis the base address of the ECOMP module.
Returns
None

References EComp_initParam::invertedOutputPolarity, EComp_initParam::negativeTerminalInput, EComp_initParam::outputFilterEnableAndDelayLevel, and EComp_initParam::positiveTerminalInput.

§ EComp_outputValue()

uint8_t EComp_outputValue ( uint16_t  baseAddress)

Returns the output value of the EComp module.

Returns the output value of the EComp module.

Parameters
baseAddressis the base address of the ECOMP module.
Returns
indicating the output value of the EComp module Return one of the following:
  • ECOMP_LOW
  • ECOMP_HIGH
    indicating the output value of the EComp module

§ EComp_selectHysteresisMode()

void EComp_selectHysteresisMode ( uint16_t  baseAddress,
uint16_t  hysteresisMode 
)

Sets the hysteresis mode.

This function sets the hysteresis mode.

Parameters
baseAddressis the base address of the ECOMP module.
hysteresisModedecides the hysteresis mode Valid values are:
  • ECOMP_HYSTERESIS_MODE_DISABLE [Default]
  • ECOMP_HYSTERESIS_MODE_10MV
  • ECOMP_HYSTERESIS_MODE_20MV
  • ECOMP_HYSTERESIS_MODE_30MV

Modified bits are CPHSEL of CPCTL1 register.

Returns
None

§ EComp_selectPowerMode()

void EComp_selectPowerMode ( uint16_t  baseAddress,
uint16_t  powerMode 
)

Sets the power mode.

This function sets the power mode.

Parameters
baseAddressis the base address of the ECOMP module.
powerModedecides the power mode Valid values are:
  • ECOMP_POWER_MODE_HIGH_POWER_HIGH_SPEED [Default]
  • ECOMP_POWER_MODE_LOW_POWER_LOW_SPEED
Returns
None

§ EComp_setInterruptEdgeDirection()

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.

Parameters
baseAddressis the base address of the ECOMP module.
edgeDirectiondetermines which direction the edge would have to go to generate an interrupt based on the non-inverted interrupt flag. Valid values are:
  • ECOMP_OUTPUT_INTERRUPT_RISING_EDGE [Default] - sets the bit to generate an interrupt when the output of the EComp rises from LOW to HIGH if the normal interrupt bit is set(and HIGH to LOW if the inverted interrupt enable bit is set).
  • ECOMP_OUTPUT_INTERRUPT_FALLING_EDGE - sets the bit to generate an interrupt when the output of the EComp falls from HIGH to LOW if the normal interrupt bit is set(and LOW to HIGH if the inverted interrupt enable bit is set).
    Modified bits are CPIES of CPCTL1 register.
Returns
None

§ EComp_toggleInterruptEdgeDirection()

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.

Parameters
baseAddressis the base address of the ECOMP module.

Modified bits are CPIES of CPCTL1 register.

Returns
None

Copyright 2020, Texas Instruments Incorporated