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

Move GPIO interface to core and switch to cdev #64

Merged
merged 1 commit into from
Oct 12, 2020
Merged

Conversation

CrazyIvan359
Copy link
Owner

@CrazyIvan359 CrazyIvan359 commented Oct 12, 2020

This is a complete rewrite of the GPIO backend, moving it into the core, and switching to cdev with fallback to sysfs.

Previously it was part of the gpio module and was using wiringpi, which is fine on a Raspberry Pi, but support is spotty at best on other platforms. With the fact that WiringPi is now depreciated, I decided that it would be necessary to migrate to a new GPIO access method. A little research later and I found that there is a new kernel module that can do what I need on any hardware, perfect!

The other change this PR accomplishes is moving the actual GPIO access code out into the MQTTany core. This gets us several improvements. First is allowing any module to access GPIO hardware if they need it (this came from thinking about #46). The pin locking mechanism in MQTTany was a little basic before, now we are checking for kernel module pin reservations and have made it easier for modules to lock pins transparently. Lastly, interrupts are now handled in hardware and the callbacks run on a separate thread, so interrupt performance and accuracy should be much better now.

As a side effect, because the underlying hardware access is always the same now, adding new boards is extremely easy. If you are interested, have a look at the board classes.

The underlying GPIO access is now done through the wonderful periphery library. Seriously, if you need a Swiss Army GPIO Knife, you need periphery!

Fixes #47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request GPIO GPIO Module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch GPIO access to chardev
1 participant