Commit graph

2534 commits

Author SHA1 Message Date
Anders Bjørn Nedergaard
18bff321be drivers: sensor: temperature: Add i.MX RT die temperature sensor
Added driver for i.MX RT118X die temperature sensor

Signed-off-by: Anders Bjørn Nedergaard <abn@polytech.com>
2025-09-12 16:06:31 -04:00
Matthias Hauser
5d0644627f drivers: sensor: include z-axis in Anymotion interrupt on the BMI270
include z-axis in Anymotion interrupt on the BMI270

Signed-off-by: Matthias Hauser <Matthias.Hauser@we-online.de>
2025-09-12 16:05:40 -04:00
Jordan Yates
1e307bcae2 sensor: voltage_divider: request calibration
Request calibration of the ADC in the voltage divider driver to improve
the accuracy of the measured voltages.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-09-09 20:40:11 -04:00
Marc Reilly
cc0fecd299 sensor: shell_battery: display labels for capacity are mAh
Update the units labels to be mAh

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
2025-09-09 11:44:59 +02:00
Marc Reilly
5bc2d0758a sensor: shell_battery: fix current value display
The sensor interface gives current channel values in Amps, but the "I"
(current) value is displayed in mA, so needs to be converted accordingly.

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
2025-09-09 11:44:59 +02:00
Vinayak Sunilkumar Priyadarsini
a87ed22fe1 drivers: sensor: adxl367: fix for temperature readout
Fix to ensure temperature is sampled at the same timestamp as x,y,z axis
data.

Signed-off-by: Vinayak Sunilkumar Priyadarsini <Vinayak.SunilkumarPriyadarsini@analog.com>
2025-09-09 07:35:00 +02:00
Benjamin Cabé
e9bcda38ca drivers: sensor: a01nyub: use logical AND in condition
Fix typo where a bitwise AND was used instead of a logical AND.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-09-04 21:04:51 +02:00
Benjamin Cabé
1185829f3b drivers: sensor: bmi270: fix off-by-one error
When the loop completes without breaking, tries would be
BMI270_CONFIG_FILE_RETRIES + 1 so the error check was never hit.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-09-04 21:04:30 +02:00
Wajdi ELMuhtadi
f9081725cf drivers: sensor: wsen_isds_2536030320001: add sensor driver
Add wsen_isds_2536030320001 driver with
the corrected name and compatibility with
the hal update as well as added new features.

Signed-off-by: Wajdi ELMuhtadi <wajdi.elmuhtadi@we-online.com>
2025-09-04 21:03:10 +02:00
Benjamin Cabé
89fef8aa6d doc: correct the spelling of "comparison"
s/comparision/comparison/

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-09-03 17:04:13 +02:00
Miguel Gazquez
84cfd706e9 drivers: sensor: lsm9ds1: use consistent variable name data
In both lsm9ds1 and lsm9ds1_mag drivers, the device data structure is
generally referenced with the variable name data.
However, in the initialization functions, the variable was named
lsm9ds1 (or lsm9ds1_mag for the magnetometer), which breaks this
convention.

Rename these variables to data for consistency across the driver.

Signed-off-by: Miguel Gazquez <miguel.gazquez@bootlin.com>
2025-09-03 14:58:30 +01:00
Miguel Gazquez
6ce58d4d71 drivers: sensor: lsm9ds1: add device PM support
Adds support for device PM for the lsm9ds1 sensor, putting the sampling
frequency of both the accelerometer and the gyroscope at 0 when the device
is suspended.

Signed-off-by: Miguel Gazquez <miguel.gazquez@bootlin.com>
2025-09-03 14:58:30 +01:00
Aditya Chopra
32789e550d drivers: sensor: paj7620: Fix potential integer overflow in driver
Fix Coverity issue CID 524766: A potential integer overflow could occur
in paj7620_set_sampling_rate() due to multiplication of
sensor_value->val1 instance(which is of type int32_t) with 1000000
without typecasting it to int64_t.

Fixes #90482

Signed-off-by: Aditya Chopra <adityachopra2912@gmail.com>
2025-09-03 01:41:47 +02:00
Jeppe Odgaard
451193f2e3 drivers: sensor: explorir_m: check transceive return value in init
Check `explorir_m_uart_transceive`'s return value in `explorir_m_init` and
return the value if not 0.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-09-03 01:32:37 +02:00
Rafal Dyla
8876a3bbd2 modules: hal_nordic: nrfs: Disabling subscription
- Code optimization for platforms which don't use subscription feature
in the temperature service.
- Test adaptation to code changes

