Commit graph

2,633 commits

Author SHA1 Message Date
Guillaume Gautier
004c613e25 drivers: stm32: replace MODIFY_REG HAL macro by stm32_reg_modify_bits
For all STM32 drivers and SoC, replace the MODIFY_REG macro (defined in
the STM32 HAL) by stm32_reg_modify_bits defined in Zephyr.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-10-24 08:58:25 -07:00
Guillaume Gautier
124448582f drivers: stm32: replace READ_REG HAL macro by stm32_reg_read
For all STM32 drivers and SoC, replace the READ_REG macro and the
LL_xxx_ReadReg functions (defined in the STM32 HAL) by
stm32_reg_read defined in Zephyr.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-10-24 08:58:25 -07:00
Guillaume Gautier
44415b5af8 drivers: stm32: replace READ_BIT HAL macro by stm32_reg_read_bits
For all STM32 drivers and SoC, replace the READ_BIT macro (defined in
the STM32 HAL) by stm32_reg_read_bits.
Fixes some cases where the return value was tested like a boolean
despite not being one.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-10-24 08:58:25 -07:00
Guillaume Gautier
a2339c9b91 drivers: stm32: replace CLEAR_BIT HAL macro by stm32_reg_clear_bits
For all STM32 drivers, replace the CLEAR_BIT macro (defined in
the STM32 HAL) by stm32_reg_clear_bits defined in Zephyr.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-10-24 08:58:25 -07:00
Guillaume Gautier
73e9749c68 drivers: stm32: replace SET_BIT HAL macro by stm32_reg_set_bits
For all STM32 drivers, replace the SET_BIT macro (defined in
the STM32 HAL) by stm32_reg_set_bits defined in Zephyr.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-10-24 08:58:25 -07:00
Wajdi ELMuhtadi
ffdf184b86 drivers: sensor: wsen_pdms_25131308XXX05: add sensor driver
Add wsen_pdms_25131308XXX05 driver.

Signed-off-by: Wajdi ELMuhtadi <wajdi.elmuhtadi@we-online.com>
2025-10-24 01:12:21 +03:00
Wajdi ELMuhtadi
c555a2969d manifest: hal_wurthelektronik: update to sensors sdk v2.7.0
Update the hal to have the latest Sensors SDK
version 2.7.0

Signed-off-by: Wajdi ELMuhtadi <wajdi.elmuhtadi@we-online.com>
2025-10-24 01:12:21 +03:00
Andreas Klinger
c93788a0ea drivers: sensor: remove redundancies in veml6031 and veml6046
- create common header file veml60xx-common.h for sensors VEML6031 and
  VEML6046.

Signed-off-by: Andreas Klinger <ak@it-klinger.de>
2025-10-22 18:14:02 -04:00
Andreas Klinger
1e80842749 drivers: sensor: add Vishay veml6046 RGBIR color sensor
- add driver for Vishay VEML6046 RGBIR color sensor
- add new compatible "vishay,veml6046"
- support fetch and get sensor subsystem operations
- triggered mode and interrupts are not yet supported

Signed-off-by: Andreas Klinger <ak@it-klinger.de>
2025-10-22 18:14:02 -04:00
Luis Ubieda
7e317201cc bmi08x: Add support for Read-decode and Streaming Mode
One-shot reads through Read-Decode API matches functionality
from Fetch-Get API, but asynchronously.

Streaming mode supporting FIFO Watermark Interrupts. Works for both
Gyro and Accel drivers.

These changes are covered under the build-all test for sensor async
api.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-10-22 18:09:24 -04:00
Daniel Kampert
cc3c0d04cf drivers: sensor: Add driver for MAX32664C
- Add DTS for MAX32664C
- Add driver for MAX32664C
- Add example for MAX32664C Heart rate measurement with Bluetooth
- Add private attributes and channels for health measurement

Closes: #93473

Signed-off-by: Daniel Kampert <DanielKampert@kampis-elektroecke.de>
2025-10-22 18:35:14 +03:00
Benjamin Cabé
2f91d64997 drivers: sensor: pni: rm3100: drop unused inline function
settings_changed() is not used, causing warnings when building with
clang. Drop it

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-10-22 15:54:12 +03:00
Benjamin Cabé
8e7599af34 drivers: sensor: adxl345: fix uninitialized variable warning
Fix -Wsometimes-uninitialized warning by initializing data_opt directly
from fifo_wmark_cfg->opt. At this point in the code flow, fifo_wmark_cfg
is guaranteed to be non-NULL because we can only reach this code after
fifo_full_irq is true, which requires fifo_wmark_cfg to be non-NULL.

