Commit graph

2428 commits

Author SHA1 Message Date
Wajdi ELMuhtadi
8c0b09ddc3 drivers: sensor: wsen_pads: remove wsen_pads driver
Remove wsen_pads since the hal update
is no longer compatible with this version.

Signed-off-by: Wajdi ELMuhtadi <wajdi.elmuhtadi@we-online.com>
2024-10-11 13:15:10 -04:00
Wajdi ELMuhtadi
449bf8019c drivers: sensor: wsen_hids: remove wsen_hids driver
Remove wsen_hids since the hal update
is no longer compatible with this version.

Signed-off-by: Wajdi ELMuhtadi <wajdi.elmuhtadi@we-online.com>
2024-10-11 13:15:10 -04:00
Wajdi ELMuhtadi
5f584052d8 drivers: sensor: wsen_itds: remove wsen_itds driver
Remove wsen_itds driver since the hal update
is no longer compatible with this version.

Signed-off-by: Wajdi ELMuhtadi <wajdi.elmuhtadi@we-online.com>
2024-10-11 13:15:10 -04:00
Bjarki Arge Andreasen
4e55597527 drivers: sensor: mcux_acmp: update dts binding and adapt driver
Update the devicetree binding for the nxp,kinetis-acmp comparator and
move the binding to dts/bindings/comparator.

The update to the binding includes:
- Remove unused io-channel-cells property
- Remove unused sensor-device include
- Adding missing properties dac config, discrete mode config, and
  input configs.
- Rename properties to exclude redundant vendor prefix since props in
  this binding are not inhereted, and as such, don't need to be
  namespaced.
- Deprecate the old names of the renamed properties

The sensor based device driver has been updated to support both the
deprecated and new property names. This allows it to use both
nxp,enable-sample and filter-enable-sample for example.

Additionally, remove the unused io-channel-cells properties from
in-tree nodes of compatible = "nxp,kinetis-acmp"

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2024-10-10 20:24:52 -04:00
Bjarki Arge Andreasen
e0363f252d sensor: mcux_acmp: namespace driver and kconfigs
The mcux_acmp will get support by the comparator subsystem. To avoid
namespace clashes, namespace the driver, kconfigs and use the
MCUX_ACMP config solely to select the MCUX SDK driver.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2024-10-10 20:24:52 -04:00
Michał Stasiak
2e6c83dd4c drivers: sensor: qdec: fix QDEC overflow handling
QDEC sensor driver fails to inform user of the overflow in the
ACC register, which makes the most recently fetched data invalid.
An error code return has been added to nrfx_qdec_sample_fetch(),
that indicates that an overflow has occured, based on oveflow flag.
Also, raw_acc field was added in the qdec_nrfx_data structure, to
adjust QDEC to sensor API rules - two subsequent sensor_channel_get()
calls should will yield the same values.

Signed-off-by: Michał Stasiak <michal.stasiak@nordicsemi.no>
2024-10-10 15:01:20 -04:00
Han Wu
1726443d9d drivers: sensor: mpu9250: fix mismatched value in log message
The print message prints cfg->accel_fs when cfg->gyro_fs is too big.

Signed-off-by: Han Wu <wuhanstudio@qq.com>
2024-10-09 09:49:40 +02:00
Yong Cong Sin
52a202309b zephyr: bulk update to DT_NODE_HAS_STATUS_OKAY
Change instances of:

DT_NODE_HAS_STATUS(<node_id>, okay)

to

DT_NODE_HAS_STATUS_OKAY(<node_id>)

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-10-03 17:06:52 +01:00
Andrew Sonzogni
44d101acab drivers: sensor: lis2dw12: add interrupt status fetch
INT status can be fetched if the feature can't trigger via interrupt

Signed-off-by: Andrew Sonzogni <andrew@safehear.fr>
2024-10-03 11:41:51 +01:00
Andrew Sonzogni
70de35d9c9 drivers: sensor: lis2dw12: add inactivity detection
Add inactivity mode or stationary detection

