Move GPIO interface to core and switch to cdev #64
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.
This is a complete rewrite of the GPIO backend, moving it into the core, and switching to
cdev
with fallback tosysfs
.Previously it was part of the
gpio
module and was usingwiringpi
, 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