Signed-off-by: Rafal Dyla <rafal.dyla@nordicsemi.no>
2025-08-21 11:08:09 +02:00
Dmitrii Sharshakov
3835d9ae0f sensor: adltc2990: correct emulator implementation
Fix an out of bounds access found by ASan.

Also remove mock_i2c_reg_error which seems to never be read.

Signed-off-by: Dmitrii Sharshakov <d3dx12.xx@gmail.com>
2025-08-20 02:17:53 +02:00
Jeppe Odgaard
0970aa2dc1 drivers: sensor: ti: tmp11x: clang-format files and change DEFINE_TMP11X
Run clang-format on tmp11x.c and tmp11x.h and change `DEFINE_TMP11X` to
prevent too long lines when clang-format is run.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-08-15 15:34:12 +02:00
Jeppe Odgaard
0d01361e5b drivers: sensor: ti: tmp11x: reuse variable
Reuse `value` variable in `tmp11x_attr_set` to reduce the number of local
variables.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-08-15 15:34:12 +02:00
Jeppe Odgaard
ec02138402 drivers: sensor: ti: tmp11x: add optional attribute storage
Enable optional storage of sensor attribute values in EEPROM. On reset, the
device goes through a POR sequence that loads the values programmed in the
EEPROM into the respective register map locations.

The driver stores sample frequency, offset, oversampling, lower threshold,
upper threshold, alert pin polarity, alert mode and conversion mode if the
value is continuous or shutdown.

The functionality has been tested with sensor shell and power cycling
sensor:

Test (undocumented) temperature offset is stored:
```shell
uart:~$ sensor attr_set ti_tmp11x@48 ambient_temp offset 0
ti_tmp11x@48 channel=ambient_temp, attr=offset set to value=0
uart:~$ sensor get ti_tmp11x@48 ambient_temp
[...] (25.523436)
uart:~$ sensor attr_set ti_tmp11x@48 ambient_temp offset 50
ti_tmp11x@48 channel=ambient_temp, attr=offset set to value=50
uart:~$ sensor get ti_tmp11x@48 ambient_temp
[...] (75.617186)
uart:~$
[15:12:20.088] Disconnected
[15:12:36.106] Connected
uart:~$ sensor get ti_tmp11x@48 ambient_temp
[...] (75.554686)
uart:~$ sensor attr_get ti_tmp11x@48 ambient_temp offset
ti_tmp11x@48(channel=ambient_temp, attr=offset) value=50.000000
```

Test one-shot mode is not stored:
```shell
uart:~$ sensor attr_set ti_tmp11x@48 ambient_temp 18 1
ti_tmp11x@48 channel=ambient_temp, attr=accel_x set to value=1
uart:~$ sensor get ti_tmp11x@48 ambient_temp
[...] (75.562499)
uart:~$ sensor get ti_tmp11x@48 ambient_temp
Read failed
[00:00:21.332,000] <wrn> sensor_compat: Failed to fetch samples
uart:~$
[15:16:24.529] Disconnected
[15:16:33.540] Connected
uart:~$ sensor get ti_tmp11x@48 ambient_temp
[...] (75.406249)
uart:~$ sensor get ti_tmp11x@48 ambient_temp
[...] (75.351561)
```

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-08-15 15:34:12 +02:00
Jeppe Odgaard
0eebb85297 drivers: sensor: ti: tmp11x: add eeprom await function
Move await eeprom programming into function and add poll loop timeout.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-08-15 15:34:12 +02:00
Declan Snyder
5ae654eeef modules: hal_nxp: Removed unused HAS_MCUX_* configs
Remove the configs that are not actually used for anything anymore or
never were, or that are redundant with other configs, and don't have any
code changes outside of Kconfig to remove.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-15 10:10:32 +03:00
Russ Webber
e8972a92da drivers: sensors: as5600: change to raw reading
Changed to use the raw reading rather than the scaled value, as that's
what the angle calculation is expecting. Added log messages that
communicate magnet sense state.

Signed-off-by: Russ Webber <russ@sentryrobotics.au>
2025-08-14 22:37:41 -04:00
sudarsan N
acad9532c5 drivers: sensor: voltage_divider: fix unchecked pm_device_runtime_get()
Fix Coverity CID 529858 (CWE-252): Previously, the return value of
pm_device_runtime_get() was not checked during PM resume, which could
lead to missed error conditions.

This patch ensures proper error handling by checking and propagating
the return status of the call.

Fixes: #92608

