analog Comparator Structures - PalouseRobosub/SUBLIBinal GitHub Wiki
Analog Comparator Structures
This page contains information describing the structures defined for the Comparator within SUBLIBinal. It additionally explains the use of each structure and how the parameters should be filled out. Please select the appropriate structure from the list below to be redirected to the appropriate documentation
Structures:
Comparator_Config
Declaration
typedef struct {
Pin input;
Polarity edge;
void *callback;
boolean enable;
float voltage_reference;
} Comparator_Config;
Description This structure is used for configuring a Comparator for use within a users program. All parameters of this structure should be filled out, and it then should be supplied to the initialize_Comparator() function.
Parameters
- Pin input: This parameter specifies which input pin is to be used by the comparator. For available pins, please refer to the Comparator pins chart.
- Polarity edge: This parameter specifies what type of edge will generate an interrupt. Valid input is any Polarity value.
- void * callback: This parameter is a callback function. This function will be called whenever a comparator interrupt is triggered. This function should not return any values or accept any input parameters.
- boolean enable: This value determines whether the analog comparator is turned on or not during initialization.
- float voltage_reference: This value is the voltage reference that should be used for comparison. For example, a value of 1.8 supplied would indicate that the function should attempt to create a voltage as close to 1.8V as it can. Valid input is any value greater than 0 and less than 75% of the input voltage (3.3V). Any value supplied outside these boards will cause the configuration to enable analog input on the external pin for references.