Signed-off-by: Andrew Sonzogni <andrew@safehear.fr>
2024-10-03 11:41:51 +01:00
Andrew Sonzogni
c74dd3ee74 drivers: sensor: lis2dw12: add temp reading
adds support for reading temperature
Signed-off-by: Andrew Sonzogni <andrew@safehear.fr>
2024-10-03 11:41:51 +01:00
TOKITA Hiroshi
773d50e072 drivers: sensor: mc3419: Change the TRIGGER config to a typical
Because MC3419's TRIGGER's Kconfig was different from the typical
configuration, the `build_all` test settings were not correctly
applied.

The Kconfig configuration has been revised to be set in conjunction
with MC3419_TRIGGER_OWN_THREAD, even if MC3419_TRIGGER is not
explicitly specified.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2024-10-02 10:05:58 +02:00
Mathieu Choplain
5a0775b1ab dts: bindings: stm32-temp*: align 'avgslope' to datasheet format
Change the STM32 Temperature Sensor bindings to accept the average slope
value in string form instead of integer. With this change, it is possible
to use the raw decimal value found in each MCU's datasheet instead of
needing to scale it (differently depending on series!). This also allows
regrouping the property in a single file to reduce duplication.

Also update all DTSI files affected by this change and the dietemp driver
to accept the property's new format.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2024-10-02 10:03:03 +02:00
Mathieu Choplain
7f44ecb06a drivers: sensor: stm32_temp: update and comment conversion code
Update all the conversion code in the STM32 dietemp sensor driver to be
more readable and match the Reference Manuals. Additionally, comment all
the code to make it easy to understand.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2024-10-02 10:03:03 +02:00
Mathieu Choplain
dabcd605a8 drivers: sensor: stm32_temp: read calibration data in dedicated function
Move the reading of calibration data from manufacturing flash to a
dedicated function. This makes introduction of new STM32 series easier.

Additionally, use the sys_read16 primitive to read data instead of
manipulating and dereferencing raw manufacturing flash pointers.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2024-10-02 10:03:03 +02:00
Mathieu Choplain
2ef666a15c drivers: sensor: stm32_temp: make driver data field names closer to RM
Rename the fields of the STM32 dietemp sensor driver data structure to
match the names in Reference Manual more closely, and add documentation
comments to all of them.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2024-10-02 10:03:03 +02:00
Mathieu Choplain
70bf26b358 drivers: sensor: stm32_temp: convert samples in dedicated function
Factor out the ADC-sample-to-temperature conversion logic from the sensor
subsystem API implementation, and move it to a dedicated function.

This makes the driver more readable.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2024-10-02 10:03:03 +02:00
Mathieu Choplain
d307221065 drivers: sensor: stm32_temp: enable/disable channel in separate functions
Moves the temperature sensor channel enable and selection to separate
functions. This improves the driver's readability and makes introduction
of new STM32 series easier.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2024-10-02 10:03:03 +02:00
Kurtis Dinelle
5eeff698ca sensor: tsl2591: fix: Address CID 353644 & 353654
Fixes implicit sign-extension/potential overflow by explicitly casting
to int64_t.

Signed-off-by: Kurtis Dinelle <kurtisdinelle@gmail.com>
2024-10-02 10:01:43 +02:00
Ian Morris
92ec60f5ab drivers: sensor: renesas: Move to vendor subdirectory
Moves all Renesas sensor drivers into a vendor specific subdirectory
matching the organization used for other drivers.

