MSP430 DriverLib for MSP430FR5xx_6xx Devices  2.10.00.09
 All Data Structures Functions Variables Modules Pages
comp_e

Functions

bool Comp_E_init (uint16_t baseAddress, Comp_E_initParam *param)
 Initializes the Comp_E Module. More...
 
void Comp_E_setReferenceVoltage (uint16_t baseAddress, uint16_t supplyVoltageReferenceBase, uint16_t lowerLimitSupplyVoltageFractionOf32, uint16_t upperLimitSupplyVoltageFractionOf32)
 Generates a Reference Voltage to the terminal selected during initialization. More...
 
void Comp_E_setReferenceAccuracy (uint16_t baseAddress, uint16_t referenceAccuracy)
 Sets the reference accuracy. More...
 
void Comp_E_setPowerMode (uint16_t baseAddress, uint16_t powerMode)
 Sets the power mode. More...
 
void Comp_E_enableInterrupt (uint16_t baseAddress, uint16_t interruptMask)
 Enables selected Comp_E interrupt sources. More...
 
void Comp_E_disableInterrupt (uint16_t baseAddress, uint16_t interruptMask)
 Disables selected Comp_E interrupt sources. More...
 
void Comp_E_clearInterrupt (uint16_t baseAddress, uint16_t interruptFlagMask)
 Clears Comp_E interrupt flags. More...
 
uint8_t Comp_E_getInterruptStatus (uint16_t baseAddress, uint16_t interruptFlagMask)
 Gets the current Comp_E interrupt status. More...
 
void Comp_E_setInterruptEdgeDirection (uint16_t baseAddress, uint16_t edgeDirection)
 Explicitly sets the edge direction that would trigger an interrupt. More...
 
void Comp_E_toggleInterruptEdgeDirection (uint16_t baseAddress)
 Toggles the edge direction that would trigger an interrupt. More...
 
void Comp_E_enable (uint16_t baseAddress)
 Turns on the Comp_E module. More...
 
void Comp_E_disable (uint16_t baseAddress)
 Turns off the Comp_E module. More...
 
void Comp_E_shortInputs (uint16_t baseAddress)
 Shorts the two input pins chosen during initialization. More...
 
void Comp_E_unshortInputs (uint16_t baseAddress)
 Disables the short of the two input pins chosen during initialization. More...
 
void Comp_E_disableInputBuffer (uint16_t baseAddress, uint16_t inputPort)
 Disables the input buffer of the selected input port to effectively allow for analog signals. More...
 
void Comp_E_enableInputBuffer (uint16_t baseAddress, uint16_t inputPort)
 Enables the input buffer of the selected input port to allow for digital signals. More...
 
void Comp_E_swapIO (uint16_t baseAddress)
 Toggles the bit that swaps which terminals the inputs go to, while also inverting the output of the Comp_E. More...
 
uint16_t Comp_E_outputValue (uint16_t baseAddress)
 Returns the output value of the Comp_E module. More...
 

Detailed Description

Function Documentation

void Comp_E_clearInterrupt ( uint16_t  baseAddress,
uint16_t  interruptFlagMask 
)

Clears Comp_E interrupt flags.

The Comp_E 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 COMP_E module.
interruptFlagMaskMask value is the logical OR of any of the following:
  • COMP_E_OUTPUT_INTERRUPT_FLAG - Output interrupt flag
  • COMP_E_INTERRUPT_FLAG_INVERTED_POLARITY - Output interrupt flag inverted polarity
  • COMP_E_INTERRUPT_FLAG_READY - Ready interrupt flag
Returns
None
void Comp_E_disable ( uint16_t  baseAddress)

Turns off the Comp_E module.

This function clears the CEON bit disabling the operation of the Comp_E module, saving from excess power consumption.

Parameters
baseAddressis the base address of the COMP_E module.

Modified bits are CEON of CECTL1 register.

Returns
None
void Comp_E_disableInputBuffer ( uint16_t  baseAddress,
uint16_t  inputPort 
)

Disables the input buffer of the selected input port to effectively allow for analog signals.

This function sets the bit to disable the buffer for the specified input port to allow for analog signals from any of the Comp_E input pins. This bit is automatically set when the input is initialized to be used with the Comp_E 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.

Parameters
baseAddressis the base address of the COMP_E module.
inputPortis the port in which the input buffer will be disabled. Mask value is the logical OR of any 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
  • COMP_E_VREF
    Modified bits are CEPDx of CECTL3 register.
Returns
None
void Comp_E_disableInterrupt ( uint16_t  baseAddress,
uint16_t  interruptMask 
)

Disables selected Comp_E interrupt sources.

Disables the indicated Comp_E interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

Parameters
baseAddressis the base address of the COMP_E module.
interruptMaskMask 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
Returns
None
void Comp_E_enable ( uint16_t  baseAddress)

Turns on the Comp_E module.

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

Parameters
baseAddressis the base address of the COMP_E module.
Returns
None
void Comp_E_enableInputBuffer ( uint16_t  baseAddress,
uint16_t  inputPort 
)

Enables the input buffer of the selected input port to allow for digital signals.

This function clears the bit to enable the buffer for the specified input port to allow for digital signals from any of the Comp_E input pins. This should not be reset if there is an analog signal connected to the specified input pin to prevent from unexpected results.

Parameters
baseAddressis the base address of the COMP_E module.
inputPortis the port in which the input buffer will be enabled. Mask value is the logical OR of any 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
  • COMP_E_VREF
    Modified bits are CEPDx of CECTL3 register.
