For all STM32 drivers and SoC, replace the MODIFY_REG macro (defined in
the STM32 HAL) by stm32_reg_modify_bits defined in Zephyr.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
For all STM32 drivers and SoC, replace the READ_REG macro and the
LL_xxx_ReadReg functions (defined in the STM32 HAL) by
stm32_reg_read defined in Zephyr.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
For all STM32 drivers and SoC, replace the READ_BIT macro (defined in
the STM32 HAL) by stm32_reg_read_bits.
Fixes some cases where the return value was tested like a boolean
despite not being one.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
For all STM32 drivers, replace the CLEAR_BIT macro (defined in
the STM32 HAL) by stm32_reg_clear_bits defined in Zephyr.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
For all STM32 drivers, replace the SET_BIT macro (defined in
the STM32 HAL) by stm32_reg_set_bits defined in Zephyr.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
- add driver for Vishay VEML6046 RGBIR color sensor
- add new compatible "vishay,veml6046"
- support fetch and get sensor subsystem operations
- triggered mode and interrupts are not yet supported
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
One-shot reads through Read-Decode API matches functionality
from Fetch-Get API, but asynchronously.
Streaming mode supporting FIFO Watermark Interrupts. Works for both
Gyro and Accel drivers.
These changes are covered under the build-all test for sensor async
api.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
- Add DTS for MAX32664C
- Add driver for MAX32664C
- Add example for MAX32664C Heart rate measurement with Bluetooth
- Add private attributes and channels for health measurement
Closes: #93473
Signed-off-by: Daniel Kampert <DanielKampert@kampis-elektroecke.de>
Fix -Wsometimes-uninitialized warning by initializing data_opt directly
from fifo_wmark_cfg->opt. At this point in the code flow, fifo_wmark_cfg
is guaranteed to be non-NULL because we can only reach this code after
fifo_full_irq is true, which requires fifo_wmark_cfg to be non-NULL.
Added an assertion to document this invariant.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This patch makes the following improvements:
- Helper APIs for simplifying RTIO transfers.
- Simplify RTIO Streaming implementation to reduce processing time.
- Add streaming mode atomic state, in order to track overruning the
callback events generation.
- Add device pointer address to logging on error-occurrences, as it is
useful when the app has multiple instances of the driver (e.g: NXP's
VMU RT1170 has two).
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Wait until the trigger or streaming mode is configured. Otherwise,
rebooting in-between runs may cause multiple callbacks invoked when
the trigger may have not been enabled yet.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
This induces extra-cycles in the encoding path while streaming, which
make it difficult to achieve high-bandidth performance. The use-case
being dealt with involves cranking the IMU at 8000 ODR in batches of
1.25 ms (10 samples at 800 Hz).
Signed-off-by: Luis Ubieda <luisf@croxel.com>
As it introduces latencies due to switching to the threads pool.
Moreover, this is not required for streaming as it executes in a
non-blocking path.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Based on performance observed when cranking the sensor at +1000 Hz ODR,
otherwise is not able to keep up with the pace.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Use build assert to check counts_per_revolution DTS value compile time to
prevent runtime failure and also decrease flash usage slightly.
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
Change HDC_302X_TEMP_OFFSET_SCALE and HDC_302X_HUMIDITY_OFFSET_SCALE
from float literals to double literals to avoid implicit conversion
warnings when compiling with clang and -Wdouble-promotion flag.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The HDC302X sensor driver is added,
you can use this driver to read temperature and humidity.
Also set an offset, upper and lower limits to get warned
when temperature or humidity get out of band.
The sensor is build for ultra low power applications.
Signed-off-by: COUSSEMENT Stijn <stijn.coussement@psicontrol.com>
Reduce floating-point operations in the nxp_pmc_tmpsns.
Provide new calculation method without floating-point operations.
Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
The max30101 allows to configure time slots in samples acquisition.
It is now supported by adding matrix mapping for the slot/fifo
indexing. When a channel is present multiple times, the resulting
sample from the `sensor_channel_get` is averaging each entry.
Added Die temperature sample acquisition with
`CONFIG_MAX30101_DIS_TEMPERATURE` Kconfig.
Signed-off-by: Logan Saint-Germain <l.saintgermain@catie.fr>
The max30101 sensor driver doesn't support triggers.
Add `.trigger_set` API and corresponding Kconfig and
device tree parameters. Add `SENSOR_CHAN_AMBIENT_LIGHT`
and `SENSOR_TRIG_OVERFLOW`.
Signed-off-by: Logan Saint-Germain <l.saintgermain@catie.fr>
The max30101 sensor driver doesn't support multiple instance.
Update Kconfig and maxim,max30101.yaml for instance based
configuration. Propagate changes over existing files.
Signed-off-by: Logan Saint-Germain <l.saintgermain@catie.fr>
The size of icm45686_encoded_data fifo_payload is guaranteed
to span the full number of frames read as it was allocated during
icm45686_event_handler() buf_len_required size.
This update suppresses the static analysis warning of
out of bounds memory access at index 1 by explicitly declaring
fifo_payload to be a VLA at the end of icm45686_encoded_data.
Signed-off-by: Anthony Williams <anthony289478@gmail.com>
Change the __ASSERT on unsupported fifo packet header to
CHECKIF so the user can choose how to handle the invalid
packet.
Signed-off-by: Anthony Williams <anthony289478@gmail.com>
When operating in streaming mode, a FIFO empty event, which
is caused by host reading the last byte of the last FIFO frame,
can cause FIFO data corruption.
During subsequent reads to the FIFO, the first frame that arrives
after the empty condition will be corrupted. Once the issue occurs,
the internal state cannot recover and the FIFO must be flushed in
bypass mode to clear the corrupted state.
The current workaround from TDK is to read M-1 frames when M frames
are reported by fifo_count. Since M is fixed by the fifo_watermark
DT parameter, and in cases where fifo_watermark == 1, the watermark
trigger threshold is set to M + 1 frames and M frames are read out
during a watermark threshold event.
Signed-off-by: Anthony Williams <anthony289478@gmail.com>
When an unsupported fifo packet triggers an assert, it is
helpful to see the packet as a hex value to help when debugging.
Signed-off-by: Anthony Williams <anthony289478@gmail.com>
Add driver for Allegro Microsystems ALS31300 3-axis linear Hall Effect
sensor. The driver supports:
- I2C communication interface
- X, Y, Z magnetic field measurements
- Device temperature readings
Signed-off-by: Fabian Barraez <fabianbarraez@gmail.com>
Update the temperature data processing to
handle different data sizes based on FIFO configuration.
The temperature sensor data size and conversion
formula vary depending on the FIFO mode:
1. FIFO disabled: Uses 20-bit data format
2. FIFO enabled (standard resolution): 16-bit data
3. FIFO enabled (high resolution): 20-bit data
The implementation now:
- Uses the 'fifo_highres_enabled' flag
to determine the correct data size
- Applies the appropriate conversion formula
based on the resolution mode
- Handles all three possible FIFO configurations
- Ensures accurate temperature readings in all modes
Signed-off-by: Shreehari HK <shreehari.hk@alifsemi.com>
Move the watermark threshold trigger mode to a configurable dt boolean.
When using the default configuration of watermark threshold
interrupt greater than or equals, extra interrupts are serviced
to icm45686_event_handler().
When `fifo-watermark-equals;` is added to the sensor DT overlay,
the new behavior is only one interrupt is generated per watermark
threshold crossing. Until the host drains the fifo, no extra interrupts
will be generated.
Signed-off-by: Anthony Williams <anthony289478@gmail.com>
Issue:
- The calibration value had the correct elements but false operations
- This leads to wrong values or even saturation
Changes:
- Added explenation of formula
- Moved constant from MACRO into formula to get rid of the
confusing 10000000ULL constant
- Added rounding for better results
Signed-off-by: Martin Koehler <koehler@metratec.com>
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>