Functions | |
bool | Comp_D_init (uint16_t baseAddress, Comp_D_initParam *param) |
Initializes the Comp_D Module. More... | |
void | Comp_D_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_D_setReferenceAccuracy (uint16_t baseAddress, uint16_t referenceAccuracy) |
Sets the reference accuracy. More... | |
void | Comp_D_enableInterrupt (uint16_t baseAddress, uint16_t interruptMask) |
Enables selected Comparator interrupt sources. More... | |
void | Comp_D_disableInterrupt (uint16_t baseAddress, uint16_t interruptMask) |
Disables selected Comparator interrupt sources. More... | |
void | Comp_D_clearInterrupt (uint16_t baseAddress, uint16_t interruptFlagMask) |
Clears Comparator interrupt flags. More... | |
uint8_t | Comp_D_getInterruptStatus (uint16_t baseAddress, uint16_t interruptFlagMask) |
Gets the current Comparator interrupt status. More... | |
void | Comp_D_setInterruptEdgeDirection (uint16_t baseAddress, uint16_t edgeDirection) |
Explicitly sets the edge direction that would trigger an interrupt. More... | |
void | Comp_D_toggleInterruptEdgeDirection (uint16_t baseAddress) |
Toggles the edge direction that would trigger an interrupt. More... | |
void | Comp_D_enable (uint16_t baseAddress) |
Turns on the Comparator module. More... | |
void | Comp_D_disable (uint16_t baseAddress) |
Turns off the Comparator module. More... | |
void | Comp_D_shortInputs (uint16_t baseAddress) |
Shorts the two input pins chosen during initialization. More... | |
void | Comp_D_unshortInputs (uint16_t baseAddress) |
Disables the short of the two input pins chosen during initialization. More... | |
void | Comp_D_disableInputBuffer (uint16_t baseAddress, uint8_t inputPort) |
Disables the input buffer of the selected input port to effectively allow for analog signals. More... | |
void | Comp_D_enableInputBuffer (uint16_t baseAddress, uint8_t inputPort) |
Enables the input buffer of the selected input port to allow for digital signals. More... | |
void | Comp_D_swapIO (uint16_t baseAddress) |
Toggles the bit that swaps which terminals the inputs go to, while also inverting the output of the comparator. More... | |
uint16_t | Comp_D_outputValue (uint16_t baseAddress) |
Returns the output value of the Comp_D module. More... | |
void Comp_D_clearInterrupt | ( | uint16_t | baseAddress, |
uint16_t | interruptFlagMask | ||
) |
Clears Comparator interrupt flags.
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.
baseAddress | is the base address of the COMP_D module. |
interruptFlagMask | Mask value is the logical OR of any of the following:
|
void Comp_D_disable | ( | uint16_t | baseAddress | ) |
Turns off the Comparator module.
This function clears the CDON bit disabling the operation of the Comparator module, saving from excess power consumption.
baseAddress | is the base address of the COMP_D module. |
void Comp_D_disableInputBuffer | ( | uint16_t | baseAddress, |
uint8_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 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.
baseAddress | is the base address of the COMP_D module. |
inputPort | is the port in which the input buffer will be disabled. Valid values are:
|
void Comp_D_disableInterrupt | ( | uint16_t | baseAddress, |
uint16_t | interruptMask | ||
) |
Disables selected Comparator interrupt sources.
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.
baseAddress | is the base address of the COMP_D module. |
interruptMask | Mask value is the logical OR of any of the following:
|
void Comp_D_enable | ( | uint16_t | baseAddress | ) |
Turns on the Comparator module.
This function sets the bit that enables the operation of the Comparator module.
baseAddress | is the base address of the COMP_D module. |
void Comp_D_enableInputBuffer | ( | uint16_t | baseAddress, |
uint8_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 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.
baseAddress | is the base address of the COMP_D module. |
inputPort | is the port in which the input buffer will be enabled. Valid values are:
|
void Comp_D_enableInterrupt | ( | uint16_t | baseAddress, |
uint16_t | interruptMask | ||
) |
Enables selected Comparator interrupt sources.
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. Does not clear interrupt flags.
baseAddress | is the base address of the COMP_D module. |
interruptMask | Mask value is the logical OR of any of the following:
|
uint8_t Comp_D_getInterruptStatus | ( | uint16_t | baseAddress, |
uint16_t | interruptFlagMask | ||
) |
Gets the current Comparator interrupt status.
This returns the interrupt status for the Comparator module based on which flag is passed.
baseAddress | is the base address of the COMP_D module. |
interruptFlagMask | Mask value is the logical OR of any of the following:
|
bool Comp_D_init | ( | uint16_t | baseAddress, |
Comp_D_initParam * | param | ||
) |
Initializes the Comp_D Module.
Upon successful initialization of the Comp_D module, this function will have reset all necessary register bits and set the given options in the registers. To actually use the Comp_D module, the Comp_D_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.
baseAddress | is the base address of the COMP_D module. |
param | is the pointer to struct for initialization. |
References Comp_D_initParam::invertedOutputPolarity, Comp_D_initParam::negativeTerminalInput, Comp_D_initParam::outputFilterEnableAndDelayLevel, and Comp_D_initParam::positiveTerminalInput.
uint16_t Comp_D_outputValue | ( | uint16_t | baseAddress | ) |
Returns the output value of the Comp_D module.
Returns the output value of the Comp_D module.
baseAddress | is the base address of the COMP_D module. |
void Comp_D_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 COMP_D 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 Comp_D_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.
baseAddress | is the base address of the COMP_D module. |
referenceAccuracy | is the reference accuracy setting of the comparator. Clocked is for low power/low accuracy. Valid values are:
|
void Comp_D_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. Note that the "limit" voltage is the voltage triggers a change in COMP_D value.
baseAddress | is the base address of the COMP_D module. |
supplyVoltageReferenceBase | decides the source and max amount of Voltage that can be used as a reference. Valid values are:
|
lowerLimitSupplyVoltageFractionOf32 | is the numerator of the equation to generate the reference voltage for the lower limit reference voltage. Modified bits are CDREF0 of CDCTL2 register. |
upperLimitSupplyVoltageFractionOf32 | is the numerator of the equation to generate the reference voltage for the upper limit reference voltage. Modified bits are CDREF1 of CDCTL2 register. |
void Comp_D_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 comparator.
baseAddress | is the base address of the COMP_D module. |
void Comp_D_swapIO | ( | uint16_t | baseAddress | ) |
Toggles the bit that swaps which terminals the inputs go to, while also inverting the output of the comparator.
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.
baseAddress | is the base address of the COMP_D module. |
void Comp_D_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 COMP_D module. |
void Comp_D_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 comparator.
baseAddress | is the base address of the COMP_D module. |