Skip to content

drivers/abp2: add abp2 driver #20398

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
May 4, 2025
Merged

Conversation

dpproto
Copy link
Contributor

@dpproto dpproto commented Feb 16, 2024

Contribution description

  • Add a driver for ABP2 Honeywell pressure and temperature series.
  • Implement a SAUL interface.
  • Support the SPI version, but not the I2C version (I don't have that one). However, prepare the code for easy I2C support.
  • Document the code.

Testing procedure

Use the test application in RIOT/tests/drivers/abp2.

Output of the test application:

=========================
        Measuring
=========================
Pressure range = 0 .. 160000
Data:            0.0003 Bar
Data:            17.151 °C 
Data:            0.0003 Bar
Data:            17.777 °C 
Data:            0.0003 Bar
Data:            17.207 °C
------------------------------
Switch to blocking mode
------------------------------
Data:            0.0003 Bar
Data:            17.111 °C
Data:            0.0003 Bar
Data:            17.180 °C
Data:            0.0003 Bar
Data:            17.139 °C
------------------------------
Switch to SAUL mode
------------------------------

Dev: Pressure sensor (abp2)     Type: SENSE_PRESS
Data:            0.0003 Bar

Dev: Temperature sensor (abp2)  Type: SENSE_TEMP
Data:            17.180 °C

Dev: Pressure sensor (abp2)     Type: SENSE_PRESS
Data:            0.0003 Bar

Dev: Temperature sensor (abp2)  Type: SENSE_TEMP
Data:            17.220 °C

Dev: Pressure sensor (abp2)     Type: SENSE_PRESS
Data:            0.0003 Bar

Dev: Temperature sensor (abp2)  Type: SENSE_TEMP
Data:            17.166 °C
------------------------------
Switch to non-blocking mode
------------------------------
Data:            0.0003 Bar
Data:            17.247 °C
Data:            0.0003 Bar
Data:            17.201 °C
Data:            0.0003 Bar
Data:            17.175 °C
------------------------------
Switch to blocking mode
------------------------------

Issues/PRs references

Fixes #20233

@github-actions github-actions bot added Area: doc Area: Documentation Area: tests Area: tests and testing framework Area: drivers Area: Device drivers Area: Kconfig Area: Kconfig integration labels Feb 16, 2024
@dpproto dpproto force-pushed the 20233-add-abp2-driver branch from 1a59f06 to fcb2d07 Compare February 19, 2024 10:52
Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution, that's a nice first driver!
Some comments:

@dpproto dpproto force-pushed the 20233-add-abp2-driver branch 4 times, most recently from e2c4682 to cba1b60 Compare February 20, 2024 14:47
@dpproto dpproto force-pushed the 20233-add-abp2-driver branch 3 times, most recently from 549c360 to 5230483 Compare March 11, 2024 08:12
@kfessel kfessel changed the title 20233 add abp2 driver drivers/abp2: add abp2 driver Mar 13, 2024
@kfessel
Copy link
Contributor

kfessel commented Mar 13, 2024

your commits messages will need rewording

https://github.com/RIOT-OS/RIOT/blob/master/CONTRIBUTING.md#commit-conventions

@dpproto
Copy link
Contributor Author

dpproto commented Mar 14, 2024

your commits messages will need rewording

https://github.com/RIOT-OS/RIOT/blob/master/CONTRIBUTING.md#commit-conventions

Could you be more accurate ?

@dpproto dpproto force-pushed the 20233-add-abp2-driver branch from 5230483 to 0e61666 Compare March 14, 2024 19:37
@kfessel
Copy link
Contributor

kfessel commented Mar 18, 2024

your commits messages will need rewording
https://github.com/RIOT-OS/RIOT/blob/master/CONTRIBUTING.md#commit-conventions

Could you be more accurate ?

Each commit should target changes of specific parts/modules of RIOT. The commits use the following pattern:

area of code: description of changes

You can use multi-line commit messages if you want to detail more the changes. For example:

periph/timer: Document that set_absolute is expected to wrap

Most timers are implemented this way already, and keeping (documenting)
it that way allows the generic timer_set implementation to stay as
simple as it is.

so you commit messages should be for example

driver/abp2: driver for SPI sensors prepare for I2C

tests/driver/abp2: test implementation

or something similar

the scheme is <arena of work>: <description>

@dpproto dpproto force-pushed the 20233-add-abp2-driver branch from 0e61666 to 93c1983 Compare March 18, 2024 12:38
@kfessel
Copy link
Contributor

kfessel commented Aug 14, 2024

Why?

Why should we Block that usecase (one might have a mix of both in one experiment or just have multiple sensors) the design hints just point into the direction of there will only be one sensor

simple example speed/flow (pito) and pressure measurement would need one differential and one absolute sensor (or two absolute) (ofcause these can be two spi (different cs), but with these hints i2c would not work (neither 2 i2c sensors nor can it be combined with spi)).

@dpproto
Copy link
Contributor Author

dpproto commented Sep 3, 2024

I feel a little uncomfortable with the i2c integration hints (code) and pseudo_module, please remove. Talked to other maintainers and we seem to align on that. The comments "i2c communication should go here" -even though it is obvious ( everywhere where spi is called i2c would also be)- is ok for me.

I didn't make up the pseudo-module thing myself; I was advised to do so by a maintainer. I spent quite some time on this driver, which is OK, because I like to return some effort to the open source community. Despite the long period of inactivity in this PR, I could do minor changes, like the timer stuff. But changing the pseudo-module structure would take me much more time (I didn't work with RIOT for a while), with the risk that some other maintainer asks to reestablish it when I'm done.

