Skip to content

BMP581: Stream: Add FIFO Watermark Support #93166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 25, 2025

Conversation

ubieda
Copy link
Member

@ubieda ubieda commented Jul 15, 2025

Description

This PR is a follow-on effort to #93130 in which FIFO Watermark support is added on top of Streaming, and is configurable through fifo-watermark DTS property.

Testing

  • Build Command
west build -b frdm_mcxn947/mcxn947/cpu0 samples/subsys/shell/shell_module -- -DCONFIG_SENSOR=y -DCONFIG_SENSOR_SHELL=y -DCONFIG_I2C_SHELL=y -DCONFIG_SENSOR_SHELL_STREAM=y
  • Overlay
#include <zephyr/dt-bindings/sensor/bmp581.h>

&flexcomm2_lpi2c2 {
	status = "okay";

	bmp581:bmp581@46 {
		compatible = "bosch,bmp581";
		reg = <0x46>;
		status = "okay";
		odr = <BMP581_DT_ODR_10_HZ>;
		press-osr = <BMP581_DT_OVERSAMPLING_1X>;
		temp-osr = <BMP581_DT_OVERSAMPLING_1X>;
		int-gpios = <&gpio0 29 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
		fifo-watermark = <10>;
	};
};
  • Output
uart:~$ sensor stream bmp581@46 on fifo_wm incl
Disabling existing stream
Enabling stream...
Trigger (10 / fifo_wm) detected
channel type=13(ambient_temp) index=0 shift=15 num_samples=10 value=60481891090ns (23.896118)
channel type=14(press) index=0 shift=15 num_samples=10 value=60481891090ns (101.374755)
Trigger (10 / fifo_wm) detected
channel type=13(ambient_temp) index=0 shift=15 num_samples=10 value=61478180456ns (23.891021)
channel type=14(press) index=0 shift=15 num_samples=10 value=61478180456ns (101.375274)
Trigger (10 / fifo_wm) detected
channel type=13(ambient_temp) index=0 shift=15 num_samples=10 value=62474455063ns (23.902160)
channel type=14(press) index=0 shift=15 num_samples=10 value=62474455063ns (101.376113)
uart:~$ sensor stream bmp581@46 off
Disabling existing stream
[00:15:21.449,000] <wrn> BMP581_STREAM: Callback triggered with no streaming submission - Disabling interrupts

@ubieda ubieda added the DNM This PR should not be merged (Do Not Merge) label Jul 15, 2025
@ubieda ubieda changed the title bmp581: stream: Add FIFO Watermark Support BMP581: Stream: Add FIFO Watermark Support Jul 15, 2025
@ubieda ubieda force-pushed the bmp581/fifo-wm-support branch 2 times, most recently from faa9f02 to bba0620 Compare July 15, 2025 22:07
@ubieda ubieda requested a review from bperseghetti July 15, 2025 22:44
@zephyrbot zephyrbot added the area: Sensors Sensors label Jul 17, 2025
teburd
teburd previously approved these changes Jul 17, 2025
bperseghetti
bperseghetti previously approved these changes Jul 19, 2025
ubieda added 2 commits July 23, 2025 15:01
Otherwise it leads to potential incorrect expansions.

Signed-off-by: Luis Ubieda <[email protected]>
Usually, drivers failing to initialize throw a message in the log,
signaling the cause of failure. Add it to this driver so the user
isn't confused by no message yet the device being marked as disabled.

Signed-off-by: Luis Ubieda <[email protected]>
@ubieda ubieda dismissed stale reviews from bperseghetti and teburd via 967ce61 July 23, 2025 20:59
@ubieda ubieda force-pushed the bmp581/fifo-wm-support branch from bba0620 to 967ce61 Compare July 23, 2025 20:59
@ubieda
Copy link
Member Author

ubieda commented Jul 23, 2025

Waiting on resolution on #93624 to decide whether to leave the closing else {} after every else if {}

@ubieda ubieda marked this pull request as ready for review July 23, 2025 21:23
ubieda added 2 commits July 24, 2025 12:17
Configurable through dts property: fifo-watermark.

Signed-off-by: Luis Ubieda <[email protected]>
Remove extra-parentheses when operator precedence is implicit.
Eliminate implicit integer to boolean conversions.

Signed-off-by: Luis Ubieda <[email protected]>
@ubieda ubieda force-pushed the bmp581/fifo-wm-support branch from 967ce61 to db8c79d Compare July 24, 2025 16:20
@ubieda
Copy link
Member Author

ubieda commented Jul 24, 2025

In addition to optimizing the if-else, I added a separate patch to improve code-style in this module to remove extra-parentheses + remove implicit integer to boolean conversions.

Copy link

@ubieda ubieda removed the DNM This PR should not be merged (Do Not Merge) label Jul 24, 2025
@kartben kartben merged commit 1725408 into zephyrproject-rtos:main Jul 25, 2025
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants