Change the npm13xx_charger fetch function to first trigger a sample
and then block until the result is available.
Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>
Issue based on rebasing with in-flight changes where the callback adds
an argument on the readout transfers. Moreover, handle that result and
error if failure.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Allows CONTAINER_OF inside trigger handler to be used to obtain a valid
ptr to the composite struct consisting of a struct sensor_trigger trig.
Fixeszephyrproject-rtos/zephyr#97124
Signed-off-by: Christoph Jans <jans.christoph@gmail.com>
The millionths value is calculated incorrectly.
The sensor has a precision of 0.5 which is 500000 millionths, but
there is an extra zero in the code. This fix removes the extra zero.
Signed-off-by: Sašo Domadenik <saso.doma@gmail.com>
Make use of rtio_read_regs_async() and rtio_flush_completion_queue()
helpers in lis2dux12 and lsm6dsv16x sensor drivers.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Extend the LIS2DU12 accelerometer driver with SENSOR_TRIG_DELTA
support. The detection is based on the slope between successive
channel readings. Support for setting SENSOR_ATTR_SLOPE_TH and
SENSOR_ATTR_SLOPE_DUR is added as well. In line with other sensors,
SENSOR_ATTR_SLOPE_TH is configured in SI units (m/s^2) and
SENSOR_ATTR_SLOPE_DUR in samples relative to the ODR. The new trigger
can be mapped either to the same GPIO as the data-ready interrupt or
to a dedicated one.
Signed-off-by: Jan Kablitz <jan.kablitz@8tronix.de>
Add support for Omron D6F mass flow rate sensor series. The sensor series
outputs an analogue voltage which is read using an ADC.
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
Add flow rate to `enum sensor_channel` in litres per minute.
The SI unit for flow rate is cubic metres per second. Due to a sensor value
resolution of 1/100000 this unit is not granular enough for low flow rate
sensors.
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
Use k_timepoint_t instead of k_timeout_t for absolute time to avoid
ambiguity and ensure the code works even when CONFIG_TIMEOUT_64BIT=n.
Signed-off-by: Cla Mattia Galliard <clamattia@gmail.com>
Adds a skip-calibration property to the voltage divider sensor,
which can be enabled, in case the underlying ADC driver
does not support calibration.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
This macro doesn't accept a delay parameter anymore (well, it does, but
it's deprecated and will trigger build warnings). Just remove it from the
places that were still passing it.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
- Since ti-hdc20xx is a sensor, it should use SENSOR_DEVICE_* macro for
definition.
- Allows it to work with sensor_shell properly.
Signed-off-by: Ayush Singh <ayush@beagleboard.org>
Otherwise we'd always return false in spite of the flag being set in
the encoded data, which may lead to the user not reading the underlying
data in an event-paced readout scheme.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Commit bc8d66d538931e650dd2855fabe768720dcb4b02 introduced a
result argument to some RTIO callback handlers. Update for the IIS3DWB
sensor.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Process all in one callback, in order to reduce latency.
The following changes have been done:
- Process FIFO read-out and/or Data-ready in GPIO callback.
- FIFO Full is handled on completion if needed.
- Omit fifo-count fetching, to optimize cycles. The watermark
count is the number of samples we're going for.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
By introducing three states: Off -> On -> Busy -> (Offf)
This allows us to more clearly guard on-going events and detect
overlapping triggers.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Since the driver knows how many samples it wants (because of the
watermark threshold), stick to that per event in order to facilitate
batches of N number of samples.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
In order to allow the error-handling scheme to take action, instead
of crashing when asserts are enabled. Now possible since we have RTIO
error handling for streaming mode.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Similar pattern applied to other in-tree sensor drivers, where
preparing a set of SQEs for writing/reading on registers is a recurrent
syntax.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
The IIS3DWB is a system-in-package featuring a 3-axis digital vibration
sensor with low noise over an ultrawide and flat frequency range.
The wide bandwidth, low noise, very stable and repeatable sensitivity,
together with the capability of operating over an extended temperature
range (up to +105 C), make the device particularly suitable for vibration
monitoring in industrial applications.
Datasheet: https://www.st.com/en/mems-and-sensors/iis3dwb.html
This driver is currently only supporting the polling-mode read_and_decode
APIs (both blocking and non-blocking).
This driver is based on stmemsc HAL i/f v2.9.1.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Requesting/releasing QDEC device may be ISR safe, but
it cannot be reliably known whether managing its power
domain is. Is is then assumed that if power domains are used,
device is no longer ISR safe. This macro let's us check if
we will be requesting/releasing power domains and determines
PM device ISR safety value.
Signed-off-by: Michał Stasiak <michal.stasiak@nordicsemi.no>
Add support for runtime and devicetree configuration of themocouple
type, ADC resolution, filter coefficient and cold junction temperature
resolution. Extend device specific sensor channels to include cold
junction temperature, delta tempereature, hot junction temperature and
raw ADC values while still maintaining backwards compability with the
existing SENSOR_CHAN_AMBIENT_TEMP channel.
Signed-off-by: Thomas Schmid <tom@lfence.de>
Explicitly cast data->atime to uint32_t to
prevent signed promotion and sign extension
when multiplying with data->again.
Signed-off-by: Manoj Purushothama <hpmanoj@umich.edu>
Remove the calls to LL_TIM_ENCODER_StructInit and LL_TIM_ENCODER_Init
in the QDEC driver. This avoids calling functions from stm32xxxx_ll_tim.c.
They are replaced by a set of simpler functions from the header file.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
Add missing one-shot conversion logic in sample_fetch when driver is
configured for shutdown mode. Previously, the driver would attempt to
read temperature without triggering conversion, resulting in stale data.
Signed-off-by: Dipak Shetty <shetty.dipak@gmx.com>
Add support for enabling and configuring the self-test mode of the
LIS2DH accelerometer through a dedicated sensor attribute.
Signed-off-by: Arthur Gay <arthur.gay@marshmallow.kids>
Add test for Texas Instruments INA228 current sensor via I2C.
Signed-off-by: Jonas Berg <jonas.s.t.berg@gmail.com>
Signed-off-by: Wilkins White <ww@novadynamics.com>
Add the Texas Instruments INA228 Power/Energy/Charge
monitor. This chip is similar to the INA237, but has
a more precise ADC and added energy/charge channels.
Signed-off-by: Wilkins White <ww@novadynamics.com>