Commit graph

2428 commits

Author SHA1 Message Date
Gaël PORTAY
010bedb590 sensor_shell: fix missing channel and attribute names
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>
2025-01-08 07:51:04 +01:00
Mathieu Choplain
d173737479 drivers: sensor: stm32_vref: take calibration resolution into account
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>
2025-01-08 07:50:44 +01:00
Gergo Vari
2759adaf1a drivers: rtc: maxim,ds3231: RTC driver
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>
2025-01-07 23:00:05 +01:00
Armando Visconti
21584003bf sensors: drivers: lsm6dsv16x: add SFLP FIFO support
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>
2025-01-02 18:04:19 +01:00
Armando Visconti
dc03fba586 sensors/lsm6dsv16x: fix interrupt handling
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>
2025-01-02 18:04:19 +01:00
Armando Visconti
43a61a823b modules/hal_st: Align sensor drivers to stmemsc HAL i/f v2.8
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>
2025-01-02 18:04:19 +01:00
Armando Visconti
4e503748a5 sensors: lsm6dsv16x: fix get_frame_count API
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>
2025-01-02 04:07:37 +01:00
Armando Visconti
f9eceaebf9 drivers/sensor: lis2dux12: add lis2duxs12 support
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>
2024-12-27 19:34:46 +01:00
Armando Visconti
0f76a4e519 drivers/sensor: lis2dux12: re-working to be DUX generic
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>
2024-12-27 19:34:46 +01:00
Omar Naffaa
c9be1a991b drivers: sensor: dht: Fix sensor read issue on esp32_devkitc_wrover
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>
2024-12-23 09:16:06 +01:00
Jilay Pandya
dcf9449b51 drivers: sensor: mmc56x3_async.c fix missing break
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>
2024-12-21 15:04:22 +01:00
Dimitrije Lilic
088afe9359 drivers: sensor: adxl345: Support for RTIO I2C stream
Updated ADXL345 driver with RTIO I2C stream functionality.

Signed-off-by: Dimitrije Lilic <dimitrije.lilic@orioninc.com>
2024-12-20 16:23:46 +01:00
Mariëlle Korthout
4fa94f6742 drivers: sensor: Add HS400x driver
Adds Renesas HS400x temperature and humidity sensors driver.
Signed-off-by: Mariëlle Korthout <marielle.korthout.jc@renesas.com>
2024-12-20 03:18:19 +01:00
Ryan McClelland
eb93ba03a9 sensor: lsm6dsv16x: add i3c support
Add I3C support to the lsm6dsv16x.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2024-12-18 22:12:04 +01:00
Ryan McClelland
cbfabf8be8 sensor: lps22hh: fix null check for i3c ibi
A typo was made where if the i3c bus is not null, then it will not set
the ibi callback.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2024-12-18 22:12:04 +01:00
Yishai Jaffe
1b4cef325b shell: use shell_device_get_binding
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>
2024-12-18 15:32:10 +01:00
Aurelie Fontaine
8a0469dc4f drivers: sensor: icm42670: supports icm42670-P/-S
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>
2024-12-18 03:04:31 +01:00
Lucien Zhao
c0b21f4a30 drivers: sensor: nxp: add code judge whether read back correctly
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>
2024-12-18 01:01:37 +01:00
Jilay Pandya
50928c0482 drivers: sensor: bmp180 fix unintentional integer overflow issue
cast partial_x3 explicitly to uint64_t to circumvent unintentioanl integer
overflow coverity issue

Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
2024-12-13 17:45:15 +01:00
Jilay Pandya
772b206408 drivers: sensor: fix missing break in mmc56x3_decoder
introduce breaks in mmc56x3_decoder.c

Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
2024-12-12 18:39:33 +01:00
Tomáš Juřena
96eb476d5d drivers: sensor: ti: ina230: Fix shared data between instances
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>
2024-12-12 18:39:23 +01:00
Jilay Pandya
2174ea0ac0 drivers: sensor: apds9306 fix unchecked return value coverity issue
check the return valeus of i2c_reg_write_byte_dt function and return
appropriate error code

Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
2024-12-12 11:05:49 +01:00
TOKITA Hiroshi
0e978fb1e6 drivers: sensor: scd4x: Fix to allow the use of multiple models
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>
2024-12-11 21:33:14 +01:00
TOKITA Hiroshi
f41195f922 drivers: sensor: lsm6dso: Fix issue lsm6dso32 cannot enabled
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>
2024-12-11 21:33:14 +01:00
Jilay Pandya
47fc9a1a59 drivers: sensor: tdk: fix icm42688 division by zero
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>
2024-12-07 11:02:28 +01:00
Maxmillion McLaughlin
7497b8bbbe drivers: sensor: max31865: fix compilation warning -Wdouble-promotion
Fixes type mix-match for rtd temperature calculation. Also changes
coefficient array name for clarity.

Signed-off-by: Maxmillion McLaughlin <max@sorcerer.earth>
2024-12-06 06:50:58 +01:00
Audun Korneliussen
ab6bca66ac drivers: sensor: npm1300_charger: Updating of discharge current limit
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>
2024-12-05 15:18:23 +01:00
Armando Visconti
1e28ffab40 sensors: lsm6dsv16x: Kconfig: Fix trigger mode
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>
2024-12-05 12:30:28 +01:00
Audun Korneliussen
439d3b2973 drivers: sensor: npm2100: Add driver for npm2100 pmic
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>
2024-12-04 14:19:53 -05:00
Jeppe Odgaard
c41570871b drivers: sensor: tmp116: support set sample frequency
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>
2024-12-03 19:57:06 +01:00
Vladislav Pejic
756e699a41 driver: sensor: adxl366: Add supp for adxl366
Modifed ADXL367 driver to support both ADXL367 and ADXL366.

