Skip to content

Fix debounce state machine, examples and update dependencies - #27

Open
maxwase wants to merge 1 commit into
masterfrom
fix/debounce-and-examples
Open

maxwase wants to merge 1 commit into
masterfrom
fix/debounce-and-examples

Conversation

@maxwase

@maxwase maxwase commented Nov 13, 2026

Copy link
Copy Markdown
Owner

Fixes bugs in the button state machine and the examples, and updates all dependencies.

  • Debounce: short glitches no longer count as clicks, and bounce on release no longer splits a click or hold. Counters reset at the start of each new streak.
  • API: adds PinWrapper::try_is_high, so pin read errors are skipped instead of read as presses. The wasm Instant now uses performance.now().
  • Examples: stm32 uses a faster timer with an atomic counter, embassy polls with a Ticker, and wasm catches the release anywhere on the page.
  • Dependencies: all updated, including stm32f1xx-hal 0.11 and embassy-stm32 0.6.

Behavior change: raw_clicks() no longer includes the press still in progress, and counters reset per streak without reset(). A 0.3 version bump may be appropriate.

Tested with the library tests and clippy. The examples compile and link, but have not been run on hardware or in a browser.

🤖 Generated with Claude Code

- Count clicks only for debounced presses; glitches no longer register.
- Debounce the release edge so bounces do not split clicks or holds.
- Reset counters at the start of each streak.
- Add PinWrapper::try_is_high so pin read errors are skipped.
- Use performance.now() for the wasm Instant.
- Add deterministic simulated-clock tests.
- Fix examples: faster atomic timer (stm32), Ticker polling (embassy),
  window-level pointer release (wasm).
- Update all dependencies, including stm32f1xx-hal 0.11 and
  embassy-stm32 0.6.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant