Commit graph

2,634 commits

Author SHA1 Message Date
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
Wilkins White
bb570cbea4 drivers: sensor: ti: ina2xx: Add common functions
This commit adds a common framework to reduce repeated
code in the INA2XX family.

Signed-off-by: Wilkins White <ww@novadynamics.com>
2025-09-16 16:06:38 +02:00
Wilkins White
06b1440890 drivers: sensor: ti: Rename ina23x to ina2xx
This commit renames the ina23x folder and common files to ina2xx.
The more generic name will support, e.g., the INA237 and INA228
series chips.

Signed-off-by: Wilkins White <ww@novadynamics.com>
2025-09-16 16:06:38 +02:00
Tom Burdick
e8c676be47 rtio: More useful callback OPs
Callbacks now take a result parameter which may, if the callback was
linkd to by a previous submissions, have the result code from the last
submission.

Additionally the userdata is now const by default making it easier to
use the device pointer as the userdata which is very common.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2025-09-16 09:53:14 +02:00
Jordan Yates
1c7f1e56cc sensor: current_amp: improve output resolution
Improve the output resolution by converting internally to microvolts
rather than millivolts.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-09-15 19:44:36 -04:00
Jordan Yates
1f144307cf sensor: current_amp: optional high-range gain fallback
Add the option to specify an alternate ADC gain value to use if the
initial measurement saturates the range. This enables higher data
resolutions when the values are small compared to the maximum signal
values, while still supporting the maximum.

As a concrete example, measuring charge currents from a small solar
panel (0 - 50mA), while also supporting high USB charge currents
(up to 1A).

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-09-15 19:44:36 -04:00
Anthony Williams
3e7a941094 sensor: icm45686: Fix one-shot missing shift value for XYZ channels
Fix missing shift values in `sensor_three_axis_data`  when performing
one-shot reads on SENSOR_CHAN_ACCEL_XYZ and SENSOR_CHAN_GYRO_XYZ

Signed-off-by: Anthony Williams <anthony289478@gmail.com>
2025-09-15 19:44:25 -04:00
Jan Kablitz
e93bf00d5d drivers: sensor: st: lis2du12: fix missing power down before sw reset
According to the LIS2DU12 datasheet (p.30), the device must be
inpower-down mode before executing a software reset.
Entering power-down requires setting the ODR field to 0x000.
This commit adds the missing call to set ODR=0x000 before issuing the
reset. Without this step, the sensor does not recover after a controller
reset and only resumes operation after a full power cycle.

Signed-off-by: Jan Kablitz <jan.kablitz@8tronix.de>
2025-09-15 13:59:25 -04:00
Jan Kablitz
b7c971d1d1 drivers: sensor: st: lis2du12: relocate definition of reboot function
Relocate private reboot function to allow ODR configuration before
execution. This will ensure proper power-down sequence prior to software
reset.

Signed-off-by: Jan Kablitz <jan.kablitz@8tronix.de>
2025-09-15 13:59:25 -04:00