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

drivers/abp2: add abp2 driver #20398

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

dpproto
Copy link

@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
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:

drivers/abp2/abp2.c Outdated Show resolved Hide resolved
drivers/abp2/abp2.c Outdated Show resolved Hide resolved
drivers/abp2/abp2.c Outdated Show resolved Hide resolved
drivers/abp2/abp2.c Outdated Show resolved Hide resolved
drivers/abp2/abp2.c Outdated Show resolved Hide resolved
drivers/include/abp2.h Outdated Show resolved Hide resolved
drivers/include/abp2.h Outdated Show resolved Hide resolved
drivers/include/abp2.h Outdated Show resolved Hide resolved
tests/drivers/abp2/main.c Outdated Show resolved Hide resolved
tests/drivers/abp2/setenv.venv Outdated Show resolved Hide resolved
@dpproto dpproto force-pushed the 20233-add-abp2-driver branch 4 times, most recently from e2c4682 to cba1b60 Compare February 20, 2024 14:47
drivers/abp2/abp2.c Outdated Show resolved Hide resolved
drivers/include/abp2.h Outdated Show resolved Hide resolved
drivers/abp2/abp2_saul.c Outdated Show resolved Hide resolved
drivers/abp2/abp2_saul.c Outdated Show resolved Hide resolved
@dpproto dpproto force-pushed the 20233-add-abp2-driver branch 3 times, most recently from 549c360 to 5230483 Compare March 11, 2024 08:12
tests/drivers/abp2/main.c Outdated Show resolved Hide resolved
tests/drivers/abp2/main.c Outdated Show resolved Hide resolved
@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
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 ?

@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>

tests/drivers/abp2/main.c Outdated Show resolved Hide resolved
drivers/include/abp2.h Outdated Show resolved Hide resolved
drivers/include/abp2.h Outdated Show resolved Hide resolved
drivers/include/abp2.h Outdated Show resolved Hide resolved
@github-actions github-actions bot added the Area: SAUL Area: Sensor/Actuator Uber Layer label Mar 21, 2024
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.

aside from the leftover in the test app this seems good to go

please provide current test results from the current version starting at shell prompt
(I don't have the hardware to test)

tests/drivers/abp2/main.c Outdated Show resolved Hide resolved
tests/drivers/abp2/main.c Outdated Show resolved Hide resolved
@dpproto
Copy link
Author

dpproto commented Mar 22, 2024

aside from the leftover in the test app this seems good to go

That's good news!

please provide current test results from the current version starting at shell prompt (I don't have the hardware to test)

What do you mean? What about the program output in the 1st message of this thread?

@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Mar 22, 2024
@kfessel
Copy link
Contributor

kfessel commented Mar 22, 2024

aside from the leftover in the test app this seems good to go

That's good news!

please provide current test results from the current version starting at shell prompt (I don't have the hardware to test)

What do you mean? What about the program output in the 1st message of this thread?

i see you updated it ( 1h ago there where non english words in it )

@riot-ci
Copy link

riot-ci commented Mar 22, 2024

Murdock results

✔️ PASSED

b7198cc tests/drivers/abp2: test implementation

Success Failures Total Runtime
10025 0 10026 10m:15s

Artifacts

drivers/include/abp2.h Outdated Show resolved Hide resolved
drivers/include/abp2.h Outdated Show resolved Hide resolved
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 static tests ci style things

tests/drivers/abp2/main.c Outdated Show resolved Hide resolved
tests/drivers/abp2/main.c Outdated Show resolved Hide resolved
tests/drivers/abp2/main.c Outdated Show resolved Hide resolved
tests/drivers/abp2/main.c Outdated Show resolved Hide resolved
tests/drivers/abp2/main.c Outdated Show resolved Hide resolved
tests/drivers/abp2/main.c Outdated Show resolved Hide resolved
drivers/abp2/abp2.c Outdated Show resolved Hide resolved
drivers/abp2/abp2.c Outdated Show resolved Hide resolved
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.
@kfessel
Copy link
Contributor

kfessel commented Mar 25, 2024

diff --git a/tests/drivers/saul_drivers/Makefile b/tests/drivers/saul_drivers/Makefile
index c729dc575e..da6d708ee5 100644
--- a/tests/drivers/saul_drivers/Makefile
+++ b/tests/drivers/saul_drivers/Makefile
@@ -53,6 +53,9 @@ ifneq (,$(filter vl6180x,$(DRIVERS)))
   USEMODULE += vl6180x_als
   USEMODULE += vl6180x_rng
 endif
+ifneq (,$(filter abp2,$(DRIVERS)))
+  USEMODULE += abp2_spi
+endif
 
 USEMODULE += saul_default

@dpproto
Copy link
Author

dpproto commented Mar 25, 2024

diff --git a/tests/drivers/saul_drivers/Makefile b/tests/drivers/saul_drivers/Makefile
index c729dc575e..da6d708ee5 100644
--- a/tests/drivers/saul_drivers/Makefile
+++ b/tests/drivers/saul_drivers/Makefile
@@ -53,6 +53,9 @@ ifneq (,$(filter vl6180x,$(DRIVERS)))
   USEMODULE += vl6180x_als
   USEMODULE += vl6180x_rng
 endif
+ifneq (,$(filter abp2,$(DRIVERS)))
+  USEMODULE += abp2_spi
+endif
 
 USEMODULE += saul_default

Should I apply these changes and force push?

Also, I noticed that entries in this file are sorted. So these lines should be added further up in the file.

@kfessel
Copy link
Contributor

kfessel commented Mar 25, 2024

Should I apply these changes and force push?

yes (problem noticed by murdock)

Also, I noticed that entries in this file are sorted. So these lines should be added further up in the file.

please add the lines where they belong - good you noticed

@kfessel
Copy link
Contributor

kfessel commented Mar 25, 2024

btw are you also working towards i2c support?

@dpproto
Copy link
Author

dpproto commented Mar 25, 2024

btw are you also working towards i2c support?

I have no plan to do so because I don't have a I2C version at hand.

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add driver for Honeywell ABP2 series pressure sensors
4 participants