Signed-off-by: Ian Morris <ian.d.morris@outlook.com>
2024-10-02 09:51:54 +02:00
Vladislav Pejic
fe5bfc9eb2 driver: sensor: adxl372: Bug fix for status2 reg
This is a bug fix for adxl372_get_status function.
This function is used to get STATUS1, STATUS2, FIFO_ENTRIES2
and FIFO_ENTRIES1 registers (they are continuously present
in the memory in this order). User can choose if it wants
STATUS2 and/or FIFO registers by passing pointers where
to store received values. Bug was when user doesn't want
STATUS2 and want FIFO regs. In that case calculated length
would be 3 which will result in reading of STATUS1, STATUS2
and FIFO_ENTRIES2 regs and not expected STATUS1, FIFO_ENTRIES2
and FIFO_ENTRIES1.

Signed-off-by: Vladislav Pejic <vladislav.pejic@orioninc.com>
2024-10-02 09:47:12 +02:00
Lauren Murphy
e0bd9aef66 drivers: sensor: add mmc56x3 sensor driver
Adds Memsic MMC56X3 magnetometer and temperature
sensor driver.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2024-09-24 10:09:25 +02:00
Lauren Murphy
3a595610e6 drivers: sensors: move mc3419 into parent memsic folder
Moves MC3419 into a parent Memsic folder, to be joined
later by MMC56X3.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2024-09-24 10:09:25 +02:00
TOKITA Hiroshi
8dce43bfc1 drivers: sensor: wsen: wsen_pads: Fix variable type mismatch
Fix to eliminate warnings caused by type mismatch.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2024-09-23 18:09:25 -04:00
TOKITA Hiroshi
90fb012db7 drivers: sensor: st: iis328dq: Avoiding declaring unused variables
Separating declarations of variables not referenced with #ifdef
when CONFIG_IIS328DQ_THRESHOLD is disabled.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2024-09-23 18:09:25 -04:00
Andrea Merello
cc61e96860 drivers: sensors: fix compile error due to conflicting types.
Since b249535 (sensors: Add channel specifier) the signature of
sensor_reconfigure_read_iodev() changed, but sensor_handlers.c
apparently hasn't been updated.

Fix compile time error by updating sensor_reconfigure_read_iodev()
signature in sensor_handlers.c

Signed-off-by: Andrea Merello <andrea.merello@iit.it>
2024-09-17 14:57:32 -04:00
Maureen Helm
13ff70a6f9 drivers: sensor: tdk: Refactor cmake and kconfig to vendor subdirectory
Refactors the cmake and kconfig bits of the tdk sensor drivers into the
vendor subdirectory to make them consistent with other vendor-sorted
sensor drivers. The tdk driver implementations were previously moved
into the vendor subdirectory in commit
41f1c3a2b7.

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2024-09-16 10:06:03 +02:00
Lauren Murphy
474431b24e drivers: sensors: bme280: clang format files
Clang formats decoder and header files.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2024-09-12 13:04:18 -04:00
Lauren Murphy
3ef81feb2c drivers: sensor: bme280: use int math in decode q31 conv
Fix decoder to use integer math when converting readings to Q31.

Fixes #77295

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2024-09-12 13:04:18 -04:00
Pisit Sawangvonganan
847a4eaad2 style: drivers: comply with MISRA C:2012 Rule 15.6
Add missing braces to comply with MISRA C:2012 Rule 15.6 and
also following Zephyr's style guideline.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-09-11 07:40:35 -04:00
Jordan Yates
632d6b9416 sensor: bme680: only read compensation params once
Only read the compensation parameters from the chip on first power up,
as they are static on the device.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-09-10 11:44:30 +02:00
Jordan Yates
5953a26dc6 sensor: bme680: support power domains
Support the BME680 being on a power domain, which may not be powered at
boot. For example, Nordic Thingy53.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-09-10 11:44:30 +02:00
Margherita Milani
5032f099c6 drivers: sensor: add apds9253 driver
Add all the necessary files to add apds9253 Avago sensor driver.

Sensor available at https://docs.broadcom.com/doc/APDS-9253-001-DS

