ruuvi.drivers.c  ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
ruuvi_task_sensor.h
Go to the documentation of this file.
1 #ifndef RUUVI_TASK_SENSOR_H
2 #define RUUVI_TASK_SENSOR_H
16 #include "ruuvi_driver_error.h"
17 #include "ruuvi_driver_sensor.h"
18 #include "ruuvi_interface_gpio.h"
19 #include "ruuvi_interface_i2c.h"
20 
21 typedef struct
22 {
26  uint16_t nvm_file;
27  uint16_t nvm_record;
28  uint8_t handle;
36 
53 
63 
73 
85 
97  sensor_list, const size_t count, const char * const name);
98 
110  sensor_list, const size_t count, rd_sensor_data_fields_t values);
111 
113 #endif
uint32_t rd_status_t
bitfield for representing errors
rd_status_t(* rd_sensor_init_fp)(rd_sensor_t *const p_sensor, const rd_bus_t bus, const uint8_t handle)
Initialize and uninitialize sensor. Init and uninit will setup sensor with function pointers....
rd_bus_t
Type of bus sensor uses.
Ruuvi error codes and error check function.
Ruuvi sensor interface Lifecycle: Beta
uint16_t ri_gpio_id_t
port<<8 + pin
ri_gpio_state_t
States of GPIO pins.
Interface for I2C operations.
ri_i2c_frequency_t
rt_sensor_ctx_t * rt_sensor_find_backend(rt_sensor_ctx_t *const sensor_list, const size_t count, const char *const name)
Search for requested sensor backend in given list of sensors.
rd_status_t rt_sensor_store(rt_sensor_ctx_t *const sensor)
Store the sensor state to NVM.
rd_status_t rt_sensor_configure(rt_sensor_ctx_t *const sensor)
Configure a sensor with given settings.
rd_status_t rt_sensor_load(rt_sensor_ctx_t *const sensor)
Load the sensor state from NVM.
rd_status_t rt_sensor_initialize(rt_sensor_ctx_t *const sensor)
Initialize sensor CTX.
rt_sensor_ctx_t * rt_sensor_find_provider(rt_sensor_ctx_t *const sensor_list, const size_t count, rd_sensor_data_fields_t values)
Search for a sensor which can provide requested values.
All sensors must implement configuration functions which accept this struct.
Interface to sensor. Some sensors can implement additional functions. The additional functions are de...
ri_gpio_state_t pwr_on
Power-on state of ctrl pin.
rd_sensor_t sensor
Control structure for sensor.
uint8_t handle
Handle of sensor.
ri_i2c_frequency_t i2c_max_speed
Maximum I2C speed supported.
ri_gpio_id_t pwr_pin
Power control pin.
ri_gpio_id_t level_pin
Level interrupt.
uint16_t nvm_file
NVM file of configuration.
ri_gpio_id_t fifo_pin
FIFO full interrupt.
uint16_t nvm_record
NVM record of configuration.
rd_sensor_configuration_t configuration
Sensor configuration.
rd_sensor_init_fp init
Initialization function.
rd_bus_t bus
Bus of sensor.
Union to access sensor data.