-
Notifications
You must be signed in to change notification settings - Fork 696
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
Add a button HAL and corresponding drivers #169
Add a button HAL and corresponding drivers #169
Conversation
We had a discussion on an earlier version of this branch didn't we? Was trying to find it so we can link to it and followup. |
8764a8a
to
5a35abb
Compare
5a35abb
to
96775af
Compare
Closing this till further notice |
0c8f88c
to
0828767
Compare
I have done a major rework of this pull and I am re-opening it. Now uses the GPIO HAL, so basically if a device supports the GPIO HAL, it automatically also supports buttons. I am editing the OP to reflect recent changes. Tested with Launchpad/CC2650, zoul/firefly, zoul/remote-reva. More testing to come. Help with testing welcome. |
e5bd8c4
to
192a809
Compare
192a809
to
96e6b10
Compare
(Not all boards have sensors)
This change is temporary so travis can pass until all platforms have been migrated to the new API
96e6b10
to
4882077
Compare
Removed support for the optional polarity resource to simplify the code.
61fdc0c
to
58ee17c
Compare
58ee17c
to
a8c9931
Compare
After a chat with @nfi last night:
Tested on launchpad/cc2650 and zoul/remote-reva |
I have tested the ipso-object example on Zolertia Firefly with button CoAP notifications up to Leshan and I think everything looks good. |
Can we like merge this? :) |
Yes, let's get it in! I updated branch now - can do the merge after that. |
This pull proposes a platform-independent button API (and corresponding example) that has the following key features:
Provides a uniform way to determine button-related events (which are no longer a
sensors_event
).button_hal_press_event
)button_hal_release_event
)button_hal_periodic_event
). (I did consider making the period configurable, but I think it's over-design.).This allows us to do something on button press, something else on continuous press for 5 seconds, something yet different on release.
Supports an arbitrary number of buttons.
Handles software debounce internally, on press as well as on release.
The PR assumes that a platform already supports the new GPIO HAL. Platform developers/maintainers only need to define their platform's buttons, using a single macro call. Something as simple as:
This design brings a number of benefits:
simplesingle button API to examplesos/
as to how many buttons a platform will have, nor of what the symbol names will be.Platforms currently supported: