Commit graph

2428 commits

Author SHA1 Message Date
Talha Can Havadar
4ce0555d90 drivers: bmp581: Add BMP581 driver
This commit adds source and header files required for bmp581 I2C driver.
I have used bmp581_user.h to add more usage related definitions
but bmp581.h to add hardware related definitions.

Signed-off-by: Talha Can Havadar <havadartalha@gmail.com>
Signed-off-by: Gerhard Jörges <joerges@metratec.com>
2024-01-24 09:32:34 -05:00
Mike J. Chen
e56c89eb0c sensor_shell: add CONFIG to support trigger for more than one sensor device
Before, only one sensor device was supported. It
was possible to set a trigger on a second sensor
device, but the filtering of the channel data
would cause no channels from the new sensor
device to be read.

Also in trigger handler log of sampled data, print
the sensor name and channe name (instead of channel
number).

Signed-off-by: Mike J. Chen <mjchen@google.com>
2024-01-19 13:51:48 +01:00
Balthazar Deliers
bea34c599d drivers: sensor: Aosong AGS10 TVOC sensor
Added support for Aosong AGS10 TVOC sensor

Signed-off-by: Balthazar Deliers <bdeliers@bdeliers.com>
2024-01-19 06:06:02 -06:00
Armin Brauns
2b2e6bad36 drivers: allow changing max31865 three-wire mode at runtime
Instead of only through static devicetree config at boot.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2024-01-17 13:01:24 -05:00
Yuval Peress
9381e86cbe bmi160: fix value calculation
As an example, when the gyro range is set to 250 deg/sec the scale
was set to 133 where it really should be 133.160058662. This leads
to a 0.12% error in the value returned. By separating the numerator
and denominator, we're able to drastically reduce the error.

Signed-off-by: Yuval Peress <peress@google.com>
2024-01-16 10:01:00 +01:00
Yuval Peress
c743e72756 bmi160: Fix gyro range map
The range map was sorted wrong since the function
bmi160_range_to_reg_val() that uses it checks for the user value less
than the range component of the bmi160_range struct. This means that
no matter what range is set, the value will always end up 2000dps.

Signed-off-by: Yuval Peress <peress@google.com>
2024-01-16 10:01:00 +01:00
Yuval Peress
b58b03196b bus: emul: Update i2c/spi emulators with mock transport
Adding a hook for tests to inject a mock transport and migrating the
accel test to test bmi160 specific things. The old version of the test
which checks for read values is now covered by the generic test in
the sensor build_all target.

Signed-off-by: Yuval Peress <peress@google.com>
2024-01-16 10:01:00 +01:00
Yuval Peress
fd07f8ce69 bmi160: Implement attr_get
Add support for getting the following attribute values:
- SENSOR_ATTR_OFFSET
- SENSOR_ATTR_SAMPLING_FREQUENCY
- SENSOR_ATTR_FULL_SCALE

Signed-off-by: Yuval Peress <peress@google.com>
2024-01-16 10:01:00 +01:00
Yuval Peress
9898b2fc3f bmi160: Make changes to align driver to datasheet
The logic in the driver was not aligned to the datasheet. Also,
temperature reading was not being done in fetch, but in channel_get.
There was also some extra conversions from SI->register->SI when
setting the range, this was causing the register value calculation to
produce an incorrect scale in some cases.

Tests were added to cover these cases.

Signed-off-by: Yuval Peress <peress@google.com>
2024-01-16 10:01:00 +01:00
Yuval Peress
be563239c8 sensor: testing: Update sensor emul backend
Update the backend for sensor emulators to include a function for
setting the offset as well as a function to query an attribute's
metadata such as bounds and increment size. Additionally, add
backend support for setting the _xyz channel values.

Make the appropriate test changes to accomodate.

Signed-off-by: Yuval Peress <peress@google.com>
2024-01-16 10:01:00 +01:00
Yuval Peress
9f096e9816 bma4xx: Optimize calculation
Reduce some of the arithmetic required to decode a sample. Math is
documented in bma4xx_convert_raw_accel_to_q31.

This improved the accuracy from roughly 0.865mm/s2 to 0.001mm/s2 when
stationary and using a range of 4g.