* implementation wise it would be better to be able to use spi and i2c the at the same time -> the current hints are not the right direction (the module would provide either one or the other interface and work only for one i2c adress.

* at some places this will seem like this driver supports i2c (eg if you list available modules) but it isn't -- this leads to: "hey RIOT supports abp2-i2c" -- "just the implementation is missing".

* since you do not intend to write it, it will probably not exist.

OK, the I2C version is not implemented, but I may do it later, because I will probably buy an I2C sensor in a future project. I just don't know when. I understand that you strive for high quality standards, but you know the saying, the best is the enemy of the good. In the end, I'm afraid this driver will only be used by me.

If you want to hint: "hey the is something open TODO" write a TODO

@dpproto dpproto force-pushed the 20233-add-abp2-driver branch 2 times, most recently from bb67bc7 to 193a70f Compare March 5, 2025 07:37
@dpproto dpproto force-pushed the 20233-add-abp2-driver branch from 193a70f to e930756 Compare April 4, 2025 12:12
@crasbe crasbe added the Type: new feature The issue requests / The PR implemements a new feature for RIOT label Apr 4, 2025
Copy link
Contributor

@kfessel kfessel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are some hints to improve this code without implementing i2c.

I resolve the old comments about the same thing.

If you like me to ignore these please leave a comment

@dpproto dpproto force-pushed the 20233-add-abp2-driver branch from e930756 to ba386fd Compare April 4, 2025 14:14
@dpproto dpproto force-pushed the 20233-add-abp2-driver branch 2 times, most recently from 6551e65 to 1dfbd0f Compare April 7, 2025 12:13
@crasbe
Copy link
Contributor

crasbe commented Apr 7, 2025

The failing tests on mobi3 are not caused by your code, the build server is currently having issues.

Copy link
Contributor

@kfessel kfessel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some minor changes

@dpproto dpproto force-pushed the 20233-add-abp2-driver branch from 1dfbd0f to edaeda4 Compare April 7, 2025 14:22
Copy link
Contributor

@kfessel kfessel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the driver ztimer_msec needs to be switched to ztimer_usec

If you like to squash the two driver commits you may.

@dpproto dpproto force-pushed the 20233-add-abp2-driver branch from edaeda4 to 71a940d Compare April 8, 2025 07:12
Copy link
Contributor

@kfessel kfessel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good to go
trusting test run by @dpproto

@dpproto dpproto force-pushed the 20233-add-abp2-driver branch from 71a940d to 42aa0b0 Compare April 10, 2025 07:38
dpproto added 4 commits May 4, 2025 10:28
Honeywell ABP2 pressure sensors series.
Implement all sensors features, only supporting the SPI version
of the sensor.
Prepare future support for the I2C interface by emphasizing where
to implement the code that will support the I2C bus version.
Use pseudomodules to add a dependency on the relevant feature:
periph_spi if the abp2_spi pseudomodule is selected,
or periph_i2c if the abp2_i2c pseudomodule is selected.
@dpproto dpproto force-pushed the 20233-add-abp2-driver branch from 42aa0b0 to 2c97a53 Compare May 4, 2025 08:30
@maribu maribu added this pull request to the merge queue May 4, 2025
Merged via the queue into RIOT-OS:master with commit 0f171d6 May 4, 2025
25 checks passed
@dpproto dpproto deleted the 20233-add-abp2-driver branch May 5, 2025 07:56
@Teufelchen1 Teufelchen1 added this to the Release 2025.07 milestone Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: doc Area: Documentation Area: drivers Area: Device drivers Area: SAUL Area: Sensor/Actuator Uber Layer Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add driver for Honeywell ABP2 series pressure sensors
7 participants