Repository navigation
Add button_e_pressed and include button E in any_button_pressed - #100
Closed
tomahawkeer wants to merge 1 commit into
Closed
tomahawkeer wants to merge 1 commit into
tomahawkeer wants to merge 1 commit into
Conversation
Peripherals.buttons gains a fifth entry for BOOT0 (button E) when the board defines it, but there was no button_e_pressed property and any_button_pressed only checked buttons[0:4], so presses of button E were ignored. - Add button_e_pressed (returns False if the board has no BOOT0) - any_button_pressed now checks every entry in self.buttons Fixes adafruit#98 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FiGQujBCL8qnuH6bAv3Yiz
Author
|
Closing this as a duplicate of #99, which was opened first and is already under review. Sorry for the noise. One thing that may be worth carrying over to #99: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #98
Peripherals.buttonsgets a fifth entry for BOOT0 (button E) when the board defines it, but there was nobutton_e_pressedproperty, andany_button_pressedonly checkedbuttons[0:4], so presses of button E were ignored.Changes
button_e_pressed. It returnsFalsewhen the board has noBOOT0, so existing four-button setups never raise.any_button_pressednow checks every entry inself.buttons(any(not button.value for button in self.buttons)).Testing
Peripheralsagainst stubbedboard/digitalio/analogio/neopixelmodules, both with and withoutboard.BOOT0, pressing each button in turn: allbutton_*_pressedandany_button_pressedresults are correct. On the unpatched code, the same script raisesAttributeError: 'Peripherals' object has no attribute 'button_e_pressed'.ruff checkandruff format --checkpass.🤖 Generated with Claude Code
https://claude.ai/code/session_01FiGQujBCL8qnuH6bAv3Yiz