1 #ifndef RUUVI_INTERFACE_LIS2DH12_H
2 #define RUUVI_INTERFACE_LIS2DH12_H
4 #if (RI_LIS2DH12_ENABLED || DOXYGEN)
11 #include "lis2dh12_reg.h"
56 #define RI_LIS2DH12_SELFTEST_DIFF_MIN (17)
58 #define RI_LIS2DH12_SELFTEST_DIFF_MAX (360)
60 #define RI_LIS2DH12_DEFAULT_SCALE (2U)
62 #define RI_LIS2DH12_DEFAULT_RESOLUTION (10U)
63 #define LIS_SUCCESS (0)
64 #define SELF_TEST_DELAY_MS (100U)
65 #define SELF_TEST_SAMPLES_NUM (5)
uint32_t rd_status_t
bitfield for representing errors
rd_status_t ri_lis2dh12_resolution_set(uint8_t *resolution)
rd_sensor_setup_fp
rd_status_t ri_lis2dh12_mode_get(uint8_t *)
rd_sensor_setup_fp
rd_status_t ri_lis2dh12_samplerate_get(uint8_t *samplerate)
rd_sensor_setup_fp
rd_status_t ri_lis2dh12_dsp_get(uint8_t *dsp, uint8_t *parameter)
rd_sensor_dsp_fp
rd_status_t ri_lis2dh12_fifo_use(const bool enable)
Enable 32-level FIFO in LIS2DH12 If FIFO is enabled, values are stored on LIS2DH12 FIFO and oldest el...
rd_status_t ri_lis2dh12_scale_set(uint8_t *scale)
rd_sensor_setup_fp
rd_status_t ri_lis2dh12_mode_set(uint8_t *)
rd_sensor_setup_fp
rd_status_t ri_lis2dh12_dsp_set(uint8_t *dsp, uint8_t *parameter)
rd_sensor_dsp_fp
rd_status_t ri_lis2dh12_samplerate_set(uint8_t *samplerate)
rd_sensor_setup_fp
rd_status_t ri_lis2dh12_fifo_interrupt_use(const bool enable)
Enable FIFO full interrupt on LIS2DH12. Triggers as ACTIVE HIGH interrupt once FIFO has 32 elements.
rd_status_t ri_lis2dh12_uninit(rd_sensor_t *acceleration_sensor, rd_bus_t bus, uint8_t handle)
rd_sensor_init_fp
rd_status_t ri_lis2dh12_data_get(rd_sensor_data_t *const data)
rd_sensor_data_fp
rd_status_t ri_lis2dh12_fifo_read(size_t *num_elements, rd_sensor_data_t *data)
Read FIFO Reads up to num_elements data points from FIFO and populates pointer data with them.
rd_status_t ri_lis2dh12_init(rd_sensor_t *acceleration_sensor, rd_bus_t bus, uint8_t handle)
rd_sensor_init_fp
rd_status_t ri_lis2dh12_resolution_get(uint8_t *resolution)
rd_sensor_setup_fp
rd_status_t ri_lis2dh12_activity_interrupt_use(const bool enable, float *limit_g)
Enable activity interrupt on LIS2DH12.
rd_status_t ri_lis2dh12_scale_get(uint8_t *scale)
rd_sensor_setup_fp
rd_bus_t
Type of bus sensor uses.
Header to enable and disable module compilation.
Ruuvi error codes and error check function.
Ruuvi sensor interface Lifecycle: Beta
Generic sensor data struct.
Interface to sensor. Some sensors can implement additional functions. The additional functions are de...
uint64_t tsample
Time of sample, rd_sensor_timestamp_get.
uint8_t handle
Device handle, SPI GPIO pin or I2C address.
lis2dh12_op_md_t resolution
Resolution, bits. 8, 10, or 12.
uint8_t mode
Operating mode. Sleep, single or continuous.
lis2dh12_st_t selftest
Self-test enabled, positive, negative or disabled.
stmdev_ctx_t ctx
Driver control structure.
lis2dh12_odr_t samplerate
Sample rate, 1 ... 200, or custom values for higher.
lis2dh12_fs_t scale
Scale, gravities. 2, 4, 8 or 16.