Commit graph zephyr/drivers/sensor
Author SHA1 Message Date
Atilla Filiz
ddd25e81e7 drivers: sensor: add ams as6221 temperature sensor driver support
The as6221 is functionally equivalent to ti tmp108 and ams as6212,
so it is added as a new variant of tmp108.

Signed-off-by: Atilla Filiz <atilla@fi-tech.be>
2025-12-11 16:58:50 +01:00
Tobias Kässer
ef85dbe085 drivers: sensor: adxl345: add device PM support
Add support for the Zephyr device power management framework to
enable runtime power control of the ADXL345 accelerometer.

This implementation adds a pm_device_action callback that handles
SUSPEND and RESUME actions. When suspended, the sensor enters
standby mode for low power operation. On resume, it returns to
measurement mode.

The implementation follows the standard pattern used by other
sensor drivers (lis2dh, bme280, vcnl4040) and integrates with
the PM_DEVICE_DT_INST_DEFINE macro for automatic PM setup.

Tested on nRF52832 with CONFIG_PM_DEVICE enabled.

Signed-off-by: Tobias Kässer <t.kaesser@gmail.com>
2025-12-09 22:37:39 -05:00
Mathieu Choplain
923ece1eea drivers: sensor: qdec_stm32: don't enable LL full driver module
The QDEC driver does not use any of the functions implemented in the TIM
LL full driver module (`stm32XXxx_ll_tim.c`), only those provided by the
LL header (`stm32XXxx_ll_tim.h`).

Disable compilation of the unnecessary full driver module.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2025-12-09 11:14:14 +01:00
Felipe Neves
035156ea50 sensors: as5048: add initial support for AS5048 angle sensor
Which is a contactless angle sensor that communicates over
SPI.

Signed-off-by: Felipe Neves <ryukokki.felipe@gmail.com>
2025-12-08 11:39:37 -05:00
Jordan Yates
76c5084943 sensor: current_amp: fix incorrect PM error
Returning `-ENOTSUP` (and logging a `LOG_ERR`) is not the correct
behaviour if there is no enable GPIO. The fact there was no work to do
does not make the result an error.

From the docs for `pm_device_runtime_get`
```
 * @retval 0 If it succeeds. In case device runtime PM is not enabled or
 *  not available this function will be a no-op and will also return 0.
```

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-12-07 21:19:04 -05:00
Anthony Williams
07b300ee4f sensor: rm3100: Remove duplicate edata header encoding when streaming
Remove the manual encoding of edata->header.channels and
edata->header.timestamp as these are now handled during rm3100_encode()

Signed-off-by: Anthony Williams <anthony289478@gmail.com>
2025-12-05 10:54:53 +02:00
Anthony Williams
640a696cc4 sensor: rm3100: Use rm3100_encode to populate cycle_count during stream.
Use rm3100_encode() to populate cycle_count info when
configured in streaming mode.

Previously when configured for streaming, cycle_count would
be 0 and rm3100_convert_raw_to_q31 would default to always
use the 600hz divider resulting in values off by a factor of 2.

Signed-off-by: Anthony Williams <anthony289478@gmail.com>
2025-12-05 10:54:53 +02:00
Anthony Williams
ca2ed7de3d sensor: rm3100: Correct LSB/uT scale factor comment in rm3100_decoder.c
The scale factor when used as a divider from the datasheet specifies
units in LSB/uT not uT/LSB. This change corrects the comment to reflect
the correct units for the divider.

Signed-off-by: Anthony Williams <anthony289478@gmail.com>
2025-12-05 10:54:53 +02:00
Emil Hammarström
9538b4f0de drivers: sensor: lsm6dso: Add support for Accel LP filter
Add device tree support for enabling the second low pass filter
(LPF2) for the accelerometer output.

This adds additional low pass on top of the default ODR/2 from
the LPF1 output.

