Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Sensing Sensor API

Topics

 Sensor Callbacks
 
 

Data Structures

struct  sensing_sensor_register_info
 Sensor registration information. More...
 

Macros

#define SENSING_SENSORS_DT_DEFINE(node, reg_ptr, cb_list_ptr, init_fn, pm_device, data_ptr, cfg_ptr, level, prio, api_ptr, ...)
 Like SENSOR_DEVICE_DT_DEFINE() with sensing specifics.
 
#define SENSING_SENSORS_DT_INST_DEFINE(inst, ...)
 Like SENSING_SENSORS_DT_DEFINE() for an instance of a DT_DRV_COMPAT compatible.
 

Functions

int sensing_sensor_get_reporters (const struct device *dev, int type, sensing_sensor_handle_t *reporter_handles, int max_handles)
 Get reporter handles of a given sensor instance by sensor type.
 
int sensing_sensor_get_reporters_count (const struct device *dev, int type)
 Get reporters count of a given sensor instance by sensor type.
 
int sensing_sensor_get_state (const struct device *dev, enum sensing_sensor_state *state)
 Get this sensor's state.
 

Detailed Description

Sensing Sensor API .

Macro Definition Documentation

◆ SENSING_SENSORS_DT_DEFINE

#define SENSING_SENSORS_DT_DEFINE ( node,
reg_ptr,
cb_list_ptr,
init_fn,
pm_device,
data_ptr,
cfg_ptr,
level,
prio,
api_ptr,
... )

#include <zephyr/sensing/sensing_sensor.h>

Value:
data_ptr, cfg_ptr, level, prio, \
api_ptr, __VA_ARGS__); \
SENSING_CONNECTIONS_DEFINE(node, \
DT_PROP_LEN_OR(node, reporters, 0), \
cb_list_ptr); \
SENSING_SENSORS_DEFINE(node, reg_ptr, cb_list_ptr);
#define DT_PROP_LEN_OR(node_id, prop, default_value)
Like DT_PROP_LEN(), but with a fallback to default_value.
Definition devicetree.h:802
#define SENSOR_DEVICE_DT_DEFINE(node_id, init_fn, pm_device, data_ptr, cfg_ptr, level, prio, api_ptr,...)
Like DEVICE_DT_DEFINE() with sensor specifics.
Definition sensor.h:1422
Runtime PM info for device with generic PM.
Definition device.h:163

Like SENSOR_DEVICE_DT_DEFINE() with sensing specifics.

Defines a sensor which implements the sensor API. May define an element in the sensing sensor iterable section used to enumerate all sensing sensors.

Parameters
nodeThe devicetree node identifier.
reg_ptrPointer to the device's sensing_sensor_register_info.
cb_list_ptrPointer to sensing callback list.
init_fnName of the init function of the driver.
pm_devicePM device resources reference (NULL if device does not use PM).
data_ptrPointer to the device's private data.
cfg_ptrThe address to the structure containing the configuration information for this instance of the driver.
levelThe initialization level. See SYS_INIT() for details.
prioPriority within the selected initialization level. See SYS_INIT() for details.
api_ptrProvides an initial pointer to the API function struct used by the driver. Can be NULL.

◆ SENSING_SENSORS_DT_INST_DEFINE

#define SENSING_SENSORS_DT_INST_DEFINE ( inst,
... )

#include <zephyr/sensing/sensing_sensor.h>

Value:
#define DT_DRV_INST(inst)
Node identifier for an instance of a DT_DRV_COMPAT compatible.
Definition devicetree.h:3869
#define SENSING_SENSORS_DT_DEFINE(node, reg_ptr, cb_list_ptr, init_fn, pm_device, data_ptr, cfg_ptr, level, prio, api_ptr,...)
Like SENSOR_DEVICE_DT_DEFINE() with sensing specifics.
Definition sensing_sensor.h:369

Like SENSING_SENSORS_DT_DEFINE() for an instance of a DT_DRV_COMPAT compatible.

Parameters
instinstance number. This is replaced by DT_DRV_COMPAT(inst) in the call to SENSING_SENSORS_DT_DEFINE().
...other parameters as expected by SENSING_SENSORS_DT_DEFINE().

Function Documentation

◆ sensing_sensor_get_reporters()

int sensing_sensor_get_reporters ( const struct device * dev,
int type,
sensing_sensor_handle_t * reporter_handles,
int max_handles )

#include <zephyr/sensing/sensing_sensor.h>

Get reporter handles of a given sensor instance by sensor type.

Parameters
devThe sensor instance device structure.
typeThe given type, SENSING_SENSOR_TYPE_ALL to get reporters with all types.
max_handlesThe max count of the reporter_handles array input. Can get real count number via sensing_sensor_get_reporters_count
reporter_handlesInput handles array for receiving found reporter sensor instances
Returns
number of reporters found, 0 returned if not found.

◆ sensing_sensor_get_reporters_count()

int sensing_sensor_get_reporters_count ( const struct device * dev,
int type )

#include <zephyr/sensing/sensing_sensor.h>

Get reporters count of a given sensor instance by sensor type.

Parameters
devThe sensor instance device structure.
typeThe sensor type for checking, SENSING_SENSOR_TYPE_ALL
Returns
Count of reporters by type, 0 returned if no reporters by type.

◆ sensing_sensor_get_state()

int sensing_sensor_get_state ( const struct device * dev,
enum sensing_sensor_state * state )

#include <zephyr/sensing/sensing_sensor.h>

Get this sensor's state.

Parameters
devThe sensor instance device structure.
stateReturned sensor state value
Returns
0 on success or negative error value on failure.