Commit graph

2,776 commits

Author SHA1 Message Date
Muhammad Waleed Badar
9d0a229461 drivers: sensor: add adxl345 range attribute setter
Add adxl345_attr_set_range() to allow runtime config.
of the accelerometer's measurement range via the
SENSOR_ATTR_FULL_SCALE attribute.

The function maps the requested range to the nearest supported
ADXL345 range (±2g, ±4g, ±8g, or ±16g) and updates the device
configuration accordingly.

Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
2026-01-01 21:26:42 +01:00
Zhaoxiang Jin
ab23a9f012 drivers: sensor: nxp: Add NXP tempsense driver
Add a new driver for the NXP TempSense temperature
sensor found in various NXP MCUs, such as the MCX
family. The driver reads temperature data from the
TempSense peripheral and provides it via the Zephyr
sensor API.

The TempSense peripheral details can be found in the
NXP MCXE31x reference manual chapter 78.
reference manual can be found at:
https://www.nxp.com/webapp/Download?colCode=MCXE31XRM

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2025-12-31 10:58:50 +00:00
Zhaoxiang Jin
f85158fea5 drivers: sensor: mark mcux_lpcmp as deprecated
We are planning to implement a new lpcmp driver based on the
comparator API and deprecate the current sensor-based driver.
We now mark the mcux_lpcmp as deprecated.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2025-12-23 09:32:53 +01:00
Zhaoxiang Jin
7371e94ec7 dts: bindings: rename nxp,lpcmp.yaml to nxp,sensor-lpcmp.yaml
We are planning to implement a new LPCMP driver based on the
comparator API and deprecate the current sensor-based driver.
We would like to use the nxp,lpcmp binding for the new
comparator-based driver implementation. To avoid naming conflicts,
we are renaming the current sensor binding to nxp,sensor-lpcmp.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2025-12-23 09:32:53 +01:00
Sylvio Alves
f8d2e00a0e includes: remove duplicated entries in zephyr-tree
Remove duplicated #include directives within the same
preprocessor scope across the Zephyr tree.

Duplicates inside different #ifdef branches are preserved
as they may be intentional.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-12-17 13:57:38 -05:00
Robert Perkel
7f3567cf74 drivers: sensor: mtch9010 Fixed heartbeat bugs
Fixed the following bugs with the heartbeat monitor
- State did not update on CHAN_ALL
- Adjusted semaphore behavior
- Fixed interrupt setup
- Fixed time calculation bug
- Split heartbeat update into seperate function call

Signed-off-by: Robert Perkel <robert.perkel@microchip.com>
2025-12-17 10:56:19 +02:00
Liang Jiaxiang
aca5f0c021 drivers: sensor: bmi08x: fix temperature reading and scaling
The previous implementation had three issues regarding temperature
reading:
1. The unit scaling was incorrect. The datasheet specifies 0.125 C/LSB,
   but the code multiplied by 125 instead of 125000 for micro-degrees,
   resulting in values off by a factor of 1000.
2. The MSB and LSB registers were read in two separate transactions,
   which is not atomic.
3. The bitwise reconstruction of the 11-bit value was inefficient.

This commit fixes the scaling factor to 125000, implements a burst read
for both temperature registers to ensure atomicity, and optimizes the
bit manipulation logic.

Signed-off-by: Liang Jiaxiang <moonbite233@gmail.com>
2025-12-17 10:54:24 +02:00
Luis Ubieda
217f8e660b sensor: afbr_s50: Do not cut data-stream due to payload status
The payload status is evaluated when decoding, which may indicate sharp
distance transitions (from very long to close) and requiring a few more
cycles to stabilize. We don't want to stop the data-stream because of
these, otherwise the data-stream continuity is compromised.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-12-17 10:53:14 +02:00
Mark Rages
37fc90cd1d drivers: sensor: adxl367: fix temperature scaling
The fractional part of the value was getting set incorrectly in
adxl_temp_convert().

Signed-off-by: Mark Rages <markrages@gmail.com>
2025-12-16 10:11:19 +01:00
Trond F. Christiansen
049d368524 sensor: bmm350: Fix I2C register write to use single transaction
The bmm350_prep_reg_write_rtio_async() function was incorrectly using two
separate SQEs for register writes, creating two distinct I2C transactions:
Before: [START][ADDR+W][REG][RESTART] + [START][ADDR+W][DATA][STOP]

Change to use a single SQE for the entire write:
After: [START][ADDR+W][REG][DATA][STOP]

Signed-off-by: Trond F. Christiansen <trond.christiansen@nordicsemi.no>
2025-12-15 17:09:32 +00:00
Marek Maškarinec
5741f3ee6b drivers: tmag5273: Add mag gain property
Adds mag-gain-correction DT property, which sets the magnetic gain
correction value. Previously a property to select the channel for gain
correction existed, but there was no way to configure the correction
value itself.

Signed-off-by: Marek Maškarinec <marek.maskarinec@hardwario.com>
2025-12-12 09:58:56 -05:00
Stefan Schmidt
13ce8eac99 drivers: sensor: adi: adxl345: use selected range for conversion
When running the samples/sensor/accel_trig sample with a adxl345 sensor
the logged output values were doubled compared to the expected values.

The sensor_channel_get() path calls adxl345_accel_convert which did not
handle the configured g-range, resulting in invalid sample values except
for the +/-16g range. To fix this issue the configured range is taken
into account and different conversion factors are applied.

adxl345_accel_convert is also made static. It is not used by another file.

Signed-off-by: Stefan Schmidt <kontakt@stefanschmidt-embedded.de>
2025-12-11 17:05:27 +01:00
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