aindustriosa / RustyBugA

Firmware for the MightyBugA line follower done in Rust programming language
MIT License
5 stars 3 forks source link

Button controller #30

Closed rafacouto closed 5 months ago

rafacouto commented 6 months ago

It's needed a button controller implementing this basic trait functions:

The implementation should allow to specify if the button is hardware pulled down (gpio low/float) or up (gpio float/high) to manage with the right logic:

rafacouto commented 6 months ago

The #31 code includes a simple implementation of ButtonController in Button struct as a simple button that includes a last_state field in order to know where the hardware gpio changes the state. A future complex implementation should manage the state changes via hardware interrupt.

An example for mithybuga board is included:

https://github.com/aindustriosa/RustyBugA/assets/969061/2bbd2082-b8e8-44d6-b7d3-f15f4a3d9292