Skip to content

Revise the Raspberry Pi Pico sample implementation #10

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 7 commits into from
Feb 10, 2025

Conversation

dgoffredo
Copy link
Contributor

I'm using the SCD41 with a Raspberry Pi Pico W, and used this repository's sample implementation as a starting point.

The code in sample-implementations/RaspberryPi_Pico/ has several shortcomings that I aim to correct in this pull request:

  • Rename CMakeLists.txt to have the proper casing.
  • Refer to source and header files relative to the example's directory.
  • Fix syntax errors in main.c.
  • Fix bugs in main.c.
  • Add logging.
  • Add documentation.

This is my first time contributing to this project, so I'm happy to make any changes requested.

@LeonieFierz
Copy link
Member

Dear @dgoffredo

thank you for your pull request and sorry for not getting back earlier to you. Your updates to the Pi Pico sample look good. As we just updated the driver, changing some of the sensor API, it would be nice to update the example to the new version.

If you are ok, I could push those changes on top of your pull request. As I do not have a Raspi Pi Pico at hand, would you be able to test the changes afterwards on the Pi Pico?

Best, Léonie

@LeonieFierz LeonieFierz self-assigned this Feb 3, 2025
@dgoffredo
Copy link
Contributor Author

If you are ok, I could push those changes on top of your pull request. As I do not have a Raspi Pi Pico at hand, would you be able to test the changes afterwards on the Pi Pico?

Yes, go ahead. Then I will test the changes and propose any necessary modifications.

dgoffredo and others added 6 commits February 4, 2025 11:18
- Don't read from an uninitiailized boolean variable.
- Pull up the SCL and SDA pins used for I2C.
- Use sleep_us for higher precision in the HAL.
- Add error logging.
- Increase precision of reported measurement data.
- Remove lengthy sensor self-test.
- Remove unused variables and functions.
- Address any -Wall -Wextra warnings.
update main.c to changed sensor API,
initiaize driver with i2c address,
update signature for sensirion_i2c_hal_read/write
@LeonieFierz
Copy link
Member

@dgoffredo
I did update the Pull Request to the latest driver change. Please not that I had to rebase on the latest master and force-pushed.
It would be great if you can test the Pico sample implementation.
Thank you for your contribution!
Léonie

@dgoffredo
Copy link
Contributor Author

It works! I just tested on my Pico W; works just as the readme says.

@LeonieFierz
Copy link
Member

It works! I just tested on my Pico W; works just as the readme says.

Great, thank you for testing it out!

@LeonieFierz LeonieFierz merged commit 455a41c into Sensirion:master Feb 10, 2025
2 checks passed
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 this pull request may close these issues.

3 participants