Commit graph

2,592 commits

Author SHA1 Message Date
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
Lin Yu-Cheng
83e350b5a0 sensor: rts5912: reduce Tachometer wake up frequency
Adjusted RTS5912 tachometer behavior to reduce interference with CPU sleep.

Signed-off-by: Lin Yu-Cheng <lin_yu_cheng@realtek.com>
2025-10-02 11:47:12 +03:00
Jeppe Odgaard
29d01736d8 drivers: sensor: omron: add d6f driver
Add support for Omron D6F mass flow rate sensor series. The sensor series
outputs an analogue voltage which is read using an ADC.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-10-01 17:14:28 -04:00
Jeppe Odgaard
f8a952f2fe include: drivers: sensor: add flow rate channel
Add flow rate to `enum sensor_channel` in litres per minute.

The SI unit for flow rate is cubic metres per second. Due to a sensor value
resolution of 1/100000 this unit is not granular enough for low flow rate
sensors.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-10-01 17:14:28 -04:00
Cla Mattia Galliard
4925e3a221 drivers: sensor: voltage_divider: Use k_timepoint_t for absolute time
Use k_timepoint_t instead of k_timeout_t for absolute time to avoid
ambiguity and ensure the code works even when CONFIG_TIMEOUT_64BIT=n.

Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
2025-10-01 17:13:59 -04:00
Fabian Blatz
a6500f1c48 drivers: sensor: voltage-divider: Add skip-calibration property
Adds a skip-calibration property to the voltage divider sensor,
which can be enabled, in case the underlying ADC driver
does not support calibration.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
2025-10-01 17:13:05 -04:00
Johan Hedberg
ca1ee72236 drivers: Fix deprecated SPI_DT_SPEC_INST_GET usage
This macro doesn't accept a delay parameter anymore (well, it does, but
it's deprecated and will trigger build warnings). Just remove it from the
places that were still passing it.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-10-01 17:20:41 +03:00
Johan Hedberg
e3f3b6dca6 drivers: sensor: Fix deprecated SPI_DT_IODEV_DEFINE usage
The delay parameter was removed from this macro, so don't pass it.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2025-10-01 17:20:41 +03:00
Declan Snyder
570b445a61 drivers: Convert to use SPI macro without delay parameters
Convert all drivers and other consumers to use SPI macros without the
delay parameters.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-10-01 14:39:36 +03:00
Ayush Singh
eac11753fc drivers: sensor: ti: ti-hdc20xx: Fix sensor define
- Since ti-hdc20xx is a sensor, it should use SENSOR_DEVICE_* macro for
  definition.
- Allows it to work with sensor_shell properly.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-10-01 08:26:32 +02:00
Luis Ubieda
e868e01c1f sensor: fix: Add missing iodev const on zvrfy handler
Was forgotten on #96245. Fixes: #96668.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-09-30 19:37:41 +02:00
Luis Ubieda
110e315fdc rm3100: decoder: fix missing const while edata buffer casting
To suppress compliance warnings.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-09-30 19:37:10 +02:00
Luis Ubieda
ff7a350d9c rm3100: decoder: fix trigger detection on data-ready
Otherwise we'd always return false in spite of the flag being set in
the encoded data, which may lead to the user not reading the underlying
data in an event-paced readout scheme.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-09-30 19:37:10 +02:00
Pieter De Gendt
c3bb498f86 drivers: sensor: st: iis3dwb: Update RTIO callbacks with result argument
Commit bc8d66d538931e650dd2855fabe768720dcb4b02 introduced a
result argument to some RTIO callback handlers. Update for the IIS3DWB
sensor.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-09-30 15:26:27 +03:00
Luis Ubieda
91c57f1eca icm45686: stream: Add missing INT disable on error completion
Multi-shot request should re-enable it shortly.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-09-30 11:02:12 +02:00
Luis Ubieda
63fe2def28 icm45686: stream: Optimize stream data-handling
Process all in one callback, in order to reduce latency.
The following changes have been done:
- Process FIFO read-out and/or Data-ready in GPIO callback.
- FIFO Full is handled on completion if needed.
- Omit fifo-count fetching, to optimize cycles. The watermark
count is the number of samples we're going for.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-09-30 11:02:12 +02:00
Luis Ubieda
9c4d1c5c4c icm45686: stream: Only enable GPIO interrupts when stream is active
Otherwise a lot of spurious callbacks may trigger shortly after
rebooting.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-09-30 11:02:12 +02:00
Luis Ubieda
214bdfd31a icm45686: rtio: Expand bus RTIO queue size
To handle streaming under stress scenario.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-09-30 11:02:12 +02:00
Luis Ubieda
60eceef41b icm45686: stream: Improve tracking of state transitions
By introducing three states: Off -> On -> Busy -> (Offf)