Added an assertion to document this invariant.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-10-22 15:54:12 +03:00
Luis Ubieda
b48e649040 icm4268x: Various driver Improvements for streaming mode
This patch makes the following improvements:
- Helper APIs for simplifying RTIO transfers.
- Simplify RTIO Streaming implementation to reduce processing time.
- Add streaming mode atomic state, in order to track overruning the
callback events generation.
- Add device pointer address to logging on error-occurrences, as it is
useful when the app has multiple instances of the driver (e.g: NXP's
VMU RT1170 has two).

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-10-22 08:52:29 +02:00
Luis Ubieda
f71c0c8898 icm4268x: Do not enable GPIO Interrupts on trigger_init
Wait until the trigger or streaming mode is configured. Otherwise,
rebooting in-between runs may cause multiple callbacks invoked when
the trigger may have not been enabled yet.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-10-22 08:52:29 +02:00
Luis Ubieda
75ace90a2c icm4268x: Remove padding from Decoder struct
This induces extra-cycles in the encoding path while streaming, which
make it difficult to achieve high-bandidth performance. The use-case
being dealt with involves cranking the IMU at 8000 ODR in batches of
1.25 ms (10 samples at 800 Hz).

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-10-22 08:52:29 +02:00
Luis Ubieda
fa96f07a42 icm4268x: Remove RTIO Workqueue usage in streaming mode
As it introduces latencies due to switching to the threads pool.
Moreover, this is not required for streaming as it executes in a
non-blocking path.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-10-22 08:52:29 +02:00
Luis Ubieda
9de11f529a icm4268x: Add defensive code to prevent invalid submissions
Missing packets or overrunning/underrunning the queue should not result
in a system crash.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-10-22 08:52:29 +02:00
Luis Ubieda
2648e0190a icm4268x: Expand Bus RTIO queue
Based on performance observed when cranking the sensor at +1000 Hz ODR,
otherwise is not able to keep up with the pace.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-10-22 08:52:29 +02:00
Luis Ubieda
4ca0f189fe sensor: icm45686: Fix build-time failure on I3C mode
Missed while simplifying RTIO bus transfers on #94832.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-10-21 22:53:20 +03:00
Luis Ubieda
f28b1b74b1 sensor: all: Fix missing result argument on RTIO callbacks
If there's an error/result checked, consider the callback result in
such solution.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-10-21 22:53:20 +03:00
Clément Laigle
fc2e63048b drivers: sensor: omron 2smpb_02e: add FPU selection
Co-authored-by: Luis Ubieda <luisubiedas@gmail.com>
Signed-off-by: Clément Laigle <c.laigle@catie.fr>
2025-10-21 12:25:45 -04:00
Clément Laigle
3920294751 drivers: sensor: add support for OMRON 2SMPB_02E pressure sensor
Support for the OMRON 2SMPB_02E digital barometric pressure sensor.

Signed-off-by: Clément Laigle <c.laigle@catie.fr>
2025-10-21 12:25:45 -04:00
Jeppe Odgaard
46de640492 drivers: sensor: qdec_stm32: check counts/revoultion compile time
Use build assert to check counts_per_revolution DTS value compile time to
prevent runtime failure and also decrease flash usage slightly.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-10-21 14:14:38 +03:00
Benjamin Cabé
ef2141987d drivers: sensor: ti_hdc302x: Fix double-promotion warnings
Change HDC_302X_TEMP_OFFSET_SCALE and HDC_302X_HUMIDITY_OFFSET_SCALE
from float literals to double literals to avoid implicit conversion
warnings when compiling with clang and -Wdouble-promotion flag.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-10-21 11:40:29 +03:00
COUSSEMENT Stijn
523eed2d08 drivers: sensor: ti: Add TI temp sensor HDC302x
The HDC302X sensor driver is added,
you can use this driver to read temperature and humidity.
Also set an offset, upper and lower limits to get warned
when temperature or humidity get out of band.
The sensor is build for ultra low power applications.

Signed-off-by: COUSSEMENT Stijn <stijn.coussement@psicontrol.com>
2025-10-20 19:19:09 -04:00
Zhaoxiang Jin
c6033d58e5 drivers: sensor: pmc_tmpsns: Reduce floating-point operations
Reduce floating-point operations in the nxp_pmc_tmpsns.
Provide new calculation method without floating-point operations.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2025-10-20 19:18:36 -04:00
Zhaoxiang Jin
44bc475309 drivers: sensor: Enable NXP pmc tmpsns driver
This commit introduced NXP pmc temperature sensor
(pmc-tmpsns) driver.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2025-10-20 19:18:36 -04:00
Logan Saint-Germain
089ea66914 drivers: sensor: max30101: Enhanced sample_fetch to match datasheet
The max30101 allows to configure time slots in samples acquisition.
It is now supported by adding matrix mapping for the slot/fifo
indexing. When a channel is present multiple times, the resulting
sample from the `sensor_channel_get` is averaging each entry.
Added Die temperature sample acquisition with
`CONFIG_MAX30101_DIS_TEMPERATURE` Kconfig.

