Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
|
Sensor emulator backend API . More...
Functions | |
static bool | emul_sensor_backend_is_supported (const struct emul *target) |
Check if a given sensor emulator supports the backend API. | |
static int | emul_sensor_backend_set_channel (const struct emul *target, struct sensor_chan_spec ch, const q31_t *value, int8_t shift) |
Set an expected value for a given channel on a given sensor emulator. | |
static int | emul_sensor_backend_get_sample_range (const struct emul *target, struct sensor_chan_spec ch, q31_t *lower, q31_t *upper, q31_t *epsilon, int8_t *shift) |
Query an emulator for a channel's supported sample value range and tolerance. | |
static int | emul_sensor_backend_set_attribute (const struct emul *target, struct sensor_chan_spec ch, enum sensor_attribute attribute, const void *value) |
Set the emulator's attribute values. | |
static int | emul_sensor_backend_get_attribute_metadata (const struct emul *target, struct sensor_chan_spec ch, enum sensor_attribute attribute, q31_t *min, q31_t *max, q31_t *increment, int8_t *shift) |
Get metadata about an attribute. | |
Sensor emulator backend API .
|
inlinestatic |
#include <zephyr/drivers/emul_sensor.h>
Get metadata about an attribute.
Information provided by this function includes the minimum/maximum values of the attribute as well as the increment (value per LSB) which can be used as an epsilon when comparing results.
[in] | target | Pointer to emulator instance to operate on |
[in] | ch | The channel to request info for. If ch is unsupported, return '-ENOTSUP' |
[in] | attribute | The attribute to request info for. If attribute is unsupported, return '-ENOTSUP' |
[out] | min | The minimum value the attribute can be set to |
[out] | max | The maximum value the attribute can be set to |
[out] | increment | The value that the attribute increases by for every LSB |
[out] | shift | The shift for min , max , and increment |
|
inlinestatic |
#include <zephyr/drivers/emul_sensor.h>
Query an emulator for a channel's supported sample value range and tolerance.
target | Pointer to emulator instance to operate on | |
ch | The channel to request info for. If ch is unsupported, return -ENOTSUP | |
[out] | lower | Minimum supported sample value in SI units, fixed-point format |
[out] | upper | Maximum supported sample value in SI units, fixed-point format |
[out] | epsilon | Tolerance to use comparing expected and actual values to account for rounding and sensor precision issues. This can usually be set to the minimum sample value step size. Uses SI units and fixed-point format. |
[out] | shift | The shift value (scaling factor) associated with lower , upper , and epsilon . |
#include <zephyr/drivers/emul_sensor.h>
Check if a given sensor emulator supports the backend API.
target | Pointer to emulator instance to query |
target
is NULL.
|
inlinestatic |
#include <zephyr/drivers/emul_sensor.h>
Set the emulator's attribute values.
[in] | target | Pointer to emulator instance to operate on |
[in] | ch | The channel to request info for. If ch is unsupported, return -ENOTSUP |
[in] | attribute | The attribute to set |
[in] | value | the value to use (cast according to the channel/attribute pair) |
|
inlinestatic |
#include <zephyr/drivers/emul_sensor.h>
Set an expected value for a given channel on a given sensor emulator.
target | Pointer to emulator instance to operate on |
ch | Sensor channel to set expected value for |
value | Expected value in fixed-point format using standard SI unit for sensor type |
shift | Shift value (scaling factor) applied to value |