Signed-off-by: Emil Hammarström <emil.a.hammarstrom@gmail.com>
2025-12-04 14:02:57 -05:00
Emil Hammarström
54cd6a3963 drivers: sensor: lsm6dso: Change log level for failures during init
Log level in failures were changed from DBG to ERR so that the reason of
initialization failure may be known.

Signed-off-by: Emil Hammarström <emil.a.hammarstrom@gmail.com>
2025-12-04 14:02:57 -05:00
Alvis Sun
55156419bc drivers: sensor: npcx: add sensor v2t support for npck3
Introduces the sensor driver managing the V2T module for
temperature readout.

Signed-off-by: Alvis Sun <yfsun@nuvoton.com>
2025-12-04 05:21:24 -05:00
Raffael Rostagno
b3d34a20f6 drivers: sensor: dietemp: esp32: Update driver
Update driver to new version, from legacy driver.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2025-12-02 15:22:30 -05:00
Stoyan Bogdanov
641ec27106 drivers: sensor: rv3032c7: Add temperature sensor driver for rv3032
Expose internal temperature sensor for rv-3032-c7. Driver is reporting
temperature from internal deice sensors and have HIGH an LOW temperature
treshhold which are triggering interrupts. I2C communication and IRQ are
handled from parent MFD driver.

Signed-off-by: Stoyan Bogdanov <sbogdanov@baylibre.com>
2025-12-02 15:20:56 -05:00
Omeed Baboli
1034ba6b9b drivers: sensor: qdec_stm32: add sensor channel for encoder counts
Add a sensor channel for the encoder counts. This is useful for
reading the encoder counts and calculating an absolute position
of a linear actuator.

Signed-off-by: Omeed Baboli <omeedbaboli@gmail.com>
2025-12-02 16:12:35 +00:00
Dilip Raman
00e9d45245 drivers: sensor: adi: fix build warnings in ADXL decoder drivers
Fix invalid pointer-to-integer cast and comparison warnings in
ADXL362, ADXL367, and ADXL372 decoder drivers. The previous code
used `(uint8_t *)*fit` for offset comparison, which triggered
`-Wint-to-pointer-cast` warnings on recent compilers and could
lead to undefined behavior.

This patch replaces unsafe casts with `uintptr_t` arithmetic and
ensures type-safe offset calculations, preserving existing logic
while eliminating all build warnings.

Signed-off-by: Dilip Raman <dilipr@aerlync.com>
2025-12-02 11:27:43 +01:00
Johannes Meyer
8aaa5031f7 drivers: sensor: ti: Add INA232 native support
The INA232 is another device in the INA2XX family and is very similar
to the already implemented INA230 and INA236. The main difference
between the INA232 and the INA236 is that the INA232 does not have a
Device ID register. Because of these similarities, it is implemented
in the ina230.x files in the same way as the IN236. Modifications to
the corresponding tests are included as well.

Signed-off-by: Johannes Meyer <johannes.meyer@intego.de>
2025-12-01 19:48:40 -05:00
Nikodem Kastelik
ad1e5ac253 nordic: update and align to nrfx 4.0.1
New nrfx release contains major rework of nrfx drivers
instantiation making it easier to integrate with dts nodes.
Now, nrfx driver instances can no longer be `const`
because they contain driver runtime state.
Additionally, all nrfx drivers return `errno` error codes
instead of deprecated `nrfx_err_t`.

Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
2025-11-27 14:45:17 +01:00
Pieter De Gendt
506beae4bb drivers: sensor: Fix RTIO fallback scaling from sensor_value to q31
If the sensor_value only has an integer part N, this always resulted in q31
value of <N-1>.999999.
As the calculated shift value already uses 'abs(sample.val1) + 1' it is
safe to assume we can't have 100% scaling of this integer part and we can
omit the -1.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-11-21 12:01:21 +01:00
Qingsong Gou
7a928a3c4e drivers: sensor: sifli: add sf32lb temp sensor
Add temp sensor driver for sf32lb platform