Signed-off-by: Vladislav Pejic <vladislav.pejic@orioninc.com>
2024-12-03 15:48:01 +00:00
Yishai Jaffe
c09930ed30 drivers: led: Place API into iterable section
Add wrapper DEVICE_API macro to all led_driver_api instances.

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2024-12-02 22:07:36 +00:00
Pieter De Gendt
e16dece057 drivers: sensor: shell: Check sensor API type
Update sensor shell commands to filter and verify the device's API type.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-12-02 22:04:55 +00:00
Pieter De Gendt
a553af738d drivers: sensor: Place API into iterable section
Add wrapper DEVICE_API macro to all sensor_driver_api instances.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-12-02 22:04:55 +00:00
Jeff Welder
712dff57d8 drivers: sensor: lsm6dsv16x: fix temperature overflow
Fixed integer overflow by explicit casting

Signed-off-by: Jeff Welder <Jeff.Welder@ellenbytech.com>
2024-12-02 18:19:46 +01:00
Jilay Pandya
0fd662febc drivers: sensor: tsic_xx6: fix implicit sign extension
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>
2024-12-02 18:19:35 +01:00
James Roy
5df9611dc9 drivers: sensor: st: Fix uninitialized variable in lsm6dsv16x
Fix uninitialized val variables scanned by Coverity.

Signed-off-by: James Roy <rruuaanng@outlook.com>
2024-11-29 11:45:32 +01:00
Armando Visconti
b7ffb3d59d sensor/st: lsm6dsv16x: Fix lsm6dsv16x_attr_get() API
Fix a couple of typos when getting the accelerometer configuration.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2024-11-29 09:21:03 +01:00
Armando Visconti
a867dbdc47 sensors: lsm6dsv16x: add RTIO async and fifo stream
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>
2024-11-27 21:06:30 +00:00
Armando Visconti
01c1e1173f sensors: lsm6dsv16x: add attr_get driver API
Add attr_get() driver API

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2024-11-27 21:06:30 +00:00
Armando Visconti
5bdde779c1 sensors: lsm6dsv16x: save gyro_fs in data
Save gyroscope range set from DT or SENSOR_ATTR in data
structure.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2024-11-27 21:06:30 +00:00
Tomáš Juřena
b4dcdaaeab drivers: sensor: ti: ina230: Fix dts warning if INA230_TRIGGER enabled
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>
2024-11-27 08:18:57 +01:00
Vladislav Pejic
04c70d681e driver: sensor: adxl367: Fix for extra 0
Fix for extra 0 in conversion of acceleration values in
adxl367_accel_convert.

Signed-off-by: Vladislav Pejic <vladislav.pejic@orioninc.com>
2024-11-26 15:44:31 -05:00
Vladislav Pejic
19fe816f28 driver: sensor: adxl367: Temp conversion
Fix for conversion of temperature values in adxl367_temp_convert
and missing break statement.

Signed-off-by: Vladislav Pejic <vladislav.pejic@orioninc.com>
2024-11-26 15:44:31 -05:00
Vladislav Pejic
eb15f306b6 driver: sensor: adxl367: Fix for SPI
Fix for SPI communication when RTIO is used in SPI driver. When in
adxl367_bus_access, const struct spi_buf buf[3] is used,
spi_rtio_copy function won't set correct buffers and length
for buf[2] and that will cause exception when that buffer is
processed.

Signed-off-by: Vladislav Pejic <vladislav.pejic@orioninc.com>
2024-11-26 15:44:31 -05:00
Jordan Yates
91e006cb7c sensor: bme280: bme280_wait_until_ready timeout
Add a timeout to the `bme280_wait_until_ready` loop to ensure that we
never get stuck in this loop even if the bus enters an error condition.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-11-26 08:45:29 +01:00
Vladislav Pejic
aad4c69068 drivers: sensor: adxl367: Added RTIO stream
Updated ADXL367 driver with RTIO stream functionality.
RTIO stream is using both FIFO threshold and FIFO full triggers.
Together with RTIO stream, RTIO async read is also implemented.
Supported FIFO_CHANNEL configurations:
- XYZ
- X
- Y
- Z
- XYZT
- XT
- YT
- ZT
Configurations with external ADC are currently not supported.

Signed-off-by: Vladislav Pejic <vladislav.pejic@orioninc.com>
2024-11-22 17:43:36 +01:00
Sergei Ovchinnikov
55c6a0eaa5 drivers: sensor: npm1300_charger: expose VBUS status
Add possibility to retrieve VBUS status of the nPM1300 charger through
its sensor APIs. Updated shields/npm1300_ek sample to use the new API.

Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>
2024-11-19 17:51:13 -05:00
Jan Faeh
2efc8598e3 drivers: sensor: SCD4x Add driver
This adds support for Sensirion's SCD4x co2 sensor.

Signed-off-by: Jan Faeh <jan.faeh@sensirion.com>
2024-11-18 19:38:10 -05:00
Jan Faeh
22945254ef drivers: sensor: STS4x Add driver
This adds support for Sensirion's STS4x temperature sensor.

Signed-off-by: Jan Faeh <jan.faeh@sensirion.com>
2024-11-16 14:02:15 -05:00