Signed-off-by: Logan Saint-Germain <l.saintgermain@catie.fr>
2025-10-20 19:17:51 -04:00
Logan Saint-Germain
52d0ad2c67 drivers: sensor: max30101: Enhanced driver to support triggers
The max30101 sensor driver doesn't support triggers.
Add `.trigger_set` API and corresponding Kconfig and
device tree parameters. Add `SENSOR_CHAN_AMBIENT_LIGHT`
and `SENSOR_TRIG_OVERFLOW`.

Signed-off-by: Logan Saint-Germain <l.saintgermain@catie.fr>
2025-10-20 19:17:51 -04:00
Logan Saint-Germain
8a1371c5d6 drivers: sensor: max30101: Enable support for multiple instance
The max30101 sensor driver doesn't support multiple instance.
Update Kconfig and maxim,max30101.yaml for instance based
configuration. Propagate changes over existing files.

Signed-off-by: Logan Saint-Germain <l.saintgermain@catie.fr>
2025-10-20 19:17:51 -04:00
Anthony Williams
3158211391 sensor: icm45686: Use explicit VLA for fifo encoded data
The size of icm45686_encoded_data fifo_payload is guaranteed
to span the full number of frames read as it was allocated during
icm45686_event_handler() buf_len_required size.

This update suppresses the static analysis warning of
out of bounds memory access at index 1 by explicitly declaring
fifo_payload to be a VLA at the end of icm45686_encoded_data.

Signed-off-by: Anthony Williams <anthony289478@gmail.com>
2025-10-20 19:15:30 -04:00
Anthony Williams
d0d29aa5e2 sensor: icm45686: Swap ASSERT to CHECKIF in fifo decode
Change the __ASSERT on unsupported fifo packet header to
CHECKIF so the user can choose how to handle the invalid
packet.

Signed-off-by: Anthony Williams <anthony289478@gmail.com>
2025-10-20 19:15:30 -04:00
Anthony Williams
2df6c368ba sensor: icm45686: Implement AN-000364 fix for fifo corruption
When operating in streaming mode, a FIFO empty event, which
is caused by host reading the last byte of the last FIFO frame,
can cause FIFO data corruption.

During subsequent reads to the FIFO, the first  frame that arrives
after the empty condition will be corrupted. Once the issue occurs,
the internal state cannot recover and the FIFO must be flushed in
bypass mode to clear the corrupted state.

The current workaround from TDK is to read M-1 frames when M frames
are reported by fifo_count. Since M is fixed by the fifo_watermark
DT parameter, and in cases where fifo_watermark == 1, the watermark
trigger threshold is set to M + 1 frames and M frames are read out
during a watermark threshold event.

Signed-off-by: Anthony Williams <anthony289478@gmail.com>
2025-10-20 19:15:30 -04:00
Anthony Williams
ee63650541 sensor: icm45686: Print unsupported fifo packet on assert
When an unsupported fifo packet triggers an assert, it is
helpful to see the packet as a hex value to help when debugging.

Signed-off-by: Anthony Williams <anthony289478@gmail.com>
2025-10-20 19:15:30 -04:00
Robert Perkel
1d5ffe5cc5 drivers: sensor: microchip: mtch9010 Added mtch9010 support
Added support for MTCH9010 and applied edits from reviewers.

Signed-off-by: Robert Perkel <robert.perkel@microchip.com>
2025-10-17 21:02:44 -04:00
Fabian Barraez
6b8fcaeecf drivers: sensor: add support for ALS31300 3D Hall Effect Sensor
Add driver for Allegro Microsystems ALS31300 3-axis linear Hall Effect
sensor. The driver supports:
- I2C communication interface
- X, Y, Z magnetic field measurements
- Device temperature readings

Signed-off-by: Fabian Barraez <fabianbarraez@gmail.com>
2025-10-17 22:02:28 +03:00
Shreehari HK
371a27c849 drivers: sensor: tdk: icm42x70: update temperature data processing
Update the temperature data processing to
handle different data sizes based on FIFO configuration.
The temperature sensor data size and conversion
formula vary depending on the FIFO mode:
1. FIFO disabled: Uses 20-bit data format
2. FIFO enabled (standard resolution): 16-bit data
3. FIFO enabled (high resolution): 20-bit data

The implementation now:
- Uses the 'fifo_highres_enabled' flag
  to determine the correct data size
- Applies the appropriate conversion formula
  based on the resolution mode
