Moves the MPU6050 accel/gyro scale settings from KConfig to Devicetree.
Adds a new setting for the MPU6050 sample rate divider register and
transmits it to the sensor upon initialization.
This helps to reduce the interrupt firing rate when combined with the
data ready trigger.
A default division factor is provided which ensures compatibility with
existing applications.
The MPU6050 sample application is extended and used for hardware tests.
Signed-off-by: Tilmann Unte <unte@es-augsburg.de>
Add support for setting the sample frequency via `attr_set` and the
output data rate from device tree source.
Signed-off-by: Fredrik Gihl <fgihl@hotmail.com>
When two tach use simultaneously, I find that the both tach status will
be cleared at once, which causes one of tach not to get rpm speed.
So I change it to clear status only one tach at a time.
This issue is reported by Huaqin:
https://partnerissuetracker.corp.google.com/issues/404067663?pli=1
Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
When converting raw values to integer and fractional (micro) parts, the
fractional part must be a signed integer.
- Fix prototypes where the fractional part was declared as unsigned.
- Fix comments which did not match the declared type.
Signed-off-by: Christophe Tournery <christophe.tournery@freshape.com>
Instead of requiring the edata struct, just receive full-scale
parameter. This simplifies the decoding process for FIFO data
during streaming.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Add calibration via a known gas concentration. This is the recommended way
of calibrating the sensor according to the datasheet.
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
- add driver for Vishay VEML6031 High Accuracy Ambient Light Sensor.
- add new compatible "vishay,veml6031".
- read and write consecutive 8 bit registers as bulk operation.
- add driver to build all test of sensors.
- support fetch and get.
- triggered mode and interrupt is not yet supported.
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Working through either Motion detection or through Data-Ready.
Data-ready has a back-up timer to trigger worst case, if no motion
occurs within 10X data-rate.
On every streaming event, the driver checks for the sensor health, and
attempts recoverying its state if it detects issues.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
- Add bus support for SPI (based on RTIO).
- Support read/decode API for one-shot reads on the following channels:
- SENSOR_CHAN_POS_DX.
- SENSOR_CHAN_POS_DY.
- SENSOR_CHAN_POS_DXYZ.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Soft reset HS400x during initialization to make sure that
device is at a known state and writeable registers have the
default values.
Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
According to the datasheet, maximum conversion time for both
humidity and temperature at 14 bits resolution is 1.7 ms.
Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
The sensor does not always finish responding within 200 ms.
This is the sometimes the case when using the sensor calibrate command `X`.
Response delay up to 212 ms has been measured with a logic analyzer.
Increase the max response delay to 300 ms to fix the issue.
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
During calibration feature development the following loop was used for
testing:
```shell
CMD="sensor attr_set explorir_m co2 calibration 1234"
while : ; do echo "$CMD" > /dev/ttyACM0; sleep .8; done
```
At some point calibration would fail and all following calibration commands
would fail.
Reset buffer and semaphore just before terminating the command to better
mitigate disturbance from previous failed command.
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
- Add support for Fetch/Get API.
- Add support for Read/Decode API.
- Add config settings through device-tree.
- Add bus support for SPI (although easily extensible to others as
based on RTIO).
Fetch/Get API tested with accel_polling sample.
Read/Decode API tested with sensor_shell sample.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
sca finds the code to be logically dead considering the size of long
to be 4 bytes.
- Solution: use uint64_t type for the variable `value`.
Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
The tmp1075 driver already registers a log module using
LOG_MODULE_REGISTER(TMP1075, CONFIG_SENSOR_LOG_LEVEL).
This ensures that all log messages are prefixed with "TMP1075".
The existing LOG_ERR message redundantly includes "tmp1075",
which is unnecessary.
Signed-off-by: Hank Wang <wanghanchi2000@gmail.com>
Allow to set attribute of the measurement rate of the apds9253. This
must be done setting the sampling frequency (in Hz).
Signed-off-by: Margherita Milani <margherita.milani@amarulasolutions.com>
Allow to set attribute of the gain of the apds9253. The gain
is applied to all the channels.
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Margherita <margherita.milani@amarulasolutions.com>
Ensure the corresponding bus enables RTIO (I2C, I3C or SPI) before
instantiating rtio-dependent elements. Otherwise, enabling it for
another bus (e.g: SPI_RTIO when the LSM6DS is also on I3C with no
I3C_RTIO) will cause a build-time failure.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
The scd4x_channel_get function converts raw word values to
struct sensor_value's per the datasheet. The calculation for val2 of a
struct sensor_value `val->val2 = ((tmp_val % 0xFFFF) * 1000000) / 0xFFFF;`
can overflow the max of int32_t, resulting in an incorrect
sensor_value.
Fix it by changing the type of tmp_val to int64_t.
Signed-off-by: Zach Thomas <zach.thomas1.zt@gmail.com>
These two sensors do not build with asserts enabled as they're
referencing a non-existent variable `pkt_size`.
Replaced for what (AFAIK) is the intended variable.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
This Introduces a driver for the i2c interface of Phosense XBR818.
XBR818 is a 10.525Ghz Radar chip with builtin detection algorithm.
Signed-off-by: Camille BAUD <mail@massdriver.space>
Building with clang warns:
drivers/sensor/st/ism330dhcx/ism330dhcx.c:107:19: error: unused function
'ism330dhcx_reboot' [-Werror,-Wunused-function]
static inline int ism330dhcx_reboot(const struct device *dev)
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Building with clang warns:
drivers/sensor/st/lis2dw12/lis2dw12.c:194:23: error: unused
function 'sensor_ms2_to_mg' [-Werror,-Wunused-function]
static inline int32_t sensor_ms2_to_mg(const struct sensor_value *ms2)
^
Move the function to include/zephyr/drivers/sensor.h with the other
sensor_ms2_to* functions.
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Building with clang warns:
drivers/sensor/st/iis2iclx/iis2iclx.c:68:19: error: unused function
'iis2iclx_reboot' [-Werror,-Wunused-function]
static inline int iis2iclx_reboot(const struct device *dev)
^
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Building with clang warns:
drivers/sensor/st/lsm9ds0_mfd/lsm9ds0_mfd.c:42:19: error: unused
function 'lsm9ds0_mfd_accel_set_odr_raw' [-Werror,-Wunused-function]
static inline int lsm9ds0_mfd_accel_set_odr_raw(const struct device *dev,
^
lsm9ds0_mfd_accel_set_odr_raw is only used by code that was guarded by
defined(CONFIG_LSM9DS0_MFD_ACCEL_SAMPLING_RATE_RUNTIME) in addition to
!defined(LSM9DS0_MFD_ACCEL_DISABLED).
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Building with clang warns:
drivers/sensor/st/lsm6dso/lsm6dso.c:89:19: error: unused function
'lsm6dso_reboot' [-Werror,-Wunused-function]
static inline int lsm6dso_reboot(const struct device *dev)
^
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Building with clang warns:
drivers/sensor/st/lsm6dso16is/lsm6dso16is.c:83:19: error: unused
function 'lsm6dso16is_reboot' [-Werror,-Wunused-function]
static inline int lsm6dso16is_reboot(const struct device *dev)
^
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Adds support for the SENSOR_ATTR_SLOPE_TH and SENSOR_ATTR_SLOPE_DUR
attributes These set the sensitivity for the SENSOR_TRIG_DELTA trigger
which uses the sensor's wakeup feature.
Signed-off-by: Corey Wharton <xodus7@cwharton.com>