Add new SENSOR_CHAN_FREQUENCY constant to allow implement sensors that
output frequency values in Hertz.
Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
Instead of assuming that an individual axis must contain all
data-values. Additionally, for determining that there's XYZ data, all
three channels must be present in the header.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
For the supported channels, instead of just allowing 3-axis data being
printed out, allow individual channels to be processed (e.g: accel_x,
gyro_y, etc).
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Wait until the typical time that the sample would be ready before
starting to poll the status register.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Fixes issue introduced in #76460
The previous code attempted to detect whether TMAG5273 or TMAG3001 was
connected based on DEVICE ID register. This doesn't work as the bits that
denote the version on one part are undefined on the other part, and cannot
be relied on to be zero.
This commit adds a TMAG3001 compatible which (for now) is just derived from
the TMAG5273 compatible. This allows TMAG3001 to be specified directly in
the DT. The driver code is updated to support both compatibles.
Signed-off-by: Yiding Jia <yiding.jia@gmail.com>
The three sensor channels listed below were recently added by the commit
9471df95a5:
- SENSOR_CHAN_GAME_ROTATION_VECTOR
- SENSOR_CHAN_GRAVITY_VECTOR
- SENSOR_CHAN_GBIAS_XYZ
Theses channel names are missing and causes a system crash if the
SENSOR_LOG_LEVEL is set to DEBUG.
Also, the two sensor attributes SENSOR_ATTR_GAIN and SENSOR_ATTR_RESOLUTION
were added by the commit f849140de7.
This adds these missing channel and attribute to the list of names in the
sensor shell.
Signed-off-by: Gaël PORTAY <gael.portay@rtone.fr>
Update the driver to take the "vrefint-cal-resolution" property into
account when performing the calculations.
Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
This is a squash of all the groundwork needed to
get a functioning driver for the DS3231 with the RTC API.
Signed-off-by: Gergo Vari <work@gergovari.com>
Add the Sensor Fusion Low Power (SFLP) FIFO streaming capability,
using RTIO. The decode function is now aware of parsing following FIFO
tags:
- LSM6DSV16X_SFLP_GAME_ROTATION_VECTOR_TAG
- LSM6DSV16X_SFLP_GYROSCOPE_BIAS_TAG
- LSM6DSV16X_SFLP_GRAVITY_VECTOR_TAG
To activate SFLP the user should put in DT the proper configuration.
For example, to activate a 60Hz SFLP FIFO batching rate of game rotation
vector, gravity vector and gbias components, the user should add in DT
the following:
sflp-odr = <LSM6DSV16X_DT_SFLP_ODR_AT_60Hz>;
sflp-fifo-enable = <LSM6DSV16X_DT_SFLP_FIFO_GAME_ROTATION_GRAVITY_GBIAS>;
Signed-off-by: Armando Visconti <armando.visconti@st.com>
In case I3C IBI interrupt is not used do not skip reading the status
register, otherwise the interrupt event will not get cleared.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Align all sensor drivers that are using stmemsc (STdC) HAL i/f
to new APIs of stmemsc v2.8
Requires https://github.com/zephyrproject-rtos/hal_st/pull/24
Signed-off-by: Armando Visconti <armando.visconti@st.com>
The get_frame_count() API must return the number of frames in FIFO
for a given channel type, and not the total number of generic FIFO
frames. This API may be also re-used in the decoder routine when
the timestamp baseline is adjusted.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
The LIS2DUXS12 is a smart, digital, 3-axis linear accelerometer whose
MEMS and ASIC have been expressly designed to combine the lowest current
consumption possible with features such as always-on antialiasing
filtering, a finite state machine (FSM) and machine learning core (MLC)
with adaptive self-configuration (ASC), and an analog hub / Qvar sensing
channel.
(https://www.st.com/en/mems-and-sensors/lis2duxs12.html)
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Prepare the driver to be able to handle other DUX software compatible
devices. Currently the driver handles the st_lis2dux12 compatible only.
Do following major changes:
1. Introduce the lis2dux12_chip_api structure filled with device specific
APIs. At the moment define following callback:
- api_lis2dux12_set_odr_raw()
- api_lis2dux12_set_range()
- api_lis2dux12_sample_fetch_accel()
- api_lis2dux12_sample_fetch_temp()
- api_lis2dux12_handle_interrupt()
- api_lis2dux12_init_interrupt()
2. Prepare specific APIs for st_lis2dux12 device.
3. Make DT instantiation on inst + name basis, and not only by inst. This
commit only use "name = DT_DRV_COMPAT = st_lis2dux12".
Signed-off-by: Armando Visconti <armando.visconti@st.com>
The DHT[11/22] sensor driver fails to read data due to an extra
"gpio_pin_set_dt" that is occurs prior to waiting for the sensor active
response. This leads to consistent failed reads on esp32 (devkitc,
wrover). After removing this line reads are consistently successful.
Signed-off-by: Omar Naffaa <omarnaffaa.on@gmail.com>
coverity complains of a missing break statement in SENSOR_CHAN_ALL case
this is fixed by adding __attribute__((fallthrough))
Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
Use shell_device_get_binding() instead of device_get_binding() so that
we get the device based on its name and in addition by its label.
Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
Prepare to use official TDK Invensense Inc. driver for icm42670-P/-S
sensor in tdk_hal module. Simplify I2C and SPI transport files.
Driver code moves in hal_tdk module.
Adds APEX features, such as Pedometer, Tilt detection, Wake on Motion
and Significant Motion Detector.
Signed-off-by: Aurelie Fontaine <aurelie.fontaine@tdk.com>
find a sensor driver bug don't judge the data whether read back
correctly, deal with buffer data directly.
Signed-off-by: Lucien Zhao <lucien.zhao@nxp.com>
This commit fixes a shared context between multiple instances of the
INA230 and INA236 driver. The issue is the naming of the instance data in
`INA230_DRIVER_INIT` macro when we have one instance of INA230 and one
of INA236 the name of the data variable will be `drv_data_0`. This
variable will then be passed to both instances.
Signed-off-by: Tomáš Juřena <jurenatomas@gmail.com>
Compilation will fail if multiple models are used at the same time.
Changing to define different unique names for the symbols
to avoid conflicts.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
The lsm6dso driver does not correctly reflect the status of
the node in dt. So the driver didn't compile even if
`st,lsm6dso32` node exists.
I fixed it to correctly go through ithe compile.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
There were code paths that could have lead to divide by zero given an
invalid scale setting for accel or gyro. In practice this should be an
invalid setup even before getting to these conversion functions. The
conversion functions now better show all valid values are accounted for
by using CODE_UNREACHABLE in the default case.
Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
Fixes type mix-match for rtd temperature calculation. Also changes
coefficient array name for clarity.
Signed-off-by: Maxmillion McLaughlin <max@sorcerer.earth>
Update discharge current limit property to be aligned
with the most recent npm1300 datasheet.
This affects the discharge current measurement calculation,
which needs to be scaled accordingly.
Signed-off-by: Audun Korneliussen <audun.korneliussen@nordicsemi.no>
Select TRIGGER_GLOBAL_THREAD by default if rtio streaming is enabled,
and TRIGGER_NONE otherwise. This change prevents bad trigger configurations
like
CONFIG_LSM6DSV16X_TRIGGER=y
CONFIG_LSM6DSV16X_TRIGGER_NONE=y
which does not have any sense.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Add sensor driver for npm2100 pmic.
This pmic performs measurements of battery voltage, regulator voltage
and die temperature.
Configurable pmic attributes are also organized under this driver.
Signed-off-by: Audun Korneliussen <audun.korneliussen@nordicsemi.no>
Add support for setting the sample frequency via `attr_set` and the
output data rate from device tree source.
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
This commit explicitly type-casts data_bits to uint64_t
in order to fix implicit sign extension warning
Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
Add RTIO async and RTIO stream functionalities that enables,
among all the other things, the sensor data streaming from FIFO.
RTIO stream is using both SENSOR_TRIG_FIFO_WATERMARK and
SENSOR_TRIG_FIFO_FULL triggers. The decoder currently only supports
following FIFO tags:
- LSM6DSV16X_XL_NC_TAG
- LSM6DSV16X_GY_NC_TAG
- LSM6DSV16X_TEMP_NC_TAG
Following FIFO parameters has to be defined in device tree to
correctly stream sensor data:
- fifo-watermark (defaults to 32)
- accel-fifo-batch-rate (defaults to LSM6DSV16X_DT_XL_NOT_BATCHED)
- gyro-fifo-batch-rate (defaults to LSM6DSV16X_DT_GY_NOT_BATCHED)
- temp-fifo-batch-rate (defaults to LSM6DSV16X_DT_TEMP_NOT_BATCHED)
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Updates the Kconfig condition to support trigger functionality for INA236.
This will get rid of `warning: INA230_TRIGGER (defined at
drivers/sensor/ti/ina23x/Kconfig:43) was assigned the value 'y' but got
the value 'n'.` if INA230_TRIGGER is enabled.
Signed-off-by: Tomáš Juřena <jurenatomas@gmail.com>
Fix for conversion of temperature values in adxl367_temp_convert
and missing break statement.
Signed-off-by: Vladislav Pejic <vladislav.pejic@orioninc.com>