Signed-off-by: Margherita Milani <margherita.milani@amarulasolutions.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
2024-09-09 13:56:17 -04:00
Sylvio Alves
8233b70ece espressif: clean up unused code
Remove all entries that as not being used.
This also update hal to re-enable warning flags
as such as -Wno-unused-variable.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-09-09 13:55:39 -04:00
Lucien Zhao
62e5805c57 drivers: sensor: mcux_acmp: update mcux_acmp drivers
add MCUX_ACMP_HAS_HYSTCTR macro to adapt feature if IP
don't exist HYSTCTR bit

Signed-off-by: Lucien Zhao <lucien.zhao@nxp.com>
2024-09-04 21:27:28 +02:00
Jeppe Odgaard
20fb6b6d24 drivers: sensors: explorir_m: fix uart flush early termination
`explorir_m_uart_flush_until_end` terminates immediately if the read
variable is initially equal to `EXPLORIR_M_MAX_RESPONSE_DELAY` and
`uart_poll_in` does not read anything.

Fix this by only checking the read variable if `uart_poll_in` reads a char.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2024-09-04 21:26:36 +02:00
Erwan Gouriou
d13f9d9b9b drivers: stm32: Select PINCTRL when required
Select PINCTRL subsystem by drivers which require it.
Prevent the need from enabling this symbol at board or soc level.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2024-09-03 14:40:55 +01:00
Chris Ruehl
db5091c9f4 Drivers: Add support for Bosch bmp180 sensor
Add driver support for Bosch bmp180 pressure sensor running on i2c bus.
It pushes the driver files to the bmp180 directory under
drivers/sensor/bosch. The driver implement the Sensor API
and support channel DIE_TEMP and PRESSURE.
Driver had been tested with the NRF5340DK.

V2 fixup
---------
Drivers: Bosch bmp180 fixups for PR v2
fix BMP180 in CMakeLists.txt
rename regControl to ctrlreg
simplify the logic in set_attribute
use BMP180_GET_CMD_TEMP_DELAY

Drivers: Bosch bmp180 use system byteorder macros
To aware of ENDIANESS use the macros from byteorders.h

Drivers: Bosch bmp180 comments added to #endif
Add a comment to the #endif /* CONFIG_FOO */

Drivers: Bosch bmp180 , fix twister run error
twister report an error related to using floor() with a float
fix this using floorf() function.

Drivers: Bosch bmp180, rework review v2
fix code style issues
simplify the structure for bus and i2c.
prepare to remove the empty bmp180_i2c.c

Drivers: Bosch bmp180, remove bmp180_i2c.c
bmp180: update CMakeList.txt remove bmp180_i2c.c
bmp180: remove unused variable

fixups for complient checks

replace homebrew bitshift with byteorder.h macro
sys_get_be16 and sys_get_be24
cleanup remove unused spi.h
change struct reg16/24 to uint8_t[]
remove channel AMBIENT_TEMP
bmp180/Kconfig add missing help text
fix indent issue in bmp180_pm_action
merge BMP180_CONFIG_I2C into BMP180_INST
Move DT_DRV_COMPAT out of the header file
drop LOG_DBG() from read calibration data
remove bus_io implementation and header cleanup
move headers and structs out from bmp180.h
fix typo in comment
apply clang format changes, only if not line lenght violation
fix indent code error after joined lines
conversion from Pa to kPh was wrong, fixed it
Remove default=n from Kconfig, it is the default.
Move the conversion ready test into a function (duplicate code)
and apply retry policy
parameter naming with indicate the usage
change BMP180_INST(inst) to clang format
fix int32_t overflow in convension formular
fix wrong devider in convension formula
move BSWAP_s16 BSWAP_u16 from .h to .c

Signed-off-by: Chris Ruehl <chris@gtsys.com.hk>
2024-08-30 11:46:25 -04:00
Fin Maaß
2293e6668a drivers: sensors: add jedec jc 42.4 compliant temperature sensor
This transforms the existing driver for the Microchip MCP9808
to be used as a generic driver to be used with  all
JEDEC JC 42.4 compliant temperature sensor chips.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-08-28 14:02:16 -04:00
Ian Morris
a329a0c09f drivers: sensor: tmp116: Add ability to set operating mode of TMP116/7
Adds support for setting the operating mode of the TMP116/7 sensor to
either shutdown, continuous conversion or one-shot mode.

