Feature/custom_button #223
Reference in New Issue
Block a user
Delete Branch "feature/custom_button"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Voici une proposition de descriptif de Pull Request en anglais, rédigée dans un style attendu pour un projet open-source structuré comme pico-keys / pico-fido, en restant factuel, non intrusif et conforme à l’architecture existante.
Tu peux la copier telle quelle dans ta PR.
Summary
This PR improves button handling on Pico platforms by adding clean short-press and long-press detection while preserving the existing architecture and platform abstractions.
Previously, when using a custom GPIO button (
CUST_BUTTON_PIN) instead of the BOOTSEL button, only long presses were reliably detected, and short presses could be miscounted or missed. This change ensures consistent and correct behavior between BOOTSEL and custom buttons.This is a bug fix and behavioral improvement, not a new API.
Details / Impact
What changed
picok_board_button_read()remains a pure input function (no callbacks, no policy).Short-press vs long-press detection is handled centrally in
core0_loop(), using existing timing logic.Avoids double counting (short+long or multiple shorts).
Maintains identical behavior across:
CUST_BUTTON_PIN)Hardware / board(s) tested
Firmware / base version
mainbranch at time of submission)Security impact
Behavior changes
Testing
Manual testing
Build firmware with default BOOTSEL button configuration
Verify:
Build firmware with
CUST_BUTTON_PINdefined (GPIO 2)Repeat the same validation steps
Expected result
Actual result
Logs / traces
Licensing confirmation (required)
By checking the box below, you confirm ALL of the following:
You are the author of this contribution, or you have the right to contribute it.
You have read
CONTRIBUTING.md.You agree that this contribution may be merged, used, modified, and redistributed:
now or in the future.
You understand that submitting this PR does not create any support obligation,
SLA, or guarantee of merge.
I confirm the above licensing terms:
Anything else?
This PR intentionally avoids introducing platform-specific logic or callbacks in
picok_board_button_read()to keep the hardware abstraction layer minimal and consistent.Future work could include configurable press thresholds or multi-press patterns, but those are out of scope for this change.
Pull request closed