Commit graph

2428 commits

Author SHA1 Message Date
Nathan Olff
b88a27a3e8 drivers: sensor: adi: add ad2s1210 resolver support
implement driver for ad2s1210 resolver

Signed-off-by: Nathan Olff <nathan@kickmaker.net>
2025-05-27 23:43:56 +02:00
Magpie Embedded
74ef345dc1 drivers: sensor: Add sensor driver for BH1790
This commit adds a driver for the BH1790 Heart Rate Monitor IC.

Based on the approach used by the MAX30101 driver, an existing optical
heart rate sensor with a sample in Zephyr.

Signed-off-by: Magpie Embedded <magpieembedded@gmail.com>
2025-05-27 23:43:43 +02:00
Yau-ming Leung
6dff8dc639 drivers: icm42688: fix accel and gyro frequency in period calculation
When calculating accel and gyro period for 12.5Hz, the frequency value is
incorrect. Updated to correct value.

Signed-off-by: Yau-ming Leung <ymleung314@gmail.com>
2025-05-22 11:31:41 +02:00
Yau-ming Leung
39923e3e19 drivers: icm42688: pin9 function
PIN9 of an ICM42688 can be configured as an interrupt output, external
clock input or frame sync output. Pin function can now be set via a sensor
attribute.

Signed-off-by: Yau-ming Leung <ymleung314@gmail.com>
2025-05-22 11:31:41 +02:00
Peter van der Perk
49e33d38c1 drivers: sensor: qdec_tpm: Add QDEC support for NXP TPM
Allows to run the NXP Timer/PWM Module (TPM) in Quadrature
Decoder Mode.

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2025-05-22 02:21:39 +02:00
Tobias Meyer
713fc17a26 drivers: stts22h: Add attr_lower/high_tresh
Add threshold attribute handling to set low and high
temperature at runtime and validation for runtime changes

Signed-off-by: Tobias Meyer <tobiuhg@gmail.com>
2025-05-21 19:56:38 +02:00
Yau-ming Leung
d95ca654cc drivers: icm42688: fix FIFO HIRES packet gyro scale
The original scale value used to convert raw gyro value to q31 format is
incorrect. Updated to the correct value.

Signed-off-by: Yau-ming Leung <ymleung314@gmail.com>
2025-05-20 15:24:39 +02:00
Maureen Helm
77f7b1feb1 drivers: sensor: adi: Set adxl345 thread name
Sets the adxl345 driver thread name for easier debugging.

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2025-05-20 15:23:51 +02:00
Luis Ubieda
75fda15b8c sensor: adxl345: Set FIFO to bypass mode when DRDY is enabled
In order to prevent not serving all events that would clear the
interrupt line. This patch also removes FIFO servicing through
fetch/get APIs, as this is only exposed through streaming mode.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-05-20 15:23:51 +02:00
Hank Wang
5379f4a16b drivers: sensor: tmp1075: add support for fractional threshold values
Previously, the TMP1075 driver only used the integer part (val1) of the
sensor_value when setting TLOW and THIGH thresholds. This limited the
precision of temperature threshold configuration and could be insufficient
in applications requiring fine-grained control.

This patch adds proper handling for the fractional part (val2) by encoding
it into bits [7:4] of the 12-bit temperature register according to the
TMP1075 datasheet. The decoding logic in get_threshold_attribute() is also
updated to recover the fractional value accurately.

Signed-off-by: Hank Wang <wanghanchi2000@gmail.com>
2025-05-19 21:54:45 +02:00
Sergei Ovchinnikov
1ef29d5218 dts: bindings: npm1300-charger: make vbus-limit-microamp required
Make the vbus-limit-microamp property of npm1300-charger required and
change its range to reflect the one actually supported by the device.

Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>
2025-05-19 16:35:55 +02:00
Anas Nashif
2aacbcaab5 style: add missing curly braces in if/while/for statements.
Add missing curly braces in if/while/for statements.