Signed-off-by: Yuval Peress <peress@google.com>
2024-01-15 15:41:58 -06:00
Xuyang Shen
6f6fc4e25c drivers: sensors: icm42688: fix bug in Kconfigfile
Fix Bug in Kconfig file of icm42688 driver

Signed-off-by: Xuyang Shen <shenyi97@hotmail.com>
2024-01-15 10:22:38 -06:00
Nick Ward
e9b56bd1ec drivers: sensor: bq274xx: remove float use
Remove float usage in calculation of
SENSOR_CHAN_GAUGE_TEMP

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2024-01-12 09:00:33 -06:00
Armando Visconti
765519ea92 drivers/sensor: fix some ST drivers dependency to HAL_ST module
In order to avoid build failures as described in issue #67242,
make all ST drivers using HAL_ST module dependent to HAL_STMEMSC
and HAS_STLIB libs, which need to be configured in all samples
referring to them.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2024-01-12 12:55:46 +01:00
Tristan Honscheid
0f95b6fbb0 sensors: Add Bosch BMA4xx-series driver
This is a driver targetting the Bosch BMA 4-series accelerometers. It
has been specifically developed for the BMA422 but should be compatible
with others in that line, excepting the BMA400. Supports key attributes
and async RTIO one-shot operation. I2C operation is supported, with
stubs for a SPI implementation provided for future improvement.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2024-01-11 09:58:29 -06:00
Brian Juel Folkmann
06b57926a2 drivers: adc: stm32: Fix race condition with internal channels
When using one of the internal channels (die_temp, vbat, vref) the
channels are enabled in the individual drivers and disabled again
whenever an adc conversion is complete.

This creates a race condition if the ADC is used from multiple threads.

This commit moves the disabling of the channels to the individual
drivers.

Signed-off-by: Brian Juel Folkmann <bju@trackunit.com>
2024-01-11 13:53:17 +01:00
Yuval Peress
5edc45421a icm42688: Capture the spi return value
Handle the return value of the spi transaction.

Fixes #58582

Signed-off-by: Yuval Peress <peress@google.com>
2024-01-08 15:09:42 +01:00
Yuval Peress
3f2d6efc9c icm42688: Remove unnecessary locks
The entire switch statement is already wrapped in a lock which is
acquired just before configuring the gpio pin.

Signed-off-by: Yuval Peress <peress@google.com>
2024-01-08 15:09:42 +01:00
Armando Visconti
1badec4bfd drivers/sensor: add support to LIS2DU12 accelerometer
The LIS2DU12 is a linear 3-axis accelerometer with advanced digital
functions whose MEMS and ASIC have been expressly designed to build
an outstanding ultralow-power architecture in which the anti-aliasing
filter operates with a current consumption among the lowest in the
market.
This driver is based on stmemsc HAL i/f v2.3

https://www.st.com/en/datasheet/lis2du12.pdf

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-12-14 09:28:52 +01:00
Armando Visconti
858007dc93 drivers/sensor: add Kconfig.trigger_template
Add Kconfig.trigger_template to allow an extensive re-use of
trigger configuration inside all sensor drivers.

This template must be included as in the following example:

    module = LSM6DSO
    thread_priority = 10
    thread_stack_size = 1024
    source "drivers/sensor/Kconfig.trigger_template"

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-12-14 09:28:52 +01:00
Armando Visconti
72620baefe tests: drivers: build_all: add die_temp test case
Add test case for all drivers that are supporting the die temperature
feature, and fix right away all the yet undiscovered issues.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-12-13 09:42:23 +01:00
Maxmillion McLaughlin
8ab1c75e9b feat: add support for TDK NTCG103JF103FT1 thermistor
Adds compensation table and bindings for NTCG103JF103FT1 thermistor

Signed-off-by: Maxmillion McLaughlin <github@maxmclau.com>
2023-12-08 10:04:12 +00:00
Nikos Agianniotis
ed610400bc drivers: sensor: mcp9600: fix wrong register address
The address of most of the registers defined in
the driver are wrong. This fixes it, following
the correct numbering as can be found in the
device's datasheet. Moreover, re-grouping of
the macros according to their functionality.