Signed-off-by: sudarsan N <sudarsansamy2002@gmail.com>
2025-08-08 10:43:26 -05:00
Loic Domaigne
2aeac6087d driver: sensor: veml6031 fix untrusted value/array index
Coverity reported potential use of untrusted values / array index. Add
appropriate checks and error reporting when using data->div4, data->gain
and data->itim as value/index.

CID: 516222
CID: 516228
CID: 516248
CID: 516254

Signed-off-by: Loic Domaigne <tech@domaigne.com>
2025-08-05 11:54:27 +01:00
Luis Ubieda
68afaf5e42 paa3905: Improve error-handling and cleanup during streaming
- Setting IODEV_SQE to NULL to subsequent triggers are rejected.
- Channel all error-resolutions through handle_result_on_error().

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-08-05 10:25:15 +01:00
Luis Ubieda
9e99b932d9 bmp581: Set streaming handle to NULL when done
To follow with error-handling of multi-shot items, they won't be marked
as cancelled. Instead, we expect them to stop being submitted, hence we
dispose the handle upon finishing every shot.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-08-04 19:56:40 +01:00
Luis Ubieda
24c0583848 bmm350: Set streaming handle to NULL when done
To follow with error-handling of multi-shot items, they won't be marked
as cancelled. Instead, we expect them to stop being submitted, hence we
dispose the handle upon finishing every shot.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-08-04 19:56:31 +01:00
Luis Ubieda
2e2d4afa06 afbr-s50: Remove asserts from driver
Run-time errors can still be considered asserts if checkif is
configured as such, otherwise, prevent crashing.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-08-04 19:56:22 +01:00
Luis Ubieda
f64009b87e afbr-s50: Accept requests if the on-going SQE has been cancelled
Considering the app may have cancelled all the requests as an error
handling strategy, this driver needs to support recovering from such
case.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-08-04 19:56:22 +01:00
Luis Ubieda
00055d1a7d afbr-s50: Add graceful error-handling on data-ready
Whenever the data-ready callback is invoked, there's a common pattern
that needs to take place:

- Stop measurement timer (to stop on-coming samples), which could be
restored by the application re-submitting the request.
- Set iodev_sqe to NULL, so new requests can come in.
- Report the error on the SQE.

This has been refactored in handle_error_on_result() and now it's
invoked throughout the code.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-08-04 19:56:22 +01:00
Luis Ubieda
ab67081443 afbr-s50: fix build-time asserts for settings outside dual-freq mode
The existing build-time asserts not only needs to cover dual-frequency
mode does no exceed high-speed settings, it needs to allow not using
dual-frequency mode settings at all, which is what this patch does.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-08-04 19:56:22 +01:00
Tobias Meyer
ceadedf3ae drivers: sensor: tmp11x: add trigger for alert and pm
Allows to configure the alert or therm mode for triggers
based on the low/high temperature treshholds
Also adding simple PM

Signed-off-by: Tobias Meyer <tobiuhg@gmail.com>
2025-07-30 17:32:27 -04:00
Daniel Kampert
bf3eba1c31 drivers: sensor: APDS9306: Add lux conversion
- Add lux conversion to APDS-9306 driver
- Change settings of gain, resolution and
frequency to index-based settings
- Add Device Tree overlay sample for APDS-9306
- Fix wrong board name in light_polling README
- Add value checks for the attribute set API call
- Remove the reading of the sensor attributes
from the sensor and use buffered values instead
- Rename `frequency` property to `measurement period`

Closes #91104

Signed-off-by: Daniel Kampert <DanielKampert@kampis-elektroecke.de>
2025-07-30 06:10:09 -04:00
Luis Ubieda
9791165877 icm45686: fix unhandled shift being zero
Even though it's not listed in the options of
icm45686_get_shift(), for completeness sake,
do not leave an unhandled range.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-07-29 22:51:08 -04:00
Armando Visconti
792b7e3570 rtio: add helper function rtio_read_transaction()
Add a helper function that constructs a rtio SQE chain with the purpose
to perform a bus read operation on a list of registers.