This is a style guideline we have that was not enforced in CI. All
issues fixed here were detected by sonarqube SCA.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-05-17 14:10:33 +02:00
Wajdi ELMuhtadi
6353ba88b6 drivers: sensor: wsen_itds_2533020201601: add sensor driver
Add wsen_itds_2533020201601 driver with
the corrected name and compatibility with
the hal update as well as added new features.

Signed-off-by: Wajdi ELMuhtadi <wajdi.elmuhtadi@we-online.com>
2025-05-16 22:56:06 +02:00
Luis Ubieda
a13be2f320 sensor: rm3100: Add streaming mode
Compatible trigger: DRDY.

Tested with Sensor Shell commands.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-05-16 21:36:23 +02:00
Luis Ubieda
4dfe251986 sensor: rm3100: Add ODR build-time setting through DTS property
Using pre-defined values displayed on datasheet's table 5-4 for
CMM Update Rates.

Please note that datasheet specifies these Update-Rates may have
up to 7% standard deviation, which may be significant for certain
applications.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-05-16 21:36:23 +02:00
Luis Ubieda
c1f3e2c712 sensor: rm3100: Basic functionality
This patch introduces rm3100 magnetometer sensor, with basic
support (only read-decode).

This driver has bus support for I2C.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-05-16 21:36:23 +02:00
Luis Ubieda
8e0e99b9dd sensor: adxl345: Formatting improvements on macrobatics
No functional changes, only formatting changes.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-05-16 09:37:28 +02:00
Luis Ubieda
9a044aaacb sensor: adxl345: Optimize RTIO SQE/CQE pool based on fifo-watermark
Since it's directly related (we can't just burst-read the fifo at
once). This patch includes a comment block explaining this rationale.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-05-16 09:37:28 +02:00
Luis Ubieda
36917d4809 sensor: adxl345: Allow fifo-watermark configurable through dts
Allow for users to define the fifo-watermark on a per-instance basis
through device-tree properties. This setting is validated at build
time, so missing it when required, or setting an invalid value should
not end up in a run-time errror (as in: it runs but nothing happens).

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-05-16 09:37:28 +02:00
Luis Ubieda
4243ad20ca sensor: adxl345: rename ADXL345_ODR_12HZ to ADXL345_ODR_12_5HZ
To better reflect the actual ODR setting.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-05-16 09:37:28 +02:00
Luis Ubieda
f8416de09e sensor: adxl345: fix: Overriding of ODR setting in DTS property
This patch fixes previous overriding of ODR setting through DTS (it
would always be 25-Hz, irrespective of what the DTS property said).

While doing so, create dt-binding enum to improve settings clarity.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-05-16 09:37:28 +02:00
Luis Ubieda
5e1a2fcf31 sensor: adxl345: Prevent clearing SQE flags set while prepping SQEs
SQE flags are adjusted when preparing write/read ops, therefore an OR
operation is required.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-05-16 09:37:28 +02:00
Luis Ubieda
ce2d16be01 sensor: adxl345: Fix conditional instantiation of RTIO ctx and IODEV
With actual parameter to determine whether the driver requires it:
Streaming mode enabled.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-05-16 09:37:28 +02:00
Jeppe Odgaard
46a3bbb35a drivers: sensor: ti: tmp11x: fix get ambient offset
The sensor value was accidentally set a second time.

Refactor `tmp11x_attr_get` to fix the issue and align more with
`tmp11x_attr_set`.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-05-14 11:04:08 +01:00
Yau-ming Leung
b8f94cade5 drivers: icm42688: move misleading debug message
When SENSOR_TRIG_FIFO_WATERMARK or SENSOR_TRIG_FIFO_FULL is not configured,
an unsupported trigger debug message will be printed. Moved such that
a no trigger configured debug message will be printed only if both triggers
are not configured.

