Request calibration of the ADC in the voltage divider driver to improve
the accuracy of the measured voltages.
Signed-off-by: Jordan Yates <jordan@embeint.com>
The sensor interface gives current channel values in Amps, but the "I"
(current) value is displayed in mA, so needs to be converted accordingly.
Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
Fix to ensure temperature is sampled at the same timestamp as x,y,z axis
data.
Signed-off-by: Vinayak Sunilkumar Priyadarsini <Vinayak.SunilkumarPriyadarsini@analog.com>
When the loop completes without breaking, tries would be
BMI270_CONFIG_FILE_RETRIES + 1 so the error check was never hit.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Add wsen_isds_2536030320001 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>
In both lsm9ds1 and lsm9ds1_mag drivers, the device data structure is
generally referenced with the variable name data.
However, in the initialization functions, the variable was named
lsm9ds1 (or lsm9ds1_mag for the magnetometer), which breaks this
convention.
Rename these variables to data for consistency across the driver.
Signed-off-by: Miguel Gazquez <miguel.gazquez@bootlin.com>
Adds support for device PM for the lsm9ds1 sensor, putting the sampling
frequency of both the accelerometer and the gyroscope at 0 when the device
is suspended.
Signed-off-by: Miguel Gazquez <miguel.gazquez@bootlin.com>
Fix Coverity issue CID 524766: A potential integer overflow could occur
in paj7620_set_sampling_rate() due to multiplication of
sensor_value->val1 instance(which is of type int32_t) with 1000000
without typecasting it to int64_t.
Fixes#90482
Signed-off-by: Aditya Chopra <adityachopra2912@gmail.com>
Check `explorir_m_uart_transceive`'s return value in `explorir_m_init` and
return the value if not 0.
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
- Code optimization for platforms which don't use subscription feature
in the temperature service.
- Test adaptation to code changes
Signed-off-by: Rafal Dyla <rafal.dyla@nordicsemi.no>
Fix an out of bounds access found by ASan.
Also remove mock_i2c_reg_error which seems to never be read.
Signed-off-by: Dmitrii Sharshakov <d3dx12.xx@gmail.com>
Run clang-format on tmp11x.c and tmp11x.h and change `DEFINE_TMP11X` to
prevent too long lines when clang-format is run.
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
Enable optional storage of sensor attribute values in EEPROM. On reset, the
device goes through a POR sequence that loads the values programmed in the
EEPROM into the respective register map locations.
The driver stores sample frequency, offset, oversampling, lower threshold,
upper threshold, alert pin polarity, alert mode and conversion mode if the
value is continuous or shutdown.
The functionality has been tested with sensor shell and power cycling
sensor:
Test (undocumented) temperature offset is stored:
```shell
uart:~$ sensor attr_set ti_tmp11x@48 ambient_temp offset 0
ti_tmp11x@48 channel=ambient_temp, attr=offset set to value=0
uart:~$ sensor get ti_tmp11x@48 ambient_temp
[...] (25.523436)
uart:~$ sensor attr_set ti_tmp11x@48 ambient_temp offset 50
ti_tmp11x@48 channel=ambient_temp, attr=offset set to value=50
uart:~$ sensor get ti_tmp11x@48 ambient_temp
[...] (75.617186)
uart:~$
[15:12:20.088] Disconnected
[15:12:36.106] Connected
uart:~$ sensor get ti_tmp11x@48 ambient_temp
[...] (75.554686)
uart:~$ sensor attr_get ti_tmp11x@48 ambient_temp offset
ti_tmp11x@48(channel=ambient_temp, attr=offset) value=50.000000
```
Test one-shot mode is not stored:
```shell
uart:~$ sensor attr_set ti_tmp11x@48 ambient_temp 18 1
ti_tmp11x@48 channel=ambient_temp, attr=accel_x set to value=1
uart:~$ sensor get ti_tmp11x@48 ambient_temp
[...] (75.562499)
uart:~$ sensor get ti_tmp11x@48 ambient_temp
Read failed
[00:00:21.332,000] <wrn> sensor_compat: Failed to fetch samples
uart:~$
[15:16:24.529] Disconnected
[15:16:33.540] Connected
uart:~$ sensor get ti_tmp11x@48 ambient_temp
[...] (75.406249)
uart:~$ sensor get ti_tmp11x@48 ambient_temp
[...] (75.351561)
```
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
Remove the configs that are not actually used for anything anymore or
never were, or that are redundant with other configs, and don't have any
code changes outside of Kconfig to remove.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Changed to use the raw reading rather than the scaled value, as that's
what the angle calculation is expecting. Added log messages that
communicate magnet sense state.
Signed-off-by: Russ Webber <russ@sentryrobotics.au>
Fix Coverity CID 529858 (CWE-252): Previously, the return value of
pm_device_runtime_get() was not checked during PM resume, which could
lead to missed error conditions.
This patch ensures proper error handling by checking and propagating
the return status of the call.
Fixes: #92608
Signed-off-by: sudarsan N <sudarsansamy2002@gmail.com>
- Setting IODEV_SQE to NULL to subsequent triggers are rejected.
- Channel all error-resolutions through handle_result_on_error().
Signed-off-by: Luis Ubieda <luisf@croxel.com>
To follow with error-handling of multi-shot items, they won't be marked
as cancelled. Instead, we expect them to stop being submitted, hence we
dispose the handle upon finishing every shot.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
To follow with error-handling of multi-shot items, they won't be marked
as cancelled. Instead, we expect them to stop being submitted, hence we
dispose the handle upon finishing every shot.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Run-time errors can still be considered asserts if checkif is
configured as such, otherwise, prevent crashing.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Considering the app may have cancelled all the requests as an error
handling strategy, this driver needs to support recovering from such
case.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Whenever the data-ready callback is invoked, there's a common pattern
that needs to take place:
- Stop measurement timer (to stop on-coming samples), which could be
restored by the application re-submitting the request.
- Set iodev_sqe to NULL, so new requests can come in.
- Report the error on the SQE.
This has been refactored in handle_error_on_result() and now it's
invoked throughout the code.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
The existing build-time asserts not only needs to cover dual-frequency
mode does no exceed high-speed settings, it needs to allow not using
dual-frequency mode settings at all, which is what this patch does.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Allows to configure the alert or therm mode for triggers
based on the low/high temperature treshholds
Also adding simple PM
Signed-off-by: Tobias Meyer <tobiuhg@gmail.com>
- Add lux conversion to APDS-9306 driver
- Change settings of gain, resolution and
frequency to index-based settings
- Add Device Tree overlay sample for APDS-9306
- Fix wrong board name in light_polling README
- Add value checks for the attribute set API call
- Remove the reading of the sensor attributes
from the sensor and use buffered values instead
- Rename `frequency` property to `measurement period`
Closes#91104
Signed-off-by: Daniel Kampert <DanielKampert@kampis-elektroecke.de>
Even though it's not listed in the options of
icm45686_get_shift(), for completeness sake,
do not leave an unhandled range.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Add a helper function that constructs a rtio SQE chain with the purpose
to perform a bus read operation on a list of registers.
Usage:
struct rtio_regs regs;
struct rtio_reg_list regs_list[] = {{regs_addr1, mem_addr_1, mem_len_1},
{regs_addr2, mem_addr_2, mem_len_2},
...
};
regs.rtio_regs_list = regs_list;
regs.rtio_regs_num = ARRAY_SIZE(regs_list);
rtio_read_regs_async(rtio,
iodev,
RTIO_BUS_SPI,
®s,
sqe,
dev,
op_cb);
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Otherwise, a previous firmware build could have run into the chip and
keep led control enabled in spite of disabling it through
dts-property.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Remove extra-parentheses when operator precedence is implicit.
Eliminate implicit integer to boolean conversions.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Usually, drivers failing to initialize throw a message in the log,
signaling the cause of failure. Add it to this driver so the user
isn't confused by no message yet the device being marked as disabled.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Fix Coverity issue CID 363738 (CWE-120): A potential buffer overflow could
occur in fcx_mldx5_uart_send() due to unchecked memcpy() when copying
command data into a fixed-size frame buffer.
This patch ensures that the length of the data being copied validated
against the remaining buffer size to prevent overruns. Also replaces a
redundant strlen() call with the precomputed cmd_data_len.
Fixes: #92634
Signed-off-by: sudarsan N <sudarsansamy2002@gmail.com>
Addressing low-hanging fruits.
Put in a separate commit in order to make it easier to keep track of
changes.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
As a first step to enable the similar variants (e.g: ICM42686),
refactor common functionality into icm4268x files. As a result,
applications using the icm42688 will need to have both compatible
properties: "invensense,icm42688" and "invensense,icm4268x" defined.
In-tree boards have been modified to comply with this pattern.
This patch does not contain functional changes. The driver should
work the same as before.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
1. Fixed the bug that DAC value was set incorrectly.
2. The MIMXRT700 does not have windowed mode and
'enableSample' controls, code added for compatibility
on this platform.
Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
This commit adds a new driver for the MaxBotix MB7040 ultrasonic
rangefinder. The driver uses I2C communication to read range data
from the sensor and exposes it via the Zephyr sensor API.
Tested on an esp32-s3 board using I2C bus. Verified readings at multiple
distances to confirm accuracy.
Signed-off-by: Sabrina Simkhovich <sabrinasimkhovich@gmail.com>
paj7620 log module was being registered twice ; use LOG_MODULE_DECLARE
instead in paj7620_trigger.c
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>