|
Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
|
Emulated counter backend API. More...
Functions | |
| int | counter_capture_emul_input_set (const struct device *dev, uint8_t chan_id, int level) |
| Set the emulated capture input level on a channel. | |
| static int | counter_capture_emul_input_set_dt (const struct counter_capture_dt_spec *spec, int level) |
| Set the emulated capture input level on a channel from a DT spec. | |
| int | counter_capture_emul_input_get (const struct device *dev, uint8_t chan_id) |
| Get the emulated capture input level on a channel. | |
| static int | counter_capture_emul_input_get_dt (const struct counter_capture_dt_spec *spec) |
| Get the emulated capture input level on a channel from a DT spec. | |
Emulated counter backend API.
Behaviour of the emulated counter capture is application-defined. Tests drive a capture event by setting the emulated input level on a capture channel with counter_capture_emul_input_set. When the level transition matches the edge the channel was configured for (via counter_capture_configure) and the channel is enabled, the registered capture callback is invoked synchronously, much like gpio_emul_input_set fires GPIO interrupt callbacks.
The edges an emulated counter supports are declared in devicetree using the rising-edge and falling-edge boolean properties on the counter node.
#include <zephyr/drivers/counter/counter_capture_emul.h>
Get the emulated capture input level on a channel.
| dev | Emulated counter device |
| chan_id | Capture channel ID |
chan_id is out of range
|
inlinestatic |
#include <zephyr/drivers/counter/counter_capture_emul.h>
Get the emulated capture input level on a channel from a DT spec.
Equivalent to:
counter_capture_emul_input_get(spec->dev, spec->chan_id);
| spec | Counter capture DT spec |
#include <zephyr/drivers/counter/counter_capture_emul.h>
Set the emulated capture input level on a channel.
Drives level on the emulated capture input of chan_id. If the resulting edge matches the channel's configured capture flags and the channel is enabled, the capture callback is invoked synchronously with the current counter value.
| dev | Emulated counter device |
| chan_id | Capture channel ID |
| level | New input level (0 or non-zero) |
chan_id is out of range
|
inlinestatic |
#include <zephyr/drivers/counter/counter_capture_emul.h>
Set the emulated capture input level on a channel from a DT spec.
Equivalent to:
counter_capture_emul_input_set(spec->dev, spec->chan_id, level);
| spec | Counter capture DT spec |
| level | New input level (0 or non-zero) |