This allows us to more clearly guard on-going events and detect
overlapping triggers.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-09-30 11:02:12 +02:00
Luis Ubieda
b87f0ffbf3 icm45686: stream: Remove run-time variability of samples on FIFO WM
Since the driver knows how many samples it wants (because of the
watermark threshold), stick to that per event in order to facilitate
batches of N number of samples.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-09-30 11:02:12 +02:00
Luis Ubieda
836e6fb882 icm45686: stream: Remove memset when completing stream event
As it's not required, so we rather spare the cycles.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-09-30 11:02:12 +02:00
Luis Ubieda
ea708cf9e1 icm45686: Add warning log when event triggered while busy
In order to detect when events are being missed.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-09-30 11:02:12 +02:00
Luis Ubieda
7921ca4090 icm45686: stream: Add missing call to drop RTIO Bus queue when full
Not handled otherwise.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-09-30 11:02:12 +02:00
Luis Ubieda
fdc359547b icm45686: stream: Refactor completion actions through helper function
In order to simplify code-logic.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-09-30 11:02:12 +02:00
Luis Ubieda
532c80a764 icm45686: Replace assert for check-if when buffer alloc fails
In order to allow the error-handling scheme to take action, instead
of crashing when asserts are enabled. Now possible since we have RTIO
error handling for streaming mode.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-09-30 11:02:12 +02:00
Luis Ubieda
bab0723972 icm45686: Update RTIO bus API to simplify async transfers
Similar pattern applied to other in-tree sensor drivers, where
preparing a set of SQEs for writing/reading on registers is a recurrent
syntax.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-09-30 11:02:12 +02:00
Armando Visconti
b390cbd6b2 drivers/sensor: iis3dwb: add streaming capabality
Add read_and_decode streaming APIs support.

Triggers supported:
    - SENSOR_TRIG_FIFO_WATERMARK
    - SENSOR_TRIG_FIFO_FULL
    - SENSOR_TRIG_DATA_READY

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2025-09-30 11:01:12 +02:00
Armando Visconti
93a30e7806 drivers/sensor/st: add support to IIS3DWB accel
The IIS3DWB is a system-in-package featuring a 3-axis digital vibration
sensor with low noise over an ultrawide and flat frequency range.
The wide bandwidth, low noise, very stable and repeatable sensitivity,
together with the capability of operating over an extended temperature
range (up to +105 C), make the device particularly suitable for vibration
monitoring in industrial applications.

Datasheet: https://www.st.com/en/mems-and-sensors/iis3dwb.html

This driver is currently only supporting the polling-mode read_and_decode
APIs (both blocking and non-blocking).

This driver is based on stmemsc HAL i/f v2.9.1.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2025-09-30 11:01:12 +02:00
Tobias Kässer
9cbcdda587 drivers: sensor: adxl345: Add support for motion trigger
Adding minimal support for using motion trigger interrupts
with the adxl345

Signed-off-by: Tobias Kässer <t.kaesser@gmail.com>
2025-09-30 11:00:14 +02:00
Anthony Williams
e6ff45d38a sensor: rm3100: Add support for SPI
Add support for SPI

Signed-off-by: Anthony Williams <anthony289478@gmail.com>
2025-09-30 10:59:21 +02:00
Michał Stasiak
a0b008bef4 drivers: sensor: qdec_nrfx: add conditional PM ISR safety
Requesting/releasing QDEC device may be ISR safe, but
it cannot be reliably known whether managing its power
domain is. Is is then assumed that if power domains are used,
device is no longer ISR safe. This macro let's us check if
we will be requesting/releasing power domains and determines
PM device ISR safety value.