Signed-off-by: Ian Morris <ian.d.morris@outlook.com>
2024-08-27 15:14:59 -04:00
Armando Visconti
9ea4cb96cd drivers/sensor/st: Fix wrong data byte swap for be
A 16-bit value built using byte shifts and ORs from a given
couple of lsb and msb bytes will result to be the same on both
little-endian and big-endian architectures, e.g.

    uint8_t lsb, msb;
    int16_t val;

    /* val is the same number on both le and be archs, but has
       different layout in memory */
    val = (msb << 8) | lsb;

All the xyz_raw_get() APIs of stmemsc sensor module build the sensor
data using the above method and DO NOT hence require (it actually leads
to wrong values on big-endian machines) to use any le/be swap routines,
such as sys_le16_to_cpu().

Fix #75758

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2024-08-27 07:07:52 -04:00
Anuj Pathak
1f05d03489 Drivers: Sensor: mc3419: Moved Decimation Rate config to DT
- Similar to LPF settings decimation rate could be applied to
per instance basis, thus moved to DT prop

Signed-off-by: Anuj Pathak <anuj@croxel.com>
2024-08-26 18:51:28 +02:00
Anuj Pathak
932e207741 Drivers: Sensor: mc3419: Added LPF CutOff select using dt
For applications that rely on low noise/variance in accelerometer
sample reading. Application can take advantage of integrated LPF
Thus this PR adds LPF configuration capability to the mc3419 driver

Signed-off-by: Anuj Pathak <anuj@croxel.com>
2024-08-26 18:51:28 +02:00
Aiman Mazlan
0d796ee286 drivers: sensor: st: vl53l1x: add return to attr_set and attr_get
Incorrect value set by user when using sensor_attr_set can fail silently
since it always returns 0.
Fix by adding ret. Also added return on sensor_attr_get.

Signed-off-by: Aiman Mazlan <mohammad.aiman@stratusauto.com>
2024-08-23 08:02:23 -04:00
Maureen Helm
e49cca2cc3 drivers: sensor: Fix adxl345 sample fetch return value
Fixes the adxl345 accelerometer driver to return zero on sample fetch
success, as specified by the sensor driver API. Prior to this change,
the driver incorrectly returned a positive non-zero value on sample
fetch success, which in turn caused a bus fault getting data with the
sensor shell.

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2024-08-23 09:53:28 +02:00
Raffael Rostagno
90c6106926 drivers: esp32: Interrupts flags configuration
Allows configuring interrupts flags in the device tree for
ESP32 devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-22 14:25:25 -04:00
Raffael Rostagno
0b3a34cdca drivers: esp32: Interrupts priority configuration
Allows configuring interrupts priority in the device tree for
ESP32 devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-22 14:25:25 -04:00
Armando Visconti
45ae08a379 modules/hal_st: Align sensor drivers to stmemsc HAL i/f v2.6
Align all sensor drivers that are using stmemsc (STdC) HAL i/f
to new APIs of stmemsc v2.6

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

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2024-08-21 18:27:28 +01:00
Pisit Sawangvonganan
1bcae0ea9f style: drivers: comply with MISRA C:2012 Rule 15.6
Add missing braces to comply with MISRA C:2012 Rule 15.6 and
also following Zephyr's style guideline.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-20 10:33:51 +02:00
Fredrik Gihl
9eaf488907 drivers: sensor: tmp114: Add support for OVERSAMPLING attr
Tmp114 has an average function, according to the datasheet this is
default disabled. Add attribute to enable this feature.

Signed-off-by: Fredrik Gihl <fgihl@hotmail.com>
2024-08-19 15:18:25 -04:00