Functions | |
bool | Comp_B_init (uint16_t baseAddress, Comp_B_initParam *param) |
Initializes the Comp_B Module. More... | |
void | Comp_B_configureReferenceVoltage (uint16_t baseAddress, Comp_B_configureReferenceVoltageParam *param) |
Generates a Reference Voltage to the terminal selected during initialization. More... | |
void | Comp_B_enableInterrupt (uint16_t baseAddress, uint16_t interruptMask) |
Enables selected Comp_B interrupt sources. More... | |
void | Comp_B_disableInterrupt (uint16_t baseAddress, uint16_t interruptMask) |
Disables selected Comp_B interrupt sources. More... | |
void | Comp_B_clearInterrupt (uint16_t baseAddress, uint16_t interruptFlagMask) |
Clears Comp_B interrupt flags. More... | |
uint8_t | Comp_B_getInterruptStatus (uint16_t baseAddress, uint16_t interruptFlagMask) |
Gets the current Comp_B interrupt status. More... | |
void | Comp_B_setInterruptEdgeDirection (uint16_t baseAddress, uint16_t edgeDirection) |
Explicitly sets the edge direction that would trigger an interrupt. More... | |
void | Comp_B_toggleInterruptEdgeDirection (uint16_t baseAddress) |
Toggles the edge direction that would trigger an interrupt. More... | |
void | Comp_B_enable (uint16_t baseAddress) |
Turns on the Comp_B module. More... | |
void | Comp_B_disable (uint16_t baseAddress) |
Turns off the Comp_B module. More... | |
void | Comp_B_shortInputs (uint16_t baseAddress) |
Shorts the two input pins chosen during initialization. More... | |
void | Comp_B_unshortInputs (uint16_t baseAddress) |
Disables the short of the two input pins chosen during initialization. More... | |
void | Comp_B_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_B_enableInputBuffer (uint16_t baseAddress, uint8_t inputPort) |
Enables the input buffer of the selected input port to allow for digital signals. More... | |
void | Comp_B_swapIO (uint16_t baseAddress) |
Toggles the bit that swaps which terminals the inputs go to, while also inverting the output of the Comp_B. More... | |
uint16_t | Comp_B_outputValue (uint16_t baseAddress) |
Returns the output value of the Comp_B module. More... | |
void Comp_B_clearInterrupt | ( | uint16_t | baseAddress, |
uint16_t | interruptFlagMask | ||
) |
Clears Comp_B interrupt flags.
The Comp_B 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_B module. |
interruptFlagMask | is a bit mask of the interrupt sources to be cleared. Mask value is the logical OR of any of the following:
|
void Comp_B_configureReferenceVoltage | ( | uint16_t | baseAddress, |
Comp_B_configureReferenceVoltageParam * | param | ||
) |
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.
baseAddress | is the base address of the COMP_B module. |
param | is the pointer to struct for reference voltage configuration. |
References Comp_B_configureReferenceVoltageParam::lowerLimitSupplyVoltageFractionOf32, Comp_B_configureReferenceVoltageParam::referenceAccuracy, Comp_B_configureReferenceVoltageParam::supplyVoltageReferenceBase, and Comp_B_configureReferenceVoltageParam::upperLimitSupplyVoltageFractionOf32.
void Comp_B_disable | ( | uint16_t | baseAddress | ) |
Turns off the Comp_B module.
This function clears the CBON bit disabling the operation of the Comp_B module, saving from excess power consumption.
baseAddress | is the base address of the COMP_B module. |
void Comp_B_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 Comp_B input pins. This bit is automatically set when the input is initialized to be used with the Comp_B 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_B module. |
inputPort | is the port in which the input buffer will be disabled. Valid values are:
|
void Comp_B_disableInterrupt | ( | uint16_t | baseAddress, |
uint16_t | interruptMask | ||
) |
Disables selected Comp_B interrupt sources.
Disables the indicated Comp_B 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_B module. |
interruptMask | is the bit mask of the interrupt sources to be disabled. Mask value is the logical OR of any of the following:
|
void Comp_B_enable | ( | uint16_t | baseAddress | ) |
Turns on the Comp_B module.
This function sets the bit that enables the operation of the Comp_B module.
baseAddress | is the base address of the COMP_B module. |
void Comp_B_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 Comp_B 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_B module. |
inputPort | is the port in which the input buffer will be enabled. Valid values are:
|
void Comp_B_enableInterrupt | ( | uint16_t | baseAddress, |
uint16_t | interruptMask | ||
) |
Enables selected Comp_B interrupt sources.
Enables the indicated Comp_B 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_B module. |
interruptMask | is the bit mask of the interrupt sources to be enabled. Mask value is the logical OR of any of the following:
|
uint8_t Comp_B_getInterruptStatus | ( | uint16_t | baseAddress, |
uint16_t | interruptFlagMask | ||
) |
Gets the current Comp_B interrupt status.
This returns the interrupt status for the Comp_B module based on which flag is passed.
baseAddress | is the base address of the COMP_B module. |
interruptFlagMask | is the masked interrupt flag status to be returned. Mask value is the logical OR of any of the following:
|
bool Comp_B_init | ( | uint16_t | baseAddress, |
Comp_B_initParam * | param | ||
) |
Initializes the Comp_B Module.
Upon successful initialization of the Comp_B module, this function will have reset all necessary register bits and set the given options in the registers. To actually use the Comp_B module, the Comp_B_enable() function must be explicitly called before use. If a Reference Voltage is set to a terminal, the Voltage should be set using the Comp_B_setReferenceVoltage() function.
baseAddress | is the base address of the COMP_B module. |
param | is the pointer to struct for initialization. |
References Comp_B_initParam::invertedOutputPolarity, Comp_B_initParam::negativeTerminalInput, Comp_B_initParam::outputFilterEnableAndDelayLevel, Comp_B_initParam::positiveTerminalInput, and Comp_B_initParam::powerModeSelect.
uint16_t Comp_B_outputValue | ( | uint16_t | baseAddress | ) |
Returns the output value of the Comp_B module.
Returns the output value of the Comp_B module.
baseAddress | is the base address of the COMP_B module. |
void Comp_B_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_B 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_B_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_B.
baseAddress | is the base address of the COMP_B module. |
void Comp_B_swapIO | ( | uint16_t | baseAddress | ) |
Toggles the bit that swaps which terminals the inputs go to, while also inverting the output of the Comp_B.
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_B module. |
void Comp_B_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_B module. |
void Comp_B_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_B.
baseAddress | is the base address of the COMP_B module. |