Signed-off-by: Yau-ming Leung <ymleung314@gmail.com>
2025-05-13 22:20:42 -04:00
Srishtik Bhandarkar
09ab462e10 drivers: sensor: pzem004t: add pzem004t AC parameter sensor driver
Adds driver for Peacefair pzem004t multifunction AC parameter sensor.

Signed-off-by: Srishtik Bhandarkar <srishtik.bhandarkar2000@gmail.com>
2025-05-12 21:09:27 +02:00
Konrad Sikora
8959d2857d drivers: sensor: Fixed issues in DHT20 measurement
Refactor DHT20 sensor init and measurement handling.
Added 100ms power-on wait to comply with datasheet.
Simplified measurement frame handling.
Initialize status register only once after power-on.

Signed-off-by: Konrad Sikora <kontakt@konradsikora.pl>
2025-05-12 21:09:22 +02:00
Liang Jiaxiang
b2c6d960cb sensor: bmi08x: Fix variable name in bmi08x_acc_trigger_mode_init
Fix undeclared variable error by changing 'config' to 'cfg' in the
data_sync condition check, matching the variable name declared at the
beginning of the function.

Signed-off-by: Liang Jiaxiang <moonbite233@gmail.com>
2025-05-09 21:09:04 +02:00
Pisit Sawangvonganan
77bb19c2a9 drivers: sensor: shell_battery: use shell_print where applicable
To improve code clarity, use `shell_print` in place of `shell_fprintf`
with `SHELL_NORMAL` where appropriate.
For partial-line outputs, use `shell_fprintf_normal` to preserve output
formatting.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-05-07 17:45:39 +02:00
Pisit Sawangvonganan
f74d2a79de drivers: sensor: shell: make channel and attribute name tables as const
Make `sensor_channel_name` and `sensor_attribute_name arrays` to use
`const char *const`. This ensures full immutability of the tables,
placing them entirely in the `.rodata` section and reducing usage
of the `.data` segment.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-05-07 17:45:39 +02:00
Pisit Sawangvonganan
6014ff392a drivers: sensor: shell: align struct shell * name to sh
Aligned the `struct shell *` argument name from `shell_ptr` to `sh`
for consistency with other drivers' usage of `sh`, and to match
the `shell_cmd_handler` argument name.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-05-07 17:45:39 +02:00
Pisit Sawangvonganan
e02e532272 drivers: sensor: shell_stream: align struct shell * name to sh
Aligned the `struct shell *` argument name from `shell_ptr` to `sh`
for consistency with other drivers' usage of `sh`, and to match
the `shell_cmd_handler` argument name.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-05-07 17:45:39 +02:00
David Schneider
9455b412d2 drivers: sensor: maxim,ds3231: fix config dependency
Make the config which is specific for DS3231 depend on
the driver for it being enabled.

Signed-off-by: David Schneider <schneidav81@gmail.com>
2025-05-07 11:45:32 +02:00
Yau-ming Leung
6b3d53e4ec drivers: icm42688: ignore invalid fifo data
When using 20-bit FIFO packets, invalid data is indicated by the value
-524288. Currently, no check is done against this and invalid data is
decoded. Fixed by adding a simple check. Also, the wrong bit is used to
check if HIRES is enabled. Fixed by using the correct mask.

Signed-off-by: Yau-ming Leung <ymleung314@gmail.com>
2025-05-06 16:36:16 +02:00
Yau-ming Leung
bd0a0011ab drivers: icm42688: fix missing compile time log level
The icm42688 driver RTIO stream module does not specify a compile time log
level. Thus, CONFIG_SENSOR_LOG_LEVEL_DBG is ignored. Fixed by specifying
log level on log module declaration.

Signed-off-by: Yau-ming Leung <ymleung314@gmail.com>
2025-05-02 16:09:23 +01:00
Jeppe Odgaard
c3a9fb1c63 driver: sensor: tmp11x: support get offset
Allow reading the offset register.

