Add rp2 override_invert#19336
Open
HighImp wants to merge 2 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19336 +/- ##
=======================================
Coverage 98.51% 98.51%
=======================================
Files 176 176
Lines 22903 22903
=======================================
Hits 22562 22562
Misses 341 341 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Code size report: |
39dc0ed to
2a61d4e
Compare
added 2 commits
June 12, 2026 23:49
Add Pin.init(invert=...) support that sets gpio_set_inover() and gpio_set_outover() together. Includes a regression test. Signed-off-by: Sebastian Koell <Seb.Koell@gmail.com>
Signed-off-by: Sebastian Koell <Seb.Koell@gmail.com>
2a61d4e to
9c4b9fd
Compare
Octoprobe PR report
FailuresGroup: run-tests.py
Group: run-tests.py --via-mpy --emit native
Group: run-tests.py --via-mpy
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
For some applications, inversion will be a hardware solution for otherwise inverted logic, avoiding software-side inversion and related issues (buttons, low-side LEDs, etc.), as described in the RST. However, I love the fact that it will also affect alternative functions. For example, hardware-side inversion will allow half-duplex UART communication with open-collector and an N-channel low-side driver without any restrictions, based on the hardware UART.
Testing
I added a simple test that checks input and output with and without inversion.
Trade-offs and Alternatives
I am not sure about the code increase; however, this is a local change for the RP2xxx, and will not affect very small controllers. It is worth it because it will make the code for some common hardware designs much easier.
It would be possible to split it further into invert_in and invert_out, but i think the total inversion is much more common than just one direction.
Generative AI
I used generative AI tools when creating this PR, but a human has checked the code and is responsible for the code and the description above. I built it locally and ran the test on my hardware. I did run this through a spellchecker, though, but this is handwritten. ;-)