Usage:

  struct rtio_regs regs;
  struct rtio_reg_list regs_list[] = {{regs_addr1, mem_addr_1, mem_len_1},
                                      {regs_addr2, mem_addr_2, mem_len_2},
                                      ...
                                     };
  regs.rtio_regs_list = regs_list;
  regs.rtio_regs_num = ARRAY_SIZE(regs_list);

  rtio_read_regs_async(rtio,
                       iodev,
                       RTIO_BUS_SPI,
                       &regs,
                       sqe,
                       dev,
                       op_cb);

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2025-07-28 16:44:17 -04:00
Luis Ubieda
49a1b2417e icm4268x: Fix typos on has_trigger API
Missed during icm42688 to icm4268x refactoring as it was mispelled
in the first-place.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-07-28 16:38:52 -04:00
Luis Ubieda
4e1add203f icm4268x: fix typo on ODR attribute for 16k
Otherwise this setting will be ineligible through run-time
attribute configuration.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-07-28 16:38:52 -04:00
Luis Ubieda
b9099918fa paa3905: Send led-control disabled sequence
Otherwise, a previous firmware build could have run into the chip and
keep led control enabled in spite of disabling it through
dts-property.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-07-28 08:55:56 -04:00
Luis Ubieda
1725408b59 bmp581: code-style improvements
Remove extra-parentheses when operator precedence is implicit.
Eliminate implicit integer to boolean conversions.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-07-25 23:33:47 +02:00
Luis Ubieda
e7395a90f6 bmp581: stream: Add FIFO Watermark support
Configurable through dts property: fifo-watermark.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-07-25 23:33:47 +02:00
Luis Ubieda
7e3d5679d9 bmp581: Add LOG_ERR if initialization fails
Usually, drivers failing to initialize throw a message in the log,
signaling the cause of failure. Add it to this driver so the user
isn't confused by no message yet the device being marked as disabled.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-07-25 23:33:47 +02:00
Luis Ubieda
d2c4d0c34e bmp581: fix: Add parenthesis to macro arguments
Otherwise it leads to potential incorrect expansions.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-07-25 23:33:47 +02:00
sudarsan N
7312715975 drivers: sensor: fcx_mldx5: Fix potential buffer overflow in UART frame
Fix Coverity issue CID 363738 (CWE-120): A potential buffer overflow could
occur in fcx_mldx5_uart_send() due to unchecked memcpy() when copying
command data into a fixed-size frame buffer.

This patch ensures that the length of the data being copied validated
against the remaining buffer size to prevent overruns. Also replaces a
redundant strlen() call with the precomputed cmd_data_len.

Fixes: #92634

Signed-off-by: sudarsan N <sudarsansamy2002@gmail.com>
2025-07-25 23:29:04 +02:00
Luis Ubieda
216fc8f5de sensor: icm4268x: Add support for ICM42686 variant
Now this driver supports both ICM42688 and ICM42686.
Tested with read-decode as well as streaming mode.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-07-25 23:28:47 +02:00
Luis Ubieda
8b30d11785 sensor: icm4568x: Address existing code issues by static analysis
Addressing low-hanging fruits.

Put in a separate commit in order to make it easier to keep track of
changes.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-07-25 23:28:47 +02:00
Luis Ubieda
8db851ff57 general: icm4268x: Refactor ICM42688 driver to ICM4268X
As a first step to enable the similar variants (e.g: ICM42686),
refactor common functionality into icm4268x files. As a result,
applications using the icm42688 will need to have both compatible
properties: "invensense,icm42688" and "invensense,icm4268x" defined.
In-tree boards have been modified to comply with this pattern.

This patch does not contain functional changes. The driver should
work the same as before.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-07-25 23:28:47 +02:00
Zhaoxiang Jin
1564438d17 drivers: acmp: Updated driver to be compatible with nxp_rt7xx
1. Fixed the bug that DAC value was set incorrectly.
2. The MIMXRT700 does not have windowed mode and
'enableSample' controls, code added for compatibility
on this platform.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2025-07-24 16:56:55 +01:00
Nick Ward
38c3225af6 drivers: sensor: bmi323: use sensor_value_from_micro()
Use sensor_value_from_micro() helper.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2025-07-23 09:33:59 +02:00
Sabrina Simkhovich
b591d141a2 drivers: sensor: mb7040: add support for MB7040 ultrasonic sensor
This commit adds a new driver for the MaxBotix MB7040 ultrasonic
rangefinder. The driver uses I2C communication to read range data
from the sensor and exposes it via the Zephyr sensor API.

Tested on an esp32-s3 board using I2C bus. Verified readings at multiple
distances to confirm accuracy.

Signed-off-by: Sabrina Simkhovich <sabrinasimkhovich@gmail.com>
2025-07-22 19:37:18 -04:00
Benjamin Cabé
5c95ff509f drivers: sensor: paj7620: use LOG_MODULE_DECLARE across driver files
paj7620 log module was being registered twice ; use LOG_MODULE_DECLARE
instead in paj7620_trigger.c

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-07-22 08:16:06 -04:00