How aaronzhouciph/multibutton works
MultiButton is a small C library for debouncing button inputs and detecting press, click, repeat, and long-press events. The main workflow is: an application initializes and starts button instances, a periodic timer calls button_ticks(), and the library samples GPIO levels, filters changes, advances each instance’s state machine, and invokes registered callbacks. Applications can alternatively poll event and button state. The README documents these capabilities; the graph’s implementation links are limited to the sampled core source.
Main entry points: multi_button.c Tick Dispatcher · multi_button.h Button Instance
Components 11
Instance Setup
- Button Instance
multi_button.h - Initialize Button
multi_button.c - Callback Registry
multi_button.c
Button Runtime
- Active Button List
multi_button.c - Tick Dispatcher
multi_button.c - Debounce And FSM
multi_button.c
Events And Queries
- Event Callbacks
multi_button.c - Event And State Queries
multi_button.c
Other components
- Application
- GPIO Reader
- Periodic Timer
Connections 12
- Application → Initialize Button: initializes
README.md - Initialize Button → Button Instance: sets fields
multi_button.c - Application → Callback Registry: registers handlers
README.md - Application → Active Button List: starts instance
multi_button.c - Periodic Timer → Tick Dispatcher: calls every 5ms
README.md - Tick Dispatcher → Active Button List: iterates
multi_button.c - Tick Dispatcher → Debounce And FSM: dispatches handler
multi_button.c - Debounce And FSM → GPIO Reader: reads level
multi_button.c - Debounce And FSM → Event Callbacks: invokes events
multi_button.c - Event Callbacks → Application: calls handler
multi_button.c - Application → Event And State Queries: polls state
README.md - Event And State Queries → Button Instance: reads fields
multi_button.c