-
Notifications
You must be signed in to change notification settings - Fork 2k
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
cpu/native: Allow Access to Hardware GPIO Pins on Linux #12451
Conversation
This was on my to do list for quite some time, but I never came to id. Thanks for tackling this! |
I'd appreciate that feature, too! Just a short note here, with #11352 being merged now: I think, the definition of |
08f0de4
to
2f10b6d
Compare
If you already have a solution in mind, feel free to send a PR to my native-gpio branch. |
By now, RIOT can only control hardware CS lines, as Linux' userspace SPI API only allows those hard-wired connections. In case of the Raspberry Pi, this is pin CE0 (GPIO8) on However, there is a flag in the SPI API called If that works, it would allow arbitrary GPIOs for CS and also more than two devices. If not, I'd at least separate the number space, so that I'll have a look at it and see if that flag behaves like expected. |
Sorry that it took me so long, testing this with limited access to actual SPI hardware was not that easy. benpicco#4 contains a suggestion to solve the numbering issue between |
No support yet? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't checked all the details but it seems to me that this PR is in quite a good shape. There's just the problem that I see with the module dependency that I think should be changed.
@aabadie your comments seem to be addressed. Care to take another look, please? |
I moved all the unrelated commits to a separate PR: #14663 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now. Please squash.
ACK!
Murdock found a couple of problems. Can you have a look @benpicco ? |
This is a GCC extension. Use hex constant instead.
Rebased to fix the warnings introduced by |
Contribution description
This adds GPIO support for native using the new Linux GPIO API.
Testing procedure
Compile
tests/periph_gpio
for thenative
board on any SBC, e.g. a Raspberry Pi.Run
bin/native/tests_periph_gpio.elf --gpio=/dev/gpiochip0
Please consult your board's manual for the pin mapping. For the Raspberry Pi, this would be
Here, GPIO20 and GPIO21 can be conveniently bridged with a jumper.
Setting and Reading GPIOs should work with this PR already:
For interrupts to work, #12428 is needed:
Issues/PRs references
depends on #12428
supersedes #7530