- Add SENSOR_ATTR_GAIN and SENSOR_ATTR_RESOLUTION
- Remove SENSOR_ATTR_GAIN from tsl2540 header
Signed-off-by: Daniel Kampert <DanielKampert@kampis-elektroecke.de>
Don't pulse the enable pin on boot if the device is going to immediately
go into suspend mode via `zephyr,pm-device-runtime-auto`.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Fix the sensor range setting at runtime which is currently returning error,
converting the SI (ms2) value passed thru SENSOR_ATTR_FULL_SCALE in mg (and
not in g) as this is the unit used in the driver internals.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Do not fail when requested rate passed in SENSOR_ATTR_SAMPLING_FREQUENCY
is not matching any of the odr values supported by sensor. Instead, round
it up to the next one.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
- apply correct order to suspend/resume when using continuous mode
- unset LPEN (low-power-enable) bit on suspend (causing excessive
current draw)
- fix a starting issue which lead to higher power consumption
Signed-off-by: Juliane Schulze <juliane.schulze@deveritec.com>
The NTC thermistor sensor in drivers/sensor/ntc_thermistor/ntc_thermistor.c
cannot work with a 16-bit ADC.
The voltage becomes negative if the ADC raw value is 0x8000 or higher.
To correct this, I changed the types in the
ntc_thermistor_data struct from int16_t to int32_t.
This also corrects a potential problem at line 53
where we transform an int16_t into an int32_t.
Fixes: #75203
Signed-off-by: Robin Carrupt <robincarrupt@gmail.com>
The TMAG3001 is quite similar to the tmag5273 and can be used with just
some small modifications.
Signed-off-by: Fabian Pflug <fabian.pflug@grandcentrix.net>
The ICACHE must be disabled on STM32H5 series due to documented
behaviour of the flash controller, not to an errata.
For a more technical explaination: (see RM0492 for references)
- on STM32H5, the ICACHE block is interposed on C-bus between
the Cortex-M33 and the FLASH (§2.1.1)
- the ICACHE determines if accesses are cacheable or non-cacheable
based on an AHB attribute; the Cortex-M33 sets this attribute or
not depending on the MPU configuration (§8.4.6)
- when a cacheable access is requested by the Cortex-M33, if the
requested data is not present in ICACHE (cache miss), a cache line
refill (128-bit burst read) is performed (§8.4.7)
- however, all accesses to OTP and Read-Only regions of the FLASH must
be done with caching disabled (§7.3.2); indeed, the accesses MUST be
16 or 32-bit sized - otherwise, the flash interface raises a bus
error (§7.5.9 / Table 38 "OTP/RO access constraints").
This is the behaviour that was observed and lead to the introduction
of ICACHE disable code in 065a8f25e1.
Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
This commit modifies the STM32 battery voltage sensor driver
to handle erroneous usage more gracefully. More precisely,
it now fails builds with an explicit error message when the
sensor is enabled but the corresponding ADC is not. This can
only happen on STM32 series with more than one ADC (e.g., H7).
Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
This commit modifies the STM32 internal voltage reference sensor
driver to handle erroneous usage more gracefully. More precisely:
- driver no longer builds if no ADC node is enabled
- fail builds with an explicit error message when the sensor
is enabled but the corresponding ADC is not. This can only
happen on STM32 series with more than one ADC (e.g., H7).
Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
This commit modifies the STM32 internal temperature sensor driver
to handle erroneous usage more gracefully. More precisely:
- driver no longer builds if no ADC node is enabled
- fail builds with an explicit error message when the sensor
is enabled but the corresponding ADC is not. This can only
happen on STM32 series with more than one ADC (e.g., H7).
Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
Remove the ‘HAS_MCUX_ACMP’ Kconfig, and also remove it from
driver and soc Kconfig files. It is not needed since we already
depend on 'ACMP' enabled in the dt file, the 'HAS_MCUX_ACMP'
kconfig is a relic of the past before devicetree was stable.
Signed-off-by: Anke Xiao <anke.xiao@nxp.com>
In lis2dux12_set_odr(), the call to stmemsc module lis2dux12_mode_set()
API is done with the .fs field left uninitialized, so setting the
underlying device regs in an unproper way.
Suggested-by: Luis Ubieda <luisf@croxel.com>
Signed-off-by: Armando Visconti <armando.visconti@st.com>
The LSM9DS1 is a system-in-package featuring
a 3D digital linear acceleration sensor, a 3D digital angular rate
sensor and a 3D digital magnetic sensor.
This driver implements only the linear acceleration sensor and the
angular rate sensor, on the I2C bus.
This driver is without trigger support.
The driver is based on the stmemsc HAL.
link: https://www.st.com/resource/en/datasheet/lsm9ds1.pdf
Signed-off-by: Miguel Gazquez <miguel.gazquez@bootlin.com>
There were code paths that could have lead to divide by zero given an
invalid scale setting for accel or gyro. In practice this should be an
invalid setup even before getting to these conversion functions. The
conversion functions now better show all valid values are accounted for
by using CODE_UNREACHABLE in the default case.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Adds support for setting the number of conversion results that are
collected and averaged before updating the temperature register.
Signed-off-by: Ian Morris <ian.d.morris@outlook.com>
Return to sensor_api i/f the temperature in Celsius instead
of the register raw value in LSB.
Fixes#75686
Signed-off-by: Armando Visconti <armando.visconti@st.com>
The current implementation assumes that sensor odr and range are
always configured in the Device Tree at compile time which might
not be the case.
Instead, application can set odr and range either at compile time
through the DT or using SENSOR_ATTR_SAMPLING_FREQUENCY and
SENSOR_ATTR_FULL_SCALE attributes at runtime, so each driver instance
must keep trace of the latest values set and use them in the sensor
APIs which require them (e.g. lis2dux12_mode_set).
Signed-off-by: Armando Visconti <armando.visconti@st.com>
When setting the full scale through SENSOR_ATTR_FULL_SCALE the
driver must convert the g value (i.e. one of 2g/4g/8g/16g) to
the corrispondent sensor fs raw value.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
A patch was added to the voltage divider to handle an erroneous
negative voltage reading for the nrfx_saadc which could return
negative voltages even though the ADC mode was single ended.
This has now been patched in the ADC driver.
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
In order to decouple the read request from its implementation, we need
to be able to yield to potential lower-priority threads, which is not
possible with k_yield() itself. As such, using RTIO Consume semaphore
enables us to achieve this.
This patch also refactors blocking API (sensor_read) to also block upon
consumption, so as not to require RTIO_SUBMIT_SEM enabled.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
When multiple devices are on the bus, and no slave matches
the sent rom, the master receives only ones.
This should be handled explicitly and the error reporting
should not rely on the crc mismatch of the scratchpad.
Note: Make sure that the sensor configuration is loaded to the
eeprom (copy scratchpad), otherwise the resolution will not match
the expectations in case a node looses power and recovers.
As in that case the configuration will not be applied again.
Also the sensor may still report the power on reset value
of +85°C just after the sensor powered up.
Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
After each read of the scratchpad the crc of the data
is checked and in case of a mismatch an error is returned.
Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
- Move the content of the header file into the source file,
and drop unnecessary includes.
- Also, drop the bus access function.
Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
Previously both temperature and pressure were updated regardless of
which one was requested.
Fixes CID: 392519, GH: 74779.
Fixes CID: 392497, GH: 74777.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
During initialization, zero is returned if an unexpected device ID is
read because the returned variable is not written to after a previous
non-zero check. Return -EIO instead to indicate an error occurred.
Detected with the following Coccinelle script:
@@
identifier I;
@@
*if (I) {
...
return ...;
}
if (...) {
... when != I
when any
* return I;
}
Signed-off-by: Jared Kangas <kangas.jd@gmail.com>
RTIO expects the CHAINED flag to be set when ordering of operations is
important. The callbacks in the icm42688 stream handling were not
chained into, meaning the callbacks would have occured immediately
rather than *after* the SPI reads/writes.
Update all the spi transactions to chain into the desired callbacks in
the driver.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Fix ism330dhcx_gyro_fs_map[] and ism330dhcx_gyro_fs_sens[] arrays
initialization in order to be able to correctly convert from dps
to register raw value through the array index.
Fix: #72617
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Loop inside the odr array until we find the first
value which is "<=" (amd not "==") the argument.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Fix the devicetree bindings to actually be used as the default
configuration, following the example set by various ST sensor devices.
This requires sadly dropping enums and using #defines for various
options as well as repeating many numbers, but presumably is the way to
do it given the precedent set by ST with sensors like the lsm6dso.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
As pointed out on #57586: `LM75_TRIGGER_GLOBAL_THREAD` can't be enabled
without the int-gpios being present in the DTS node. This commit
requires at least one LM75 instance featuring it, otherwise it won't
work.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Some functions in the bmm150 driver were depending on a define
that was never used. Changed it to the one that is actually defined.
Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
Confirming the Proximity Integration is an integer, we don't need to
pre-apply the Scaling factor to then be accounted for when the actual
meas_timeout_us is calculated.
Signed-off-by: Luis Ubieda <luisf@croxel.com>