Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
Public APIs for the sensor driver. More...
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... | |
Typedefs | |
typedef void(* | sensor_trigger_handler_t) (const struct device *dev, 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, 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_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 double | sensor_value_to_double (const struct sensor_value *val) |
Helper function for converting struct sensor_value to double. More... | |
static void | sensor_value_from_double (struct sensor_value *val, double inp) |
Helper function for converting double to struct sensor_value. More... | |
Public APIs for the sensor driver.