Signed-off-by: Nikos Agianniotis <na@neq.dk>
2023-12-07 10:42:03 +00:00
Alberto Escolar Piedras
94b16c4d2d drivers/sensor Kconfig: Replace native_posix with native_sim
Use native_sim in the help messages platforms examples
instead of native_posix.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-12-07 10:39:31 +00:00
Sumit Batra
e0dc6f4fe4 drivers: sensor: qdec_s32: Add QDEC support for S32
Add code to configure and program Lcu, Trgmux and Emios_Icu IPs to
get the the rotations by the motor in radians.

Co-authored-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
Co-authored-by: Peter van der Perk <peter.vanderperk@nxp.com>
Co-authored-by: Mayank Mahajan <mayankmahajan.x@nxp.com>
Signed-off-by: Sumit Batra <sumit.batra@nxp.com>
2023-12-06 20:06:37 -06:00
Mike Voytovich
3c2a896796 drivers: sensor: lsm6dsv16x: fix gyro range
The range and sensitivity tables don't match the datasheet
or the DTS binding file.  This changes the array lookup tables
to match the datasheet and binding file.

Signed-off-by: Mike Voytovich <mike@rokkresearch.com>
2023-12-04 13:16:38 -06:00
Benjamin Björnsson
8c0b3ca2fd sensor: adltc2990: add missing return value checks
This commit adds two missing return value checks for
i2c reads.

Fixes #65328

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-12-04 14:34:42 +01:00
Benjamin Björnsson
773257dda4 sensor: adltc2990: separate function return values
This commit reworks the adltc2990_fetch_property_value function
to pass its result through a variable pointer instead of direct return.
This is done in part to separate the errno value being return in the
default case of the switch from the result of the function, but also
to make it easier the fix a Coverity issue regarding the unhandled
return values of i2c reads.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-12-04 14:34:42 +01:00
Benjamin Björnsson
ef871058aa sensor: tsl2540: add missing return value check
This commit adds missing return value checks in driver initialization.

Fixes #65345

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-12-04 14:34:42 +01:00
Benjamin Björnsson
445b43d407 sensor: tsl2540: add missing return value check
This commit adds a missing return value check. Since the I2C write
failed we release the semaphore and returning immediatly instead of
using goto exit.

Fixes #65352

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-12-04 14:34:42 +01:00
Benjamin Björnsson
dc257830a5 sensor: adltc29990: add missing return value check
This commit adds a missing return value check for a register read.
The affected function was updated to use the regular errno return value
and to pass the result through a pointer instead.

Fixes #65346

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-12-04 14:34:42 +01:00
Benjamin Björnsson
0cec0dc749 sensor: max17055: add missing return value check
This commit adds a missing return value check during register read.
Added an imidiate return to remove the seemingly unwanted side
effect of also waiting for the bus read to work.

Fixes #65374

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-12-04 14:34:42 +01:00
Benjamin Björnsson
9781d13f19 sensor: max17055: add missing return value check
This commit adds a missing return value check during register read.
Added an imidiate return to remove the seemingly unwanted side
effect of also waiting for the bus read to work.

Fixes #65383

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-12-04 14:34:42 +01:00
Jonas Remmert
7a2fcc419e drivers/sensor: add support to LPS28DFW pressure sensor
The LPS28DFW is an ultracompact, piezoresistive, absolute pressure sensor.
Compared to the LPS22DF, the LPS28DFW is waterproof and has a Dual FS
capability and does not have SPI. This commit extends the LPS22DF driver to
be compatible with the LPS28DFW device.

