Zephyr API Documentation
3.5.0
A Scalable Open Source RTOS
|
|
3.5.0 |
Sensing Subsystem API. More...
Data Structures | |
struct | sensing_sensor_version |
Sensor Version. More... | |
struct | sensing_sensor_info |
Sensor basic constant information. More... | |
struct | sensing_callback_list |
Sensing subsystem event callback list. More... | |
struct | sensing_sensor_config |
Sensing subsystem sensor configure, including interval, sensitivity, latency. More... | |
Macros | |
#define | SENSING_SENSOR_VERSION(_major, _minor, _hotfix, _build) |
#define | SENSING_SENSOR_FLAG_REPORT_ON_EVENT BIT(0) |
Sensor flag indicating if this sensor is on event reporting data. | |
#define | SENSING_SENSOR_FLAG_REPORT_ON_CHANGE BIT(1) |
Sensor flag indicating if this sensor is on change reporting data. | |
Typedefs | |
typedef void * | sensing_sensor_handle_t |
Define Sensing subsystem sensor handle. | |
typedef void(* | sensing_data_event_t) (sensing_sensor_handle_t handle, const void *buf) |
Sensor data event receive callback. | |
Enumerations | |
enum | sensing_sensor_state { SENSING_SENSOR_STATE_READY = 0 , SENSING_SENSOR_STATE_OFFLINE = 1 } |
Sensing subsystem sensor state. More... | |
enum | sensing_sensor_attribute { SENSING_SENSOR_ATTRIBUTE_INTERVAL = 0 , SENSING_SENSOR_ATTRIBUTE_SENSITIVITY = 1 , SENSING_SENSOR_ATTRIBUTE_LATENCY = 2 , SENSING_SENSOR_ATTRIBUTE_MAX } |
Sensing subsystem sensor config attribute. More... | |
Functions | |
int | sensing_get_sensors (int *num_sensors, const struct sensing_sensor_info **info) |
Get all supported sensor instances' information. | |
int | sensing_open_sensor (const struct sensing_sensor_info *info, const struct sensing_callback_list *cb_list, sensing_sensor_handle_t *handle) |
Open sensor instance by sensing sensor info. | |
int | sensing_open_sensor_by_dt (const struct device *dev, const struct sensing_callback_list *cb_list, sensing_sensor_handle_t *handle) |
Open sensor instance by device. | |
int | sensing_close_sensor (sensing_sensor_handle_t *handle) |
Close sensor instance. | |
int | sensing_set_config (sensing_sensor_handle_t handle, struct sensing_sensor_config *configs, int count) |
Set current config items to Sensing subsystem. | |
int | sensing_get_config (sensing_sensor_handle_t handle, struct sensing_sensor_config *configs, int count) |
Get current config items from Sensing subsystem. | |
const struct sensing_sensor_info * | sensing_get_sensor_info (sensing_sensor_handle_t handle) |
Get sensor information from sensor instance handle. | |
Sensing Subsystem API.
#define SENSING_SENSOR_FLAG_REPORT_ON_CHANGE BIT(1) |
#include <zephyr/sensing/sensing.h>
Sensor flag indicating if this sensor is on change reporting data.
Reporting sensor data when the sensor data changes.
Exclusive with SENSING_SENSOR_FLAG_REPORT_ON_EVENT
#define SENSING_SENSOR_FLAG_REPORT_ON_EVENT BIT(0) |
#include <zephyr/sensing/sensing.h>
Sensor flag indicating if this sensor is on event reporting data.
Reporting sensor data when the sensor event occurs, such as a motion detect sensor reporting a motion or motionless detected event.
#define SENSING_SENSOR_VERSION | ( | _major, | |
_minor, | |||
_hotfix, | |||
_build | |||
) |
#include <zephyr/sensing/sensing.h>
typedef void(* sensing_data_event_t) (sensing_sensor_handle_t handle, const void *buf) |
#include <zephyr/sensing/sensing.h>
Sensor data event receive callback.
handle | The sensor instance handle. |
buf | The data buffer with sensor data. |
typedef void* sensing_sensor_handle_t |
#include <zephyr/sensing/sensing.h>
Define Sensing subsystem sensor handle.
#include <zephyr/sensing/sensing.h>
Sensing subsystem sensor config attribute.
Enumerator | |
---|---|
SENSING_SENSOR_ATTRIBUTE_INTERVAL | |
SENSING_SENSOR_ATTRIBUTE_SENSITIVITY | |
SENSING_SENSOR_ATTRIBUTE_LATENCY | |
SENSING_SENSOR_ATTRIBUTE_MAX |
enum sensing_sensor_state |
#include <zephyr/sensing/sensing.h>
Sensing subsystem sensor state.
Enumerator | |
---|---|
SENSING_SENSOR_STATE_READY | |
SENSING_SENSOR_STATE_OFFLINE |
int sensing_close_sensor | ( | sensing_sensor_handle_t * | handle | ) |
#include <zephyr/sensing/sensing.h>
Close sensor instance.
handle | The sensor instance handle need to close. |
int sensing_get_config | ( | sensing_sensor_handle_t | handle, |
struct sensing_sensor_config * | configs, | ||
int | count | ||
) |
#include <zephyr/sensing/sensing.h>
Get current config items from Sensing subsystem.
handle | The sensor instance handle. |
configs | The configs to be get according to config attribute. |
count | count of configs. |
const struct sensing_sensor_info * sensing_get_sensor_info | ( | sensing_sensor_handle_t | handle | ) |
#include <zephyr/sensing/sensing.h>
Get sensor information from sensor instance handle.
handle | The sensor instance handle. |
int sensing_get_sensors | ( | int * | num_sensors, |
const struct sensing_sensor_info ** | info | ||
) |
#include <zephyr/sensing/sensing.h>
Get all supported sensor instances' information.
This API just returns read only information of sensor instances, pointer info will directly point to internal buffer, no need for caller to allocate buffer, no side effect to sensor instances.
num_sensors | Get number of sensor instances. |
info | For receiving sensor instances' information array pointer. |
int sensing_open_sensor | ( | const struct sensing_sensor_info * | info, |
const struct sensing_callback_list * | cb_list, | ||
sensing_sensor_handle_t * | handle | ||
) |
#include <zephyr/sensing/sensing.h>
Open sensor instance by sensing sensor info.
Application clients use it to open a sensor instance and get its handle. Support multiple Application clients for open same sensor instance, in this case, the returned handle will different for different clients. meanwhile, also register sensing callback list
info | The sensor info got from sensing_get_sensors |
cb_list | callback list to be registered to sensing. |
handle | The opened instance handle, if failed will be set to NULL. |
int sensing_open_sensor_by_dt | ( | const struct device * | dev, |
const struct sensing_callback_list * | cb_list, | ||
sensing_sensor_handle_t * | handle | ||
) |
#include <zephyr/sensing/sensing.h>
Open sensor instance by device.
Application clients use it to open a sensor instance and get its handle. Support multiple Application clients for open same sensor instance, in this case, the returned handle will different for different clients. meanwhile, also register sensing callback list.
dev | pointer device get from device tree. |
cb_list | callback list to be registered to sensing. |
handle | The opened instance handle, if failed will be set to NULL. |
int sensing_set_config | ( | sensing_sensor_handle_t | handle, |
struct sensing_sensor_config * | configs, | ||
int | count | ||
) |
#include <zephyr/sensing/sensing.h>
Set current config items to Sensing subsystem.
handle | The sensor instance handle. |
configs | The configs to be set according to config attribute. |
count | count of configs. |