This allows reading the offset before setting it if offset is set more than
once.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-05-02 09:15:33 +02:00
Armando Visconti
4c34b5d725 drivers/sensor: lis2dux12: add high performance mode
Add driver capability to properly set high performance mode
while setting data rate (thru lis2duxxx_mode_set() API)
based on how power-mode is set into DTS: if it is set to
LIS2DUX12_OPER_MODE_HIGH_PERFORMANCE then configure HP mode,
LP/ULP mode otherwise.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2025-05-01 18:17:05 +02:00
Thomas Lang
1a8b8f4220 drivers: sensor: Added timeout for apds9960 sampling
Timeout occurs if status register does not register an interrupt

Signed-off-by: Thomas Lang <thomaslang2003@me.com>
2025-05-01 18:16:05 +02:00
Thomas Lang
f38beeafba drivers: sensor: Make apds9960 polling wait
sensor_fetch for apds9960 will now block until a valid sample is ready

Signed-off-by: Thomas Lang <thomaslang2003@me.com>
2025-05-01 18:16:05 +02:00
Thomas Lang
999b8f85c6 drivers: sensor: Removed apds9960 interrupt pin
Made interrupt pin on apds9960 optional

Signed-off-by: Thomas Lang <thomaslang2003@me.com>
2025-05-01 18:16:05 +02:00
Jordan Yates
f4825033bc sensor: remove PM state checks from API functions
Calling sensor API functions on devices not in `PM_DEVICE_STATE_ACTIVE`
is a violation of the PM API. Adding manual checks inside of drivers
complicates the drivers and increases ROM footprint for no additional
benefit.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-05-01 18:15:42 +02:00
Jeppe Odgaard
96f51bf797 drivers: sensor: explorir_m: fix maybe-uninitialized
Fix maybe-uninitialized warning by initializing `restore-rc`.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-04-30 23:03:26 +02:00
Armando Visconti
a5d3612ef3 modules/hal_st: Align to stmemsc HAL i/f v2.9.1
Align all sensor drivers that are using stmemsc (STdC) HAL i/f
to new APIs of stmemsc v2.9.1.

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

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2025-04-30 16:26:53 +02:00
Jordan Yates
be919675f9 sensor: npm1300_charger: uA resolution current
Update the conversion functions for the charge/discharge current to
be uA resolution.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-29 19:07:04 +02:00
Jordan Yates
4748fb37c3 sensor: npm1300_charger: correct current direction
Update the direction of the measured current to match that expected by
the API and existing users, positive = charging and negative =
discharging.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-29 19:07:04 +02:00
Jordan Yates
aacbd6607c sensor: npm1300_charger: use logf not log
Both the input and output parameters are floats, not doubles, so use
the floating point logarithm variant.

Correct the source of the equations for the latest datasheet versions
at the same time.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-29 19:07:04 +02:00
Jordan Yates
5fccbcb95e sensor: npm1300_charger: use common conversion funcs
Use the standard sensor value conversion helpers for constructing
`struct sensor_value` outputs.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-29 19:07:04 +02:00
Vladislav Pejic
e72e1c1c44 drivers: sensor: adxl372: FIFO mode from DT
Adds support for setting FIFO mode and water-mark from DT.

Signed-off-by: Vladislav Pejic <vladislav.pejic@orioninc.com>
2025-04-28 12:55:18 -05:00
Vladislav Pejic
4a9029771f drivers: sensor: adxl367: FIFO mode from DT
Add support for setting FIFO mode using DT property.

Signed-off-by: Vladislav Pejic <vladislav.pejic@orioninc.com>
2025-04-28 08:34:35 +02:00
Vladislav Pejic
5fc5259964 drivers: sensor: adxl362: FIFO mode from DT
Adds support for setting FIFO mode from DT.

Signed-off-by: Vladislav Pejic <vladislav.pejic@orioninc.com>
2025-04-26 10:55:34 +02:00