Returns
None
void Comp_E_enableInterrupt ( uint16_t  baseAddress,
uint16_t  interruptMask 
)

Enables selected Comp_E interrupt sources.

Enables the indicated Comp_E 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 COMP_E module.
interruptMaskMask 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
Returns
None
uint8_t Comp_E_getInterruptStatus ( uint16_t  baseAddress,
uint16_t  interruptFlagMask 
)

Gets the current Comp_E interrupt status.

This returns the interrupt status for the Comp_E module based on which flag is passed.

Parameters
baseAddressis the base address of the COMP_E module.
interruptFlagMaskMask value is the logical OR of any of the following:
  • COMP_E_OUTPUT_INTERRUPT_FLAG - Output interrupt flag
  • COMP_E_INTERRUPT_FLAG_INVERTED_POLARITY - Output interrupt flag inverted polarity
  • COMP_E_INTERRUPT_FLAG_READY - Ready interrupt flag
Returns
Logical OR of any of the following:
  • Comp_E_OUTPUT_INTERRUPT_FLAG Output interrupt flag
  • Comp_E_INTERRUPT_FLAG_INVERTED_POLARITY Output interrupt flag inverted polarity
  • Comp_E_INTERRUPT_FLAG_READY Ready interrupt flag
    indicating the status of the masked flags
bool Comp_E_init ( uint16_t  baseAddress,
Comp_E_initParam param 
)

Initializes the Comp_E Module.

Upon successful initialization of the Comp_E module, this function will have reset all necessary register bits and set the given options in the registers. To actually use the Comp_E module, the Comp_E_enable() function must be explicitly called before use. If a Reference Voltage is set to a terminal, the Voltage should be set using the setReferenceVoltage() function.

Parameters
baseAddressis the base address of the COMP_E module.
paramis the pointer to struct for initialization.
Returns
STATUS_SUCCESS or STATUS_FAILURE of the initialization process

References Comp_E_initParam::invertedOutputPolarity, Comp_E_initParam::negTerminalInput, Comp_E_initParam::outputFilterEnableAndDelayLevel, and Comp_E_initParam::posTerminalInput.

uint16_t Comp_E_outputValue ( uint16_t  baseAddress)

Returns the output value of the Comp_E module.

Returns the output value of the Comp_E module.

Parameters
baseAddressis the base address of the COMP_E module.
Returns
One of the following:
  • Comp_E_LOW
  • Comp_E_HIGH
    indicating the output value of the Comp_E module
void Comp_E_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 COMP_E module.
edgeDirectiondetermines 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 [Default] - sets the bit to generate an interrupt when the output of the Comp_E falls from HIGH to LOW if the normal interrupt bit is set(and LOW to HIGH if the inverted interrupt enable bit is set).
  • COMP_E_RISINGEDGE - sets the bit to generate an interrupt when the output of the Comp_E 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.
Returns
None
void Comp_E_setPowerMode ( uint16_t  baseAddress,
uint16_t  powerMode 
)

Sets the power mode.

Parameters
baseAddressis the base address of the COMP_E module.
powerModedecides 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
void Comp_E_setReferenceAccuracy ( uint16_t  baseAddress,
uint16_t  referenceAccuracy 
)

Sets the reference accuracy.

The reference accuracy is set to the desired setting. Clocked is better for low power operations but has a lower accuracy.

Parameters
baseAddressis the base address of the COMP_E module.
referenceAccuracyis the reference accuracy setting of the COMP_E. Valid values are:
  • COMP_E_ACCURACY_STATIC
  • COMP_E_ACCURACY_CLOCKED - for low power / low accuracy
    Modified bits are CEREFACC of CECTL2 register.
Returns
None
void Comp_E_setReferenceVoltage ( uint16_t  baseAddress,
uint16_t  supplyVoltageReferenceBase,
uint16_t  lowerLimitSupplyVoltageFractionOf32,
uint16_t  upperLimitSupplyVoltageFractionOf32 
)

Generates a Reference Voltage to the terminal selected during initialization.

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.

Parameters
baseAddressis the base address of the COMP_E module.
supplyVoltageReferenceBasedecides 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
    Modified bits are CEREFL of CECTL2 register.
lowerLimitSupplyVoltageFractionOf32is the numerator of the equation to generate the reference voltage for the lower limit reference voltage.
Modified bits are CEREF0 of CECTL2 register.
upperLimitSupplyVoltageFractionOf32is the numerator of the equation to generate the reference voltage for the upper limit reference voltage.
Modified bits are CEREF1 of CECTL2 register.
Returns
None
void Comp_E_shortInputs ( uint16_t  baseAddress)

Shorts the two input pins chosen during initialization.

This function sets the bit that shorts the devices attached to the input pins chosen from the initialization of the Comp_E.

Parameters
baseAddressis the base address of the COMP_E module.

Modified bits are CESHORT of CECTL1 register.

Returns
None
void Comp_E_swapIO ( uint16_t  baseAddress)

Toggles the bit that swaps which terminals the inputs go to, while also inverting the output of the Comp_E.

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.

Parameters
baseAddressis the base address of the COMP_E module.
Returns
None
void Comp_E_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 COMP_E module.

Modified bits are CEIES of CECTL1 register.

Returns
None
void Comp_E_unshortInputs ( uint16_t  baseAddress)

Disables the short of the two input pins chosen during initialization.

This function clears the bit that shorts the devices attached to the input pins chosen from the initialization of the Comp_E.

Parameters
baseAddressis the base address of the COMP_E module.

Modified bits are CESHORT of CECTL1 register.

Returns
None

Copyright 2015, Texas Instruments Incorporated