Comparator Interface .
More...
Comparator Interface .
- Since
- 4.0
- Version
- 0.1.0
◆ comparator_callback_t
typedef void(* comparator_callback_t) (const struct device *dev, void *user_data) |
◆ comparator_trigger
#include <zephyr/drivers/comparator.h>
Comparator trigger enumerations.
Enumerator |
---|
COMPARATOR_TRIGGER_NONE | No trigger.
|
COMPARATOR_TRIGGER_RISING_EDGE | Trigger on rising edge of comparator output.
|
COMPARATOR_TRIGGER_FALLING_EDGE | Trigger on falling edge of comparator output.
|
COMPARATOR_TRIGGER_BOTH_EDGES | Trigger on both edges of comparator output.
|
◆ comparator_get_output()
int comparator_get_output |
( |
const struct device * | dev | ) |
|
#include <zephyr/drivers/comparator.h>
Get comparator's output state.
- Parameters
-
- Return values
-
1 | Output state is high |
0 | Output state is low |
-errno | code Failure |
◆ comparator_set_trigger()
#include <zephyr/drivers/comparator.h>
Set comparator's trigger.
- Parameters
-
dev | Comparator device |
trigger | Trigger for signal and callback |
- Return values
-
0 | Successful |
-errno | code Failure |
◆ comparator_set_trigger_callback()
#include <zephyr/drivers/comparator.h>
Set comparator's trigger callback.
- Parameters
-
dev | Comparator device |
callback | Trigger callback |
user_data | User data passed to callback |
- Return values
-
0 | Successful |
-errno | code Failure |
- Note
- Set callback to NULL to disable callback
-
Callback is called immediately if trigger is pending
◆ comparator_trigger_is_pending()
int comparator_trigger_is_pending |
( |
const struct device * | dev | ) |
|
#include <zephyr/drivers/comparator.h>
Check if comparator's trigger is pending and clear it.
- Parameters
-
- Return values
-
1 | Trigger was pending |
0 | Trigger was cleared |
-errno | code Failure |