Signed-off-by: Jonas Remmert <j.remmert@phytec.de>
2023-12-01 12:19:05 -06:00
Wojciech Slenska
fdc1cbf833 drivers: sensor: bmi323 interrupt fix
Interupts should be enabled after int line configuration in bmi.
When the device goes to a suspended state interrupts must be disabled.

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2023-12-01 08:39:53 -06:00
Andrei Emeltchenko
db1c21bfd7 drivers: sensor: adxl367: Add missing breaks
Fix missing breaks errors.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-11-27 12:21:42 +00:00
Armando Visconti
88d91fb82f drivers/sensor: lsm6dsv16x: fix DT configuration read for int1/int2
Since lsm6dsv16x may be multi-instantiated, triggers must be enabled
and configured on DT basis and not only thru CONFIG_LSM6DSV16X_TRIGGER
macro; if either int1-gpios of int2-gpios (or both) are configured
in DT, the flag trig_enable is set to 'true' for that instance.
The previous implentation was lacking the check of those two Device
Tree properties, so trig_enabled was always true for all instances.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-11-24 09:23:47 +01:00
Fabio Baltieri
d9fd752392 sensor: mchp_tach_xec: drop PM_DEVICE guards
These are not needed and are now causing build errors since the
pm_device calls are always there and need the header to become a no-op.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-22 21:54:45 +00:00
Fabio Baltieri
939b90be4c drivers: drop few redundant guard around pm_policy_state_lock_*
The pm_policy_state_lock_put and pm_policy_state_lock_put functions
already become a no-op if CONFIG_PM is not enabled. Drop the guards
around it in few different drivers.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-11-22 18:34:36 +00:00
Andrei Emeltchenko
98f33a76d6 drivers: tsl2561: Fix type
Use int as correct type, fixes also warning comparing uint8_t < 0.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-11-22 09:54:39 +01:00
Armando Visconti
2fe89c1076 dt-bindings: sensor: lis2ds12: add macros for DT properties setting
Add macros for setting in a clear way lis2ds12 DT properties.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-11-20 09:24:37 +01:00
Henrik Brix Andersen
c0c8952739 shell: do not enable subsystem/driver shell modules by default
Do not enable subsystem/driver shell modules by default and stop abusing
CONFIG_SHELL_MINIMAL, which is internal to the shell subsystem, to decide
when to enable a driver shell.

The list of shell modules has grown considerably through the
years. Enabling CONFIG_SHELL for doing e.g. an interactive debug session
leads to a large number of shell modules also being enabled unless
explicitly disabled, which again leads to non-negligible increases in
RAM/ROM usage.

This commit attempts to establish a policy of subsystem/driver shell
modules being disabled by default, requiring the user/application to
explicitly enable only those needed.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-11-20 09:21:40 +01:00
Natalia Pluta
8b2c5120aa drivers: sensor: qdec_nrfx: Add support for new QDEC instances
Introducing support for new QDEC instances in the driver.

Signed-off-by: Natalia Pluta <natalia.pluta@nordicsemi.no>
2023-11-20 09:19:45 +01:00
Ian Morris
4c92419546 drivers: sensor: hs300x: Add driver for Renesas HS300x sensors
Adds support for Renesas HS3001 and HS3003 temperature/humidity sensors
connected via an I2C bus.

Signed-off-by: Ian Morris <ian.d.morris@outlook.com>
2023-11-17 10:33:02 -06:00
Krzysztof Chruściński
3bb4cd813a drivers: sensor: a01nyub: Add dependency to UART runtime configuration
Force enabling of the UART runtime configuration for A01NYUB.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-11-15 10:02:18 +01:00
Jeppe Odgaard
b0fdbce4df drivers: sensors: add explorir_m co2 sensor
Add driver for Gas Sensing Solutions' ExplorIR-M CO2 sensor.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-11-13 12:14:08 -05:00
Antoniu Miclaus
774bf6b50e drivers: sensor: adxl367: update self test delay
The wait times in the self test procedure, according to the datasheet
are 4 / ODR (current set value).

Update the self test procedure by using the delay corresponding to the
current ODR value that is set, instead of default ODR.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
2023-11-13 12:13:37 -05:00
Antoniu Miclaus
b654b61699 drivers: sensor: adxl372: remove unused function
After the merge of 9dda350 the `adxl327_reg_write_mask` function is no
longer used.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
2023-11-13 12:12:43 -05:00
Armando Visconti
f1f7e4712c drivers/sensor: add support to LPS22DF pressure sensor
The LPS22DF is an ultracompact, piezoresistive, absolute pressure sensor
that functions as a digital output barometer. The LPS22DF provides lower
power consumption, achieving lower pressure noise than its predecessor.
This driver is based on stmemsc HAL i/f v2.3

https://www.st.com/en/datasheet/lps22df.pdf

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-11-13 16:08:46 +00:00
Antoniu Miclaus
a2ad2d71f6 drivers: sensor: adxl372: fix define comment
Replace unrelated part name with the actual driver name in the
adxl372.h header file.

Fixes: a3e7cea ("adxl372: Add driver for ADXL372 high-g accelerometer")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
2023-11-13 16:59:23 +01:00