Registers driver with pm_device_driver_init(); implements TURN_ON,
SUSPEND and RESUME. Sets ODR = 0 on suspend per datasheet
Signed-off-by: Van Petrosyan <van.petrosyan@sensirion.com>
The DHT driver incorrectly assumes all sensor instances are the same
type as the first instance (dht@0). The data parsing logic uses a
hardcoded check of the devicetree property for instance 0, which
causes incorrect readings when different sensor models (e.g., DHT11
and DHT22) are used together.
This change stores the model type in each per-instance config struct
during initialization. The data parsing logic is updated to use this
per-instance flag, ensuring each sensor is handled correctly
according to its specific model.
Signed-off-by: John Shelton <moosery@gmail.com>
The fractional part of the qdec sensor readout is set to zero (val2 =
0).
Changed the format of the run time data to Q26.6 and adjusted the
assignment of val1 and val2 accordingly.
Signed-off-by: Juraj Lieskovský <lieskovsky.juraj@gmail.com>
While it would likely not directly cause issues with the current
implementation, the logic of turning off the sensor should be to
actually reset the flags, not to toggle them.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Use && instead of & in channel validation logic to ensure channel is
either CHAN_IR or CHAN_LIGHT.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Support three different FIFO contents which are selectable through
a new DT property, fifo-mode-sel, which may be set to one of the
following values:
- 0x0 # 1x Accelerometer @12bit and 1x temperature @12bit samples
- 0x1 # 1x Accelerometer @16bit sample
- 0x2 # 2x Accelerometer @8bit samples (previous and current)
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Remove logically dead if and else-if conditions as shown by the static
analysis, replacing with the else statement.
When data_opt is assigned to the MIN of fifo_wmark_cfg and fifo_full_cfg,
both those variables will be non-NULL as an earlier condition ensures the
function returns if either one of the variables is NULL before assigning
to data_opt.
Signed-off-by: Alexander Apostolu <apostolu240@gmail.com>
Add SENSOR_TRIG_DATA_READY trigger support to RTIO streaming.
Currently it just handle XL drdy.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Registers driver with pm_device_driver_init(). Moved
chip init routine into separate function to be called
from PM_DEVICE_ACTION_TURN_ON. Added a delay after
power-up.
Signed-off-by: Van Petrosyan <van.petrosyan@sensirion.com>
The returned values from function calls should
be ignored since these function calls are dummy reads.
fixes#90480
Signed-off-by: Wajdi ELMuhtadi <wajdi.elmuhtadi@we-online.com>
Some ADC's draw significant power while enabled, so make sure the
driver can handle ADC's that have device runtime PM enabled.
Signed-off-by: Jordan Yates <jordan@embeint.com>
The mode is activated by the CONFIG_MODBUS_NONCOMPLIANT_SERIAL_MODE option
and allows any stop-bit setting for the serial port.
Signed-off-by: Maksim Salau <msalau@iotecha.com>
AS6212 supports 0.25Hz, 1Hz, 4Hz, and 8Hz sampling frequencies, but the
current driver supports 0.25Hz, 1Hz, 4Hz, and 16Hz sampling frequencies.
Signed-off-by: Clément Laigle <c.laigle@catie.fr>
Registers driver with pm_device_driver_init(). Peform
software reset on TURN_ON. Added a small delay after
power-up
Signed-off-by: Van Petrosyan <van.petrosyan@sensirion.com>
Fixed typos in the preprocessor macros for pressure range initialization
Unfortunately this particular configuration is not covered in CI since
build_all test has pressue-range "D2" and the broken code was concerning
"D9"
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Added a missing return statement in the mmc56x3_decoder_get_size_info
causing incorrect size calculation for single channel data
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
z_vrfy_sensor_reconfigure_read_iodev function was performing a
a K_SYSCALL_MEMORY_READ check using an incorrect structure type.
z_vrfy_sensor_get_decoder wasn't properly checking output
parameter `decoder`
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Corrected the logical operator (||, not |) in the condition that checks
for successful acquisition of RTIO SQEs.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Corrected the logical operator (||, not |) in the condition that checks
for successful acquisition of RTIO SQEs.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Improvements include: check error codes, log level adjustments,
removed unreachable code, disable tilt when not used, call optimized
interrupt handler when tilt and tap are not used.
Signed-off-by: Ivan Wagner <ivan.wagner@tecinvent.ch>
Add RTIO async and RTIO stream functionalities that enables,
among all the other things, the sensor data streaming from FIFO.
RTIO stream supports following triggers:
- SENSOR_TRIG_FIFO_WATERMARK
- SENSOR_TRIG_FIFO_FULL
- SENSOR_TRIG_DATA_READY
Following FIFO parameters has to be defined in device tree to
correctly stream sensor data:
- fifo-watermark
- accel-fifo-batch-rate
Currently the driver can decode FIFO content with Accelerometer
16-bit samples.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Introduce mock_i2c_error function in emulator in order to emulate i2c
errors for various registers
Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
Initial driver for the icm40627 from Invensense/TDK, a 6-axis
accelerometer with gyroscope and temperature sensing capabilities.
Signed-off-by: Florijan Plohl <florijan.plohl@norik.com>
The ntc-thermistor-generic is not thread safe when calling
sensor_channel_get() due to the mutex not being used in
ntc_thermistor_channel_get() when the sampled data is accessed.
Add the thermistor_data mutex around the data access to fix.
Signed-off-by: Tom Deconinck <t.deconinck@gmail.com>
The reset may cause initialization issues because of a missing
ACK from the sensor. The error check for the I2C communication
is removed to avoid issues during the initialization.
Closes#89850
Signed-off-by: Daniel Kampert <DanielKampert@kampis-elektroecke.de>
A recent change 9eeb60c improperly removed a critical line in the driver.
This commit replaces that line and moves an irq_lock to above any pin
value manipulation since the timing is sensitive with the DHT protocol.
This should also fix the timing issue 9eeb60c attempted to fix.
Signed-off-by: John Shelton <moosery@gmail.com>
A write to the "ctrl_meas" register can cause the sensor to transition
from sleep to normal mode (which is default Kconfig settings). As per
BME280 datasheet, writes to the "config" register in normal mode may be
ignored. This can lead to use BME280_STANDBY_05MS and BME280_FILTER_OFF
instead of the values set by the application. To fix this, write to the
"config" register before "ctrl_meas" in the sensor init function.
Signed-off-by: Loic Domaigne <tech@domaigne.com>
The following parameters are exposed through DTS bindings:
- ODR.
- Dual Frequency Mode.
- Measurement Mode.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Each time this sensor gets a reading, it contains a matrix of 4 x 32
pixels containing distance readings, from which the 1-D result is
calculated. The private channel would expose this array through
Sensor APIs.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
- Add AFBR module as a HAL.
- Platform layer to support running AFBR API using Zephyr.
- Ability to instantiate on device-tree.
- Samples in the module proving foundations works.
- Zephyr Sensor API support, by introducing:
- Read/Decode for SENSOR_CHAN_DISTANCE (1-D results).
- Streaming mode for DATA_READY (1-D results).
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Removed a logically dead else by doing sensor channel check
in a way that's more aligned with how other drivers do it.
Fixes: CID 505949
Fixes: zephyrproject-rtos/zephyr#90558
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
some current sense amplifiers have a non zero offset voltage
that correlates to zero current. adding this offset voltage binding
allows the driver to be used with this type of circuitry.
Signed-off-by: Brandon Allen <brandon.allen@exacttechnology.com>