- Handles all three possible FIFO configurations
- Ensures accurate temperature readings in all modes

Signed-off-by: Shreehari HK <shreehari.hk@alifsemi.com>
2025-10-17 22:01:32 +03:00
Anthony Williams
3d5417e654 sensor: icm45686: Move watermark threshold mode to DT config
Move the watermark threshold trigger mode to a configurable dt boolean.

When using the default configuration of watermark threshold
interrupt greater than or equals, extra interrupts are serviced
to icm45686_event_handler().

When `fifo-watermark-equals;` is added to the sensor DT overlay,
the new behavior is only one interrupt is generated per watermark
threshold crossing. Until the host drains the fifo, no extra interrupts
will be generated.

Signed-off-by: Anthony Williams <anthony289478@gmail.com>
2025-10-17 17:03:27 +03:00
Daniel Kampert
7a4c4a6f9b sensors: apds9306: Fix I2C write/read pointer issue
- Fix i2c_write_read_dt read buffer pointer
- Initialize val2 in apds9306_attr_get with 0

Closes #97623

Signed-off-by: Daniel Kampert <DanielKampert@kampis-elektroecke.de>
2025-10-17 17:02:24 +03:00
Martin Koehler
1667602b76 drivers: sensor: ti,ina226: Fixed calibration value
Issue:
- The calibration value had the correct elements but false operations
- This leads to wrong values or even saturation

Changes:
- Added explenation of formula
- Moved constant from MACRO into formula to get rid of the
  confusing 10000000ULL constant
- Added rounding for better results

Signed-off-by: Martin Koehler <koehler@metratec.com>
2025-10-17 11:18:38 +02:00
Sergei Ovchinnikov
3ae0d39de7 drivers: sensor: npm13xx_charger: improve sample fetching
Change the npm13xx_charger fetch function to first trigger a sample
and then block until the result is available.

Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>
2025-10-15 15:38:48 +03:00
Luis Ubieda
a762327546 icm45686: fix: Add and use result from completion callback
Issue based on rebasing with in-flight changes where the callback adds
an argument on the readout transfers. Moreover, handle that result and
error if failure.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-10-15 12:02:54 +03:00
Luis Ubieda
5dd5a519e3 icm45686: fix helper function to not receive int_status
As such decision is taken based on the streaming configuration.
Addresses compilation issue.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-10-15 12:02:54 +03:00
Christoph Jans
22471f1fe2 drivers: sensor: tdk: redefine trigger as ptr to make use of CONTAINER_OF
Allows CONTAINER_OF inside trigger handler to be used to obtain a valid
ptr to the composite struct consisting of a struct sensor_trigger trig.

Fixes zephyrproject-rtos/zephyr#97124

Signed-off-by: Christoph Jans <jans.christoph@gmail.com>
2025-10-09 22:53:51 +03:00
Sašo Domadenik
2ac238cce0 drivers: sensor: ds18b20: Fix temperature calculation for ds18s20
The millionths value is calculated incorrectly.
The sensor has a precision of 0.5 which is 500000 millionths, but
there is an extra zero in the code. This fix removes the extra zero.

Signed-off-by: Sašo Domadenik <saso.doma@gmail.com>
2025-10-08 17:47:10 +03:00
Anas Nashif
bf82f7ffac copyrights: fix copyright line
Add space before (c) to allow correct parsing by linters.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-07 22:53:45 -04:00
Armando Visconti
ea072d31ff drivers/sensor/: lis2dux12/lsm6dsv16x: use helpers
Make use of rtio_read_regs_async() and rtio_flush_completion_queue()
helpers in lis2dux12 and lsm6dsv16x sensor drivers.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2025-10-07 17:43:32 +03:00
Jan Kablitz
be0e98388c drivers: sensor: st: lis2du12: add SENSOR_TRIG_DELTA support
Extend the LIS2DU12 accelerometer driver with SENSOR_TRIG_DELTA
support. The detection is based on the slope between successive
channel readings. Support for setting SENSOR_ATTR_SLOPE_TH and
SENSOR_ATTR_SLOPE_DUR is added as well. In line with other sensors,
SENSOR_ATTR_SLOPE_TH is configured in SI units (m/s^2) and
SENSOR_ATTR_SLOPE_DUR in samples relative to the ODR. The new trigger
can be mapped either to the same GPIO as the data-ready interrupt or
to a dedicated one.

Signed-off-by: Jan Kablitz <jan.kablitz@8tronix.de>
2025-10-06 15:10:01 -04:00
Jeppe Odgaard
5eed3a9c92 drivers: sensor: explorir_m: fix variable mix-up
Fix the mix‑up between `filtered` and `scaling` in
`explorir_m_buffer_process()`.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-10-02 15:15:06 +03:00