Signed-off-by: Michał Stasiak <michal.stasiak@nordicsemi.no>
2025-09-25 09:22:45 +02:00
Thomas Schmid
bab5484ed8 sensor: mcp9600: extend driver functionality
Add support for runtime and devicetree configuration of themocouple
type, ADC resolution, filter coefficient and cold junction temperature
resolution. Extend device specific sensor channels to include cold
junction temperature, delta tempereature, hot junction temperature and
raw ADC values while still maintaining backwards compability with the
existing SENSOR_CHAN_AMBIENT_TEMP channel.

Signed-off-by: Thomas Schmid <tom@lfence.de>
2025-09-24 19:18:43 -04:00
Manoj Purushothama
75b98415fa drivers: sensor: tsl2591: fix sign extension
Explicitly cast data->atime to uint32_t to
prevent signed promotion and sign extension
when multiplying with data->again.

Signed-off-by: Manoj Purushothama <hpmanoj@umich.edu>
2025-09-22 17:51:44 -04:00
Guillaume Gautier
43bf0b3344 drivers: sensor: st: qdec: remove init struct
Remove the calls to LL_TIM_ENCODER_StructInit and LL_TIM_ENCODER_Init
in the QDEC driver. This avoids calling functions from stm32xxxx_ll_tim.c.
They are replaced by a set of simpler functions from the header file.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-09-19 12:46:46 -04:00
Dipak Shetty
c85922f97c drivers: sensor: ti: tmp1075: fix one-shot conversion for shutdown mode
Add missing one-shot conversion logic in sample_fetch when driver is
configured for shutdown mode. Previously, the driver would attempt to
read temperature without triggering conversion, resulting in stale data.

Signed-off-by: Dipak Shetty <shetty.dipak@gmx.com>
2025-09-18 19:09:11 -04:00
Arthur Gay
acf7657c45 drivers: sensor: lis2dh: Add self-test attribute
Add support for enabling and configuring the self-test mode of the
LIS2DH accelerometer through a dedicated sensor attribute.

Signed-off-by: Arthur Gay <arthur.gay@marshmallow.kids>
2025-09-18 19:08:32 -04:00
Steffen Schulz
4ae52ca220 drivers: sensors: add a sensor driver for INA7xx
Add a sensor driver for the TI current sensor.
INA700, INA745, INA780

Signed-off-by: Steffen Schulz <steffenschulz@gmx.de>
2025-09-18 13:41:50 -04:00
Jonas Berg
f683bc53d1 drivers: sensor: ti: ina2xx: Add INA228 test
Add test for Texas Instruments INA228 current sensor via I2C.

Signed-off-by: Jonas Berg <jonas.s.t.berg@gmail.com>
Signed-off-by: Wilkins White <ww@novadynamics.com>
2025-09-16 16:06:38 +02:00
Wilkins White
8ed9787089 drivers: sensor: ti: ina2xx: Add INA228
Add the Texas Instruments INA228 Power/Energy/Charge
monitor. This chip is similar to the INA237, but has
a more precise ADC and added energy/charge channels.

Signed-off-by: Wilkins White <ww@novadynamics.com>
2025-09-16 16:06:38 +02:00
Wilkins White
685fec5809 drivers: sensor: ti: ina2xx: Convert INA226
Convert the INA226 driver to INA2XX

Signed-off-by: Wilkins White <ww@novadynamics.com>
2025-09-16 16:06:38 +02:00
Wilkins White
5ffb8c6305 drivers: sensor: ti: ina2xx: Convert INA230
Convert the INA230 driver to INA2XX

Signed-off-by: Wilkins White <ww@novadynamics.com>
2025-09-16 16:06:38 +02:00
Wilkins White
9c113d0a00 drivers: sensor: ti: ina2xx: Convert INA237
Convert the INA237 driver to INA2XX

Signed-off-by: Wilkins White <ww@novadynamics.com>
2025-09-16 16:06:38 +02:00