Signed-off-by: Qingsong Gou <gouqs@hotmail.com>
2025-11-18 19:52:37 -05:00
Armando Visconti
a920a8b966 modules/hal_st: Align to stmemsc HAL i/f v2.11.1
Align all sensor drivers that are using stmemsc (STdC) HAL i/f
to new APIs of stmemsc v2.11.1

Requires https://github.com/zephyrproject-rtos/hal_st/pull/27

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2025-11-18 11:17:41 +01:00
Josuah Demangeon
30950b888d style: drivers: sort Kconfig and CMake includes
Use the "zephyr-keep-sorted-start/stop" comment to have CI check
the alphabetical order of includes, to help reducing the chance
of conflicts while contributing drivers.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-11-17 13:48:03 -05:00
Josuah Demangeon
1b87ec87ef style: drivers: apply coding style on CMakeLists.txt files
Apply the CMake style guidelines to CMakeList.txt files in drivers/.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-11-17 13:48:03 -05:00
Maxmillion McLaughlin
b98304a87b drivers: sensors: bmp581: fix temperature scaling
This change fixes and issue where negative temperatures wrap and
return 250C when the sensor gets below zero. The implementation is
pulled from Boschs official BMP5_SensorAPI and has been tested to
work down to -40

Signed-off-by: Maxmillion McLaughlin <max@sorcerer.earth>
2025-11-15 11:23:54 +01:00
Etienne Carriere
b3f4439025 drivers: sensor: stm32_digi_temp: clean indentation in init macros
Clean indentation in STM32_DIGI_TEMP_INIT() macro.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2025-11-14 15:26:17 +02:00
Etienne Carriere
b0ccb2295f drivers: stm32: use STM32_CLOCK_INFO_BY_NAME() and friends
Use STM32_CLOCK_INFO(), STM32_DT_INST_CLOCK_INFO(),
STM32_CLOCK_INFO_BY_NAME() and STM32_DT_INST_CLOCK_INFO_BY_NAME()
helper macros in STM32 drivers.

Using these macros ensure the clock division factor is properly
populated according to DT information. Prior these changes some
drivers only got the bus and bits position information and missed
the clock division information which is fine only when this division
factor information is 0.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2025-11-14 15:26:17 +02:00
Jeppe Odgaard
46adf3b1bb drivers: sensor: tach_gpio: fix rpm debug logging
`data->rpm` is a signed value and should be logged as one.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-11-14 10:29:43 +02:00
Jeppe Odgaard
97781f8b9d drivers: sensor: tach_gpio: add pulses per round
Add pulses-per-round property.

The driver only measures one pulse and uses pulses-per-round in RPM
calculation.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-11-14 10:29:43 +02:00
Daniel Kampert
6ff7a9ec5e sensors: apds9306: Fix typos in APDS9306 macros
- Ensure consistent naming conventions for better readability

Signed-off-by: Daniel Kampert <DanielKampert@kampis-elektroecke.de>
2025-11-13 20:40:53 -05:00
Daniel Kampert
dcbdfea6e7 sensors: apds9306: Add Multi-Instance Support
- Add multi-instance support to the APDS9306 ambient light sensor driver
- Replace global worker item with instance-specific worker item

Closes #97893

Signed-off-by: Daniel Kampert <DanielKampert@kampis-elektroecke.de>
2025-11-13 20:40:53 -05:00
Marcelo Cunha
1c2d7f48ee sensor: bq274xx: fix design energy calculation
In the function bq274xx_gauge_configure it was being used an hardocded
value of 3.7V instead of using the design voltage parameter defined in
the device tree.

Signed-off-by: Marcelo Cunha <mcunha@petsafe.net>
2025-11-03 16:59:14 +02:00
Jeppe Odgaard
e54093ba9a drivers: sensor: add tach_gpio
Add tachometer sensor driver using GPIO interrupts.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-10-24 13:19:04 -04:00
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