Comparator

Overview

An analog comparator compares the voltages of two analog signals connected to its negative and positive inputs. If the voltage at the positive input is higher than the negative input, the comparator’s output will be high, otherwise, it will be low.

Comparators can typically set a trigger which triggers on output changes. This trigger can either invoke a callback, or its status can be polled.

Related configuration options:

Configuration

Embedded comparators can typically be configured at runtime. When enabled, an initial configuration must be provided using the devicetree. At runtime, comparators can have their configuration updated using device driver specific APIs. The configuration will be applied when the comparator is resumed.

Power management

Comparators are enabled using power management. When resumed, the comparator will actively compare its inputs, producing an output and detecting edges. When suspended, the comparator will be inactive.

Comparator shell

The comparator shell provides the comp command with a set of subcommands for the shell module.

The comp shell command provides the following subcommands:

Related configuration options:

Note

The power management shell can optionally be enabled alongside the comparator shell.

Related configuration options:

API Reference

Comparator Interface