This driver for Atmel® | SMART ARM®-based microcontrollers provides an interface for the configuration and management of the device's Analog Comparator functionality, for the comparison of analog voltages against a known reference voltage to determine its relative level.
The following driver API modes are covered by this manual:
The following peripherals are used by this module:
The following devices can use this module:
The outline of this documentation is as follows:
There are no prerequisites for this module.
The Analog Comparator module provides an interface for the comparison of one or more analog voltage inputs (sourced from external or internal inputs) against a known reference voltage, to determine if the unknown voltage is higher or lower than the reference. Additionally, window functions are provided so that two comparators can be connected together to determine if an input is below, inside, above, or outside the two reference points of the window.
Each comparator requires two analog input voltages, a positive and negative channel input. The result of the comparison is a binary true
if the comparator's positive channel input is higher than the comparator's negative input channel, and false
if otherwise.
Driver Feature Macro | Supported devices |
---|---|
FEATURE_AC_HYSTERESIS_LEVEL | SAM L21/L22/C20/C21/R34/R35 |
FEATURE_AC_SYNCBUSY_SCHEME_VERSION_2 | SAM L21/L22/C20/C21/R34/R35 |
FEATURE_AC_RUN_IN_STANDY_EACH_COMPARATOR | SAM L21/L22/C20/C21/R34/R35 |
FEATURE_AC_RUN_IN_STANDY_PAIR_COMPARATOR | SAM D20/L22/D21/D10/D11/R21/DA1/HA1/R34/R35 |
Each comparator module contains one or more comparator pairs, a set of two distinct comparators which can be used independently or linked together for Window Comparator mode. In this latter mode, the two comparator units in a comparator pair are linked together to allow the module to detect if an input voltage is below, inside, above, or outside a window set by the upper and lower threshold voltages set by the two comparators. If not required, window comparison mode can be turned off and the two comparator units can be configured and used separately.
Each comparator unit requires two input voltages, a positive and a negative channel (note that these names refer to the logical operation that the unit performs, and both voltages should be above GND), which are then compared with one another. Both the positive and the negative channel inputs are connected to a pair of multiplexers (MUXes), which allows one of several possible inputs to be selected for each comparator channel.
The exact channels available for each comparator differ for the positive and the negative inputs, but the same MUX choices are available for all comparator units (i.e. all positive MUXes are identical, all negative MUXes are identical). This allows the user application to select which voltages are compared to one another.
When used in window mode, both comparators in the window pair should have their positive channel input MUXes configured to the same input channel, with the negative channel input MUXes used to set the lower and upper window bounds.
The output of each comparator unit can either be used directly with no filtering (giving a lower latency signal, with potentially more noise around the comparison threshold) or be passed through a multiple stage digital majority filter. Several filter lengths are available, with the longer stages producing a more stable result, at the expense of a higher latency.
When output filtering is used in single shot mode, a single trigger of the comparator will automatically perform the required number of samples to produce a correctly filtered result.
To prevent unwanted noise around the threshold where the comparator unit's positive and negative input channels are close in voltage to one another, an optional hysteresis can be used to widen the point at which the output result flips. This mode will prevent a change in the comparison output unless the inputs cross one another beyond the hysteresis gap introduces by this mode.
Comparators can be configured to run in either Single Shot or Continuous sampling modes; when in Single Shot mode, the comparator will only perform a comparison (and any resulting filtering, see Output Filtering) when triggered via a software or event trigger. This mode improves the power efficiency of the system by only performing comparisons when actually required by the application.
For systems requiring a lower latency or more frequent comparisons, continuous mode will place the comparator into continuous sampling mode, which increases the module's power consumption, but decreases the latency between each comparison result by automatically performing a comparison on every cycle of the module's clock.
Each comparator unit is capable of being triggered by both software and hardware triggers. Hardware input events allow for other peripherals to automatically trigger a comparison on demand - for example, a timer output event could be used to trigger comparisons at a desired regular interval.
The module's output events can similarly be used to trigger other hardware modules each time a new comparison result is available. This scheme allows for reduced levels of CPU usage in an application and lowers the overall system response latency by directly triggering hardware peripherals from one another without requiring software intervention.
Physically, the modules are interconnected within the device as shown in the diagram below.
The number of comparator pairs (and, thus, window comparators) within a single hardware instance of the Analog Comparator module is device-specific. Some devices will contain a single comparator pair, while others may have two pairs; refer to your device specific datasheet for details.
For extra information, see Extra Information for AC Driver. This includes:
For a list of examples related to this driver, see Examples for AC Driver.
Modules | |
Related Project(s) | |
In this section you can find all the projects related to the SAM Analog Comparator (AC) Driver. | |
Data Structures | |
struct | ac_chan_config |
Analog Comparator Comparator channel configuration structure. More... | |
struct | ac_config |
Analog Comparator module configuration structure. More... | |
struct | ac_events |
AC event enable/disable structure. More... | |
struct | ac_module |
AC software device instance structure. More... | |
struct | ac_win_config |
Analog Comparator Window configuration structure. More... | |
Typedefs | |
typedef void(* | ac_callback_t )(struct ac_module *const module_inst) |
Type definition for a AC module callback function. More... | |
Enumerations | |
enum | ac_callback { AC_CALLBACK_COMPARATOR_0 = 0, AC_CALLBACK_COMPARATOR_1 = 1, AC_CALLBACK_WINDOW_0 = 4 } |
Enum for possible callback types for the AC module. More... | |
enum | ac_chan_channel { AC_CHAN_CHANNEL_0 = 0, AC_CHAN_CHANNEL_1 = 1, AC_CHAN_CHANNEL_2 = 2, AC_CHAN_CHANNEL_3 = 3 } |
AC comparator channel selection enum. More... | |
enum | ac_chan_filter { AC_CHAN_FILTER_NONE = AC_COMPCTRL_FLEN_OFF, AC_CHAN_FILTER_MAJORITY_3 = AC_COMPCTRL_FLEN_MAJ3, AC_CHAN_FILTER_MAJORITY_5 = AC_COMPCTRL_FLEN_MAJ5 } |
AC channel output filtering configuration enum. More... | |
enum | ac_chan_interrupt_selection { AC_CHAN_INTERRUPT_SELECTION_TOGGLE = AC_COMPCTRL_INTSEL_TOGGLE, AC_CHAN_INTERRUPT_SELECTION_RISING = AC_COMPCTRL_INTSEL_RISING, AC_CHAN_INTERRUPT_SELECTION_FALLING = AC_COMPCTRL_INTSEL_FALLING, AC_CHAN_INTERRUPT_SELECTION_END_OF_COMPARE = AC_COMPCTRL_INTSEL_EOC } |
Channel interrupt selection enum. More... | |
enum | ac_chan_neg_mux { AC_CHAN_NEG_MUX_PIN0 = AC_COMPCTRL_MUXNEG_PIN0, AC_CHAN_NEG_MUX_PIN1 = AC_COMPCTRL_MUXNEG_PIN1, AC_CHAN_NEG_MUX_PIN2 = AC_COMPCTRL_MUXNEG_PIN2, AC_CHAN_NEG_MUX_PIN3 = AC_COMPCTRL_MUXNEG_PIN3, AC_CHAN_NEG_MUX_GND = AC_COMPCTRL_MUXNEG_GND, AC_CHAN_NEG_MUX_SCALED_VCC = AC_COMPCTRL_MUXNEG_VSCALE, AC_CHAN_NEG_MUX_BANDGAP = AC_COMPCTRL_MUXNEG_BANDGAP, AC_CHAN_NEG_MUX_DAC0 = AC_COMPCTRL_MUXNEG_DAC } |
AC channel negative comparator pin input configuration enum. More... | |
enum | ac_chan_output { AC_CHAN_OUTPUT_INTERNAL = AC_COMPCTRL_OUT_OFF, AC_CHAN_OUTPUT_ASYNCRONOUS = AC_COMPCTRL_OUT_ASYNC, AC_CHAN_OUTPUT_SYNCHRONOUS = AC_COMPCTRL_OUT_SYNC } |
AC channel GPIO output routing configuration enum. More... | |
enum | ac_chan_pos_mux { AC_CHAN_POS_MUX_PIN0 = AC_COMPCTRL_MUXPOS_PIN0, AC_CHAN_POS_MUX_PIN1 = AC_COMPCTRL_MUXPOS_PIN1, AC_CHAN_POS_MUX_PIN2 = AC_COMPCTRL_MUXPOS_PIN2, AC_CHAN_POS_MUX_PIN3 = AC_COMPCTRL_MUXPOS_PIN3 } |
AC channel positive comparator pin input configuration enum. More... | |
enum | ac_chan_sample_mode { AC_CHAN_MODE_CONTINUOUS = 0, AC_CHAN_MODE_SINGLE_SHOT = AC_COMPCTRL_SINGLE } |
AC channel input sampling mode configuration enum. More... | |
enum | ac_hysteresis_level { AC_HYSTERESIS_LEVEL_50 = 0, AC_HYSTERESIS_LEVEL_70, AC_HYSTERESIS_LEVEL_90, AC_HYSTERESIS_LEVEL_110 } |
Enum for possible hysteresis level types for AC module. More... | |
enum | ac_win_channel { AC_WIN_CHANNEL_0 = 0, AC_WIN_CHANNEL_1 = 1 } |
AC window channel selection enum. More... | |
enum | ac_win_interrupt_selection { AC_WIN_INTERRUPT_SELECTION_ABOVE = AC_WINCTRL_WINTSEL0_ABOVE, AC_WIN_INTERRUPT_SELECTION_INSIDE = AC_WINCTRL_WINTSEL0_INSIDE, AC_WIN_INTERRUPT_SELECTION_BELOW = AC_WINCTRL_WINTSEL0_BELOW, AC_WIN_INTERRUPT_SELECTION_OUTSIDE = AC_WINCTRL_WINTSEL0_OUTSIDE } |
Window interrupt selection enum. More... | |
Driver Feature Definition | |
Define AC driver feature set according to different device family. | |
#define | FEATURE_AC_HYSTERESIS_LEVEL |
Setting of hysteresis level. More... | |
#define | FEATURE_AC_SYNCBUSY_SCHEME_VERSION_2 |
SYNCBUSY scheme version 2. More... | |
#define | FEATURE_AC_RUN_IN_STANDY_EACH_COMPARATOR |
Run in standby feature for each comparator. More... | |
AC Window Channel Status Flags | |
AC window channel status flags, returned by ac_win_get_status(). | |
#define | AC_WIN_STATUS_UNKNOWN (1UL << 0) |
Unknown output state; the comparator window channel was not ready. More... | |
#define | AC_WIN_STATUS_ABOVE (1UL << 1) |
Window Comparator's input voltage is above the window. More... | |
#define | AC_WIN_STATUS_INSIDE (1UL << 2) |
Window Comparator's input voltage is inside the window. More... | |
#define | AC_WIN_STATUS_BELOW (1UL << 3) |
Window Comparator's input voltage is below the window. More... | |
#define | AC_WIN_STATUS_INTERRUPT_SET (1UL << 4) |
This state reflects the window interrupt flag. More... | |
AC Channel Status Flags | |
AC channel status flags, returned by ac_chan_get_status(). | |
#define | AC_CHAN_STATUS_UNKNOWN (1UL << 0) |
Unknown output state; the comparator channel was not ready. More... | |
#define | AC_CHAN_STATUS_NEG_ABOVE_POS (1UL << 1) |
Comparator's negative input pin is higher in voltage than the positive input pin. More... | |
#define | AC_CHAN_STATUS_POS_ABOVE_NEG (1UL << 2) |
Comparator's positive input pin is higher in voltage than the negative input pin. More... | |
#define | AC_CHAN_STATUS_INTERRUPT_SET (1UL << 3) |
This state reflects the channel interrupt flag. More... | |
Configuration and Initialization | |
enum status_code | ac_reset (struct ac_module *const module_inst) |
enum status_code | ac_init (struct ac_module *const module_inst, Ac *const hw, struct ac_config *const config) |
static bool | ac_is_syncing (struct ac_module *const module_inst) |
Determines if the hardware module(s) are currently synchronizing to the bus. More... | |
static void | ac_get_config_defaults (struct ac_config *const config) |
Initializes all members of an Analog Comparator configuration structure to safe defaults. More... | |
static void | ac_enable (struct ac_module *const module_inst) |
Enables an Analog Comparator that was previously configured. More... | |
static void | ac_disable (struct ac_module *const module_inst) |
Disables an Analog Comparator that was previously enabled. More... | |
static void | ac_enable_events (struct ac_module *const module_inst, struct ac_events *const events) |
Enables an Analog Comparator event input or output. More... | |
static void | ac_disable_events (struct ac_module *const module_inst, struct ac_events *const events) |
Disables an Analog Comparator event input or output. More... | |
Channel Configuration and Initialization | |
static void | ac_chan_get_config_defaults (struct ac_chan_config *const config) |
Initializes all members of an Analog Comparator channel configuration structure to safe defaults. More... | |
enum status_code | ac_chan_set_config (struct ac_module *const module_inst, const enum ac_chan_channel channel, struct ac_chan_config *const config) |
static void | ac_chan_enable (struct ac_module *const module_inst, const enum ac_chan_channel channel) |
Enables an Analog Comparator channel that was previously configured. More... | |
static void | ac_chan_disable (struct ac_module *const module_inst, const enum ac_chan_channel channel) |
Disables an Analog Comparator channel that was previously enabled. More... | |
Channel Control | |
static void | ac_chan_trigger_single_shot (struct ac_module *const module_inst, const enum ac_chan_channel channel) |
Triggers a comparison on a comparator that is configured in single shot mode. More... | |
static bool | ac_chan_is_ready (struct ac_module *const module_inst, const enum ac_chan_channel channel) |
Determines if a given comparator channel is ready for comparisons. More... | |
static uint8_t | ac_chan_get_status (struct ac_module *const module_inst, const enum ac_chan_channel channel) |
Determines the output state of a comparator channel. More... | |
static void | ac_chan_clear_status (struct ac_module *const module_inst, const enum ac_chan_channel channel) |
Clears an interrupt status flag. More... | |
Window Mode Configuration and Initialization | |
static void | ac_win_get_config_defaults (struct ac_win_config *const config) |
Initializes an Analog Comparator window configuration structure to defaults. More... | |
enum status_code | ac_win_set_config (struct ac_module *const module_inst, enum ac_win_channel const win_channel, struct ac_win_config *const config) |
enum status_code | ac_win_enable (struct ac_module *const module_inst, const enum ac_win_channel win_channel) |
void | ac_win_disable (struct ac_module *const module_inst, const enum ac_win_channel win_channel) |
Window Mode Control | |
static bool | ac_win_is_ready (struct ac_module *const module_inst, const enum ac_win_channel win_channel) |
Determines if a given Window Comparator is ready for comparisons. More... | |
uint8_t | ac_win_get_status (struct ac_module *const module_inst, const enum ac_win_channel win_channel) |
static void | ac_win_clear_status (struct ac_module *const module_inst, const enum ac_win_channel win_channel) |
Clears an interrupt status flag. More... | |
#define AC_CHAN_STATUS_INTERRUPT_SET (1UL << 3) |
This state reflects the channel interrupt flag.
When the interrupt flag should be set is configured in ac_chan_set_config(). This state needs to be cleared by the of ac_chan_clear_status().
Referenced by ac_chan_get_status().
#define AC_CHAN_STATUS_NEG_ABOVE_POS (1UL << 1) |
Comparator's negative input pin is higher in voltage than the positive input pin.
Referenced by ac_chan_get_status(), main(), and run_ac_single_shot_test().
#define AC_CHAN_STATUS_POS_ABOVE_NEG (1UL << 2) |
Comparator's positive input pin is higher in voltage than the negative input pin.
Referenced by ac_chan_get_status(), and run_ac_single_shot_test().
#define AC_CHAN_STATUS_UNKNOWN (1UL << 0) |
Unknown output state; the comparator channel was not ready.
Referenced by ac_chan_get_status(), main(), and run_ac_single_shot_test().
#define AC_WIN_STATUS_ABOVE (1UL << 1) |
Window Comparator's input voltage is above the window.
Referenced by main(), and run_ac_window_mode_test().
#define AC_WIN_STATUS_BELOW (1UL << 3) |
Window Comparator's input voltage is below the window.
Referenced by main(), and run_ac_window_mode_test().
#define AC_WIN_STATUS_INSIDE (1UL << 2) |
Window Comparator's input voltage is inside the window.
Referenced by run_ac_window_mode_test().
#define AC_WIN_STATUS_INTERRUPT_SET (1UL << 4) |
This state reflects the window interrupt flag.
When the interrupt flag should be set is configured in ac_win_set_config(). This state needs to be cleared by the of ac_win_clear_status().
#define AC_WIN_STATUS_UNKNOWN (1UL << 0) |
Unknown output state; the comparator window channel was not ready.
Referenced by run_ac_window_mode_test().
#define FEATURE_AC_HYSTERESIS_LEVEL |
Setting of hysteresis level.
#define FEATURE_AC_RUN_IN_STANDY_EACH_COMPARATOR |
Run in standby feature for each comparator.
#define FEATURE_AC_SYNCBUSY_SCHEME_VERSION_2 |
SYNCBUSY scheme version 2.
typedef void(* ac_callback_t)(struct ac_module *const module_inst) |
Type definition for a AC module callback function.
enum ac_callback |
enum ac_chan_channel |
AC comparator channel selection enum.
Enum for the possible comparator channels.
enum ac_chan_filter |
AC channel output filtering configuration enum.
Enum for the possible channel output filtering configurations of an Analog Comparator channel.
Channel interrupt selection enum.
This enum is used to select when a channel interrupt should occur.
enum ac_chan_neg_mux |
AC channel negative comparator pin input configuration enum.
Enum for the possible channel negative pin input of an Analog Comparator channel.
enum ac_chan_output |
AC channel GPIO output routing configuration enum.
Enum for the possible channel GPIO output routing configurations of an Analog Comparator channel.
enum ac_chan_pos_mux |
AC channel positive comparator pin input configuration enum.
Enum for the possible channel positive pin input of an Analog Comparator channel.
enum ac_chan_sample_mode |
AC channel input sampling mode configuration enum.
Enum for the possible channel sampling modes of an Analog Comparator channel.
enum ac_hysteresis_level |
enum ac_win_channel |
Window interrupt selection enum.
This enum is used to select when a window interrupt should occur.
|
inlinestatic |
Clears an interrupt status flag.
This function is used to clear the AC_CHAN_STATUS_INTERRUPT_SET flag it will clear the flag for the channel indicated by the channel argument.
[in] | module_inst | Software instance for the Analog Comparator peripheral |
[in] | channel | Comparator channel to clear |
References Assert.
Referenced by run_ac_single_shot_test(), and run_ac_window_mode_test().
|
inlinestatic |
Disables an Analog Comparator channel that was previously enabled.
Stops an Analog Comparator channel that was previously started via a call to ac_chan_enable().
[in] | module_inst | Software instance for the Analog Comparator peripheral |
[in] | channel | Comparator channel to disable |
References ac_is_syncing(), and Assert.
|
inlinestatic |
Enables an Analog Comparator channel that was previously configured.
Enables an Analog Comparator channel that was previously configured via a call to ac_chan_set_config().
[in] | module_inst | Software instance for the Analog Comparator peripheral |
[in] | channel | Comparator channel to enable |
References ac_is_syncing(), and Assert.
Referenced by configure_ac(), configure_ac_channel(), run_ac_init_test(), setup_ac_callback_mode_test(), and setup_ac_window_mode_test().
|
inlinestatic |
Initializes all members of an Analog Comparator channel configuration structure to safe defaults.
Initializes all members of an Analog Comparator channel configuration structure to safe defaults. This function should be called on all new instances of these configuration structures before being modified by the user application.
The default configuration is as follows:
[out] | config | Channel configuration structure to initialize to default values |
References AC_CHAN_FILTER_MAJORITY_5, AC_CHAN_INTERRUPT_SELECTION_TOGGLE, AC_CHAN_MODE_CONTINUOUS, AC_CHAN_NEG_MUX_SCALED_VCC, AC_CHAN_OUTPUT_INTERNAL, AC_CHAN_POS_MUX_PIN0, AC_HYSTERESIS_LEVEL_50, Assert, ac_chan_config::enable_hysteresis, ac_chan_config::filter, ac_chan_config::hysteresis_level, ac_chan_config::interrupt_selection, ac_chan_config::negative_input, ac_chan_config::output_mode, ac_chan_config::positive_input, ac_chan_config::run_in_standby, ac_chan_config::sample_mode, and ac_chan_config::vcc_scale_factor.
Referenced by configure_ac(), configure_ac_channel(), run_ac_init_test(), setup_ac_callback_mode_test(), and setup_ac_window_mode_test().
|
inlinestatic |
Determines the output state of a comparator channel.
Retrieves the last comparison value (after filtering) of a given comparator. If the comparator was not ready at the time of the check, the comparison result will be indicated as being unknown.
[in] | module_inst | Software instance for the Analog Comparator peripheral |
[in] | channel | Comparator channel to test |
References ac_chan_is_ready(), AC_CHAN_STATUS_INTERRUPT_SET, AC_CHAN_STATUS_NEG_ABOVE_POS, AC_CHAN_STATUS_POS_ABOVE_NEG, AC_CHAN_STATUS_UNKNOWN, and Assert.
Referenced by main(), and run_ac_single_shot_test().
|
inlinestatic |
Determines if a given comparator channel is ready for comparisons.
Checks a comparator channel to see if the comparator is currently ready to begin comparisons.
[in] | module_inst | Software instance for the Analog Comparator peripheral |
[in] | channel | Comparator channel to test |
References Assert.
Referenced by ac_chan_get_status(), ac_win_is_ready(), main(), and run_ac_single_shot_test().
enum status_code ac_chan_set_config | ( | struct ac_module *const | module_inst, |
const enum ac_chan_channel | channel, | ||
struct ac_chan_config *const | config | ||
) |
|
inlinestatic |
Triggers a comparison on a comparator that is configured in single shot mode.
Triggers a single conversion on a comparator configured to compare on demand (single shot mode) rather than continuously.
[in] | module_inst | Software instance for the Analog Comparator peripheral |
[in] | channel | Comparator channel to trigger |
References Assert.
Referenced by main(), run_ac_single_shot_test(), and run_ac_window_mode_test().
|
inlinestatic |
Disables an Analog Comparator that was previously enabled.
Disables an Analog Comparator that was previously started via a call to ac_enable().
[in] | module_inst | Software instance for the Analog Comparator peripheral |
References ac_is_syncing(), and Assert.
|
inlinestatic |
Disables an Analog Comparator event input or output.
Disables one or more input or output events to or from the Analog Comparator module. See ac_events for a list of events this module supports.
[in] | module_inst | Software instance for the Analog Comparator peripheral |
[in] | events | Struct containing flags of events to disable |
References Assert, ac_events::generate_event_on_state, ac_events::generate_event_on_window, i, and ac_events::on_event_sample.
|
inlinestatic |
Enables an Analog Comparator that was previously configured.
Enables an Analog Comparator that was previously configured via a call to ac_init().
[in] | module_inst | Software instance for the Analog Comparator peripheral |
References ac_is_syncing(), and Assert.
Referenced by configure_ac(), main(), run_ac_init_test(), setup_ac_callback_mode_test(), and setup_ac_window_mode_test().
|
inlinestatic |
Enables an Analog Comparator event input or output.
Enables one or more input or output events to or from the Analog Comparator module. See ac_events for a list of events this module supports.
[in] | module_inst | Software instance for the Analog Comparator peripheral |
[in] | events | Struct containing flags of events to enable |
References Assert, ac_events::generate_event_on_state, ac_events::generate_event_on_window, i, and ac_events::on_event_sample.
Referenced by configure_ac().
|
inlinestatic |
Initializes all members of an Analog Comparator configuration structure to safe defaults.
Initializes all members of a given Analog Comparator configuration structure to safe known default values. This function should be called on all new instances of these configuration structures before being modified by the user application.
The default configuration is as follows:
[out] | config | Configuration structure to initialize to default values |
References Assert, GCLK_GENERATOR_0, GCLK_GENERATOR_3, i, and ac_config::source_generator.
Referenced by configure_ac(), run_ac_init_test(), setup_ac_callback_mode_test(), and setup_ac_window_mode_test().
enum status_code ac_init | ( | struct ac_module *const | module_inst, |
Ac *const | hw, | ||
struct ac_config *const | config | ||
) |
Referenced by configure_ac(), run_ac_init_test(), setup_ac_callback_mode_test(), and setup_ac_window_mode_test().
Determines if the hardware module(s) are currently synchronizing to the bus.
Checks to see if the underlying hardware peripheral module(s) are currently synchronizing across multiple clock domains to the hardware bus. This function can be used to delay further operations on a module until such time that it is ready, to prevent blocking delays for synchronization in the user application.
[in] | module_inst | Pointer to the AC software instance struct |
false | If the module has completed synchronization |
ture | If the module synchronization is ongoing |
References Assert.
Referenced by ac_chan_disable(), ac_chan_enable(), ac_disable(), and ac_enable().
enum status_code ac_reset | ( | struct ac_module *const | module_inst | ) |
Referenced by setup_ac_callback_mode_test(), and setup_ac_window_mode_test().
|
inlinestatic |
Clears an interrupt status flag.
This function is used to clear the AC_WIN_STATUS_INTERRUPT_SET flag it will clear the flag for the channel indicated by the win_channel argument.
[in] | module_inst | Software instance for the Analog Comparator peripheral |
[in] | win_channel | Window channel to clear |
References Assert.
Referenced by run_ac_window_mode_test().
void ac_win_disable | ( | struct ac_module *const | module_inst, |
const enum ac_win_channel | win_channel | ||
) |
enum status_code ac_win_enable | ( | struct ac_module *const | module_inst, |
const enum ac_win_channel | win_channel | ||
) |
Referenced by setup_ac_window_mode_test().
|
inlinestatic |
Initializes an Analog Comparator window configuration structure to defaults.
Initializes a given Analog Comparator channel configuration structure to a set of known default values. This function should be called if window interrupts are needed and before ac_win_set_config().
The default configuration is as follows:
[out] | config | Window configuration structure to initialize to default values |
References AC_WIN_INTERRUPT_SELECTION_ABOVE, Assert, and ac_win_config::interrupt_selection.
Referenced by setup_ac_window_mode_test().
uint8_t ac_win_get_status | ( | struct ac_module *const | module_inst, |
const enum ac_win_channel | win_channel | ||
) |
Referenced by main(), and run_ac_window_mode_test().
|
inlinestatic |
Determines if a given Window Comparator is ready for comparisons.
Checks a Window Comparator to see if the both comparators used for window detection is currently ready to begin comparisons.
[in] | module_inst | Software instance for the Analog Comparator peripheral |
[in] | win_channel | Window Comparator channel to test |
References ac_chan_is_ready(), and Assert.
Referenced by run_ac_window_mode_test().
enum status_code ac_win_set_config | ( | struct ac_module *const | module_inst, |
enum ac_win_channel const | win_channel, | ||
struct ac_win_config *const | config | ||
) |
Referenced by setup_ac_window_mode_test().