Skip to content
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

Add driver for Honeywell ABP2 series pressure sensors #20233

Open
dpcrd opened this issue Jan 5, 2024 · 4 comments · May be fixed by #20398
Open

Add driver for Honeywell ABP2 series pressure sensors #20233

dpcrd opened this issue Jan 5, 2024 · 4 comments · May be fixed by #20398

Comments

@dpcrd
Copy link

dpcrd commented Jan 5, 2024

Description

I would like to use the ABP2 series pressure sensors. This series covers a wide range of sensors, but they all share a common software interface, leveraging the driver code.

They come with 2 interfaces : either SPI or I2C.

Useful links

@dpcrd
Copy link
Author

dpcrd commented Jan 5, 2024

As the interface of these sensors is either SPI or I2C, what is the best strategy to handle dependencies ? For example, FEATURES_REQUIRED += periph_i2c in Makefile.dep doesn't make sense if you want to use the SPI flavor.

@dpproto
Copy link

dpproto commented Feb 2, 2024

I'm taking over this issue from another GitHub account.

I mostly wrote the SPI driver. I need to do some clean-up.

In the meantime, any idea of how to support SPI and I2C in the same driver the clean way ?

@maribu
Copy link
Member

maribu commented Feb 15, 2024

In the meantime, any idea of how to support SPI and I2C in the same driver the clean way ?

This depends a bit on the use case. If it makes no sense to have multiple instances of the same device with different interfaces attached, one could go do it the same as e.g. the BMP280/BME280 driver did with the bmx280_spi module selecting the SPI flavor and the bmx280_i2c selecting the I2C flavor of the driver.

If it would make sense to allow using both, IMO the cleanest would be to split the code over three modules, e.g. abp2_spi for the SPI communication, abp2_i2c for the I2C communication, and abp2_common for conversions, logic etc. The idea would be that abp2_i2c and abp2_spi would be as lean as possible and most of the code would be shared between the two.

@dpproto
Copy link

dpproto commented Feb 16, 2024

I got a similar answer from a maintainer of the project in the forum.
https://forum.riot-os.org/t/how-to-write-a-driver-for-a-sensor-with-either-spi-or-i2c-interface/4102/2

@dpproto dpproto linked a pull request Feb 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants