| 
    Zephyr Project API
    3.3.0
    
   A Scalable Open Source RTOS 
   | 
 
Public APIs for the sensor driver. More...
#include <zephyr/types.h>#include <zephyr/device.h>#include <errno.h>#include <syscalls/sensor.h>Go to the source code of this file.
Data Structures | |
| struct | sensor_value | 
| Representation of a sensor readout value.  More... | |
| struct | sensor_trigger | 
| Sensor trigger spec.  More... | |
| struct | sensor_driver_api | 
Macros | |
| #define | SENSOR_G 9806650LL | 
| The value of gravitational constant in micro m/s^2.  More... | |
| #define | SENSOR_PI 3141592LL | 
| The value of constant PI in micros.  More... | |
| #define | SENSOR_INFO_DEFINE(name, ...) | 
| #define | SENSOR_INFO_DT_DEFINE(node_id) | 
| #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.  More... | |
| #define | SENSOR_DEVICE_DT_INST_DEFINE(inst, ...) SENSOR_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__) | 
| Like SENSOR_DEVICE_DT_DEFINE() for an instance of a DT_DRV_COMPAT compatible.  More... | |
Typedefs | |
| typedef void(* | sensor_trigger_handler_t) (const struct device *dev, const struct sensor_trigger *trigger) | 
| Callback API upon firing of a trigger.  More... | |
| typedef int(* | sensor_attr_set_t) (const struct device *dev, enum sensor_channel chan, enum sensor_attribute attr, const struct sensor_value *val) | 
| Callback API upon setting a sensor's attributes.  More... | |
| typedef int(* | sensor_attr_get_t) (const struct device *dev, enum sensor_channel chan, enum sensor_attribute attr, struct sensor_value *val) | 
| Callback API upon getting a sensor's attributes.  More... | |
| typedef int(* | sensor_trigger_set_t) (const struct device *dev, const struct sensor_trigger *trig, sensor_trigger_handler_t handler) | 
| Callback API for setting a sensor's trigger and handler.  More... | |
| typedef int(* | sensor_sample_fetch_t) (const struct device *dev, enum sensor_channel chan) | 
| Callback API for fetching data from a sensor.  More... | |
| typedef int(* | sensor_channel_get_t) (const struct device *dev, enum sensor_channel chan, struct sensor_value *val) | 
| Callback API for getting a reading from a sensor.  More... | |
Functions | |
| int | sensor_attr_set (const struct device *dev, enum sensor_channel chan, enum sensor_attribute attr, const struct sensor_value *val) | 
| Set an attribute for a sensor.  More... | |
| int | sensor_attr_get (const struct device *dev, enum sensor_channel chan, enum sensor_attribute attr, struct sensor_value *val) | 
| Get an attribute for a sensor.  More... | |
| static int | sensor_trigger_set (const struct device *dev, const struct sensor_trigger *trig, sensor_trigger_handler_t handler) | 
| Activate a sensor's trigger and set the trigger handler.  More... | |
| int | sensor_sample_fetch (const struct device *dev) | 
| Fetch a sample from the sensor and store it in an internal driver buffer.  More... | |
| int | sensor_sample_fetch_chan (const struct device *dev, enum sensor_channel type) | 
| Fetch a sample from the sensor and store it in an internal driver buffer.  More... | |
| int | sensor_channel_get (const struct device *dev, enum sensor_channel chan, struct sensor_value *val) | 
| Get a reading from a sensor device.  More... | |
| static int32_t | sensor_ms2_to_g (const struct sensor_value *ms2) | 
| Helper function to convert acceleration from m/s^2 to Gs.  More... | |
| static void | sensor_g_to_ms2 (int32_t g, struct sensor_value *ms2) | 
| Helper function to convert acceleration from Gs to m/s^2.  More... | |
| static int32_t | sensor_ms2_to_ug (const struct sensor_value *ms2) | 
| Helper function to convert acceleration from m/s^2 to micro Gs.  More... | |
| static void | sensor_ug_to_ms2 (int32_t ug, struct sensor_value *ms2) | 
| Helper function to convert acceleration from micro Gs to m/s^2.  More... | |
| static int32_t | sensor_rad_to_degrees (const struct sensor_value *rad) | 
| Helper function for converting radians to degrees.  More... | |
| static void | sensor_degrees_to_rad (int32_t d, struct sensor_value *rad) | 
| Helper function for converting degrees to radians.  More... | |
| static int32_t | sensor_rad_to_10udegrees (const struct sensor_value *rad) | 
| Helper function for converting radians to 10 micro degrees.  More... | |
| static void | sensor_10udegrees_to_rad (int32_t d, struct sensor_value *rad) | 
| Helper function for converting 10 micro degrees to radians.  More... | |
| static double | sensor_value_to_double (const struct sensor_value *val) | 
| Helper function for converting struct sensor_value to double.  More... | |
| static int | sensor_value_from_double (struct sensor_value *val, double inp) | 
| Helper function for converting double to struct sensor_value.  More... | |
| static int64_t | sensor_value_to_milli (struct sensor_value *val) | 
| Helper function for converting struct sensor_value to integer milli units.  More... | |
| static int64_t | sensor_value_to_micro (struct sensor_value *val) | 
| Helper function for converting struct sensor_value to integer micro units.  More... | |
Public APIs for the sensor driver.