Should increment `ch.chan_idx` instead of `channel_idx`,
otherwise we will be stucked in the loop forever.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
The vbat driver requires the adc node to be enabled:
```c
.adc = DEVICE_DT_GET(DT_INST_IO_CHANNELS_CTLR(inst))
```
Update its Kconfig to depend on `DT_HAS_ST_STM32_ADC_ENABLED`,
which is the `"st,stm32-adc"` compat that all ST ADC bindings
include, this will guarantee that at least one ADC node is
enabled, but not necessarily the ADC used by the vbat node.
To make sure that it at least compiles, we init the `adc`
pointer only if the specified ADC node is enabled, otherwise
it will points to `NULL`.
Finally, check if the `adc` points to `NULL` in
`stm32_vbat_init`. We are not relying on the existing
`device_is_ready` check because `DEVICE_DT_GET` will not
return `NULL` if the ADC is enabled. `adc == NULL` means
that the ADC node is not enabled in the devicetree.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Use a structured channel specifier rather than a single enum when
specifying channels to read in the new read/decoder API.
Replaces usages of a seperate channel and channel_index parameter
where previously used with a struct sensor_chan_spec.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Add driver for TSic 206/306/316/506F/516/716 temperature sensor.
The driver uses PWM capture driver to read a single wire with
Manchester-like encoding.
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
`CONFIG_PM_DEVICE` being disabled does not mean that the `power-gpio`
does not need to be controlled.
Additionally, not having a `power-gpio` property does not mean that
power management is not supported, just that is has no work to do.
Signed-off-by: Jordan Yates <jordan@embeint.com>
When a sensor that depends on an ADC is enabled in devicetree, enable
the ADC subsystem. ADC is roughly equivalent to a bus for these sensors
(the mechanism through which data is transferred), which had the same
conversion applied in #48707.
The same benefits apply here, namely removing the need for the following
pattern in board `.kconfig` files:
```
configdefault ADC
default y if SENSOR
```
Signed-off-by: Jordan Yates <jordan@embeint.com>
The val2 calculation was done using (1000000 / 40960) as
multiplying factor, which was sometimes leading to a
int32 overflow. So, let's use the equivalent (but smaller)
(3125 / 128).
Fix#46615
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Add driver, together with the corresponding dts binding and node in
the nRF54H20 SoC definiton, for the nRF temperature sensor that cannot
be accessed directly but only through nRF Services (nrfs) layer.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Instead of using floating point operations to compute the vref voltage,
it is possible to use the sensor_value_from_milli() function.
On a STM32G0, this saves 130 bytes of flash, excluding the FP library
needed on a FPU less MCU.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Instead of using floating point operations to compute the vbat voltage,
it is possible to do the computation using 32-bit variables by
reordering operations and using the sensor_value_from_milli() function.
On a STM32G0, this saves 140 bytes of flash, excluding the FP library
needed on a FPU less MCU.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Add RX packet validator where header, address, pid
and checksum bytes are verified and validated on
every functions.
Signed-off-by: Dinesh Kumar K <dinesh@linumiz.com>
1. Add functionality for upload and download fingerprint
template data of the R502A fingerprint sensor device.
2. change data type for data_len parameter of
transceive_packet function to uint16_t as it may hold
value 256 for dowload template data to sensor.
Signed-off-by: Dinesh Kumar K <dinesh@linumiz.com>
improvised uart tx and rx handler functions to handle
large chunk of fingerprint data from/to the sensor.
Signed-off-by: Dinesh Kumar K <dinesh@linumiz.com>
Removed fps_enroll, fps_search and fps_delete from
driver code, since they did application usage inside
driver. add the following attributes to achieve the
above functionality from application.
1. SENSOR_ATTR_R502A_CAPTURE
2. SENSOR_ATTR_R502A_TEMPLATE_CREATE
3. SENSOR_ATTR_R502A_RECORD_ADD
4. SENSOR_ATTR_R502A_RECORD_LOAD
5. SENSOR_ATTR_R502A_COMPARE
Signed-off-by: Dinesh Kumar K <dinesh@linumiz.com>
return -ENOENT; when no record found on getting
attribute SENSOR_ATTR_R502A_FIND and fix array indexing
for tx data in fps_search.
Signed-off-by: Dinesh Kumar K <dinesh@linumiz.com>
Only show the tmp112 runtime options when the tmp112 driver is enabled,
otherwise the option is confusing and does not appear hierarchically in
menuconfig.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Make use of sensor_ug_to_ms2() and sensor_10udegrees_to_rad() APIs
to convert from raw values into proper units (i.e. m/s^2 for accel
and rad/s for gyro). It also improves measurement precision.
Fixes#63980
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Since the interrupt state of the IA bit (interrupt source register) is
checked, it needs to be read out everytime, not only on latching.
Fixes#71245
Signed-off-by: Juliane Schulze <juliane.schulze@deveritec.com>
To be consistent with the computed offset on sensor_submit_fallback()
implementation. This prevents falling in misalignment issues when the
number of sensor channels changes.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Since this loops over all listed sensor channels, this makes more
difficult catching other debug log messages that might be of interest
(e.g: Decoding results).
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Add device driver for TI TMP114 I2C temperature sensor.
The driver only support basic functionality, i.e. fetch temperature
using default values.
Datasheet:
https://www.ti.com/lit/ds/symlink/tmp114.pdf
Signed-off-by: Fredrik Gihl <fgihl@hotmail.com>
Make use of sensor_ug_to_ms2() and sensor_10udegrees_to_rad() APIs
to convert from raw values into proper units (i.e. m/s^2 for accel
and rad/s for gyro).
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Implement a sensor for the output diagnostics of the power train
switch TLE9104.
Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
Moves a Kconfig that appears everywhere in the wrong place so that
it is enclosed if if statment check, so it only shows for device
that have the driver enabled
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>