Skip to content

Fixes Input/Output Error with occasional button reads #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 23, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion adafruit_featherwing/minitft_featherwing.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,12 @@ def buttons(self):
"""
Return a set of buttons with current push values
"""
button_values = self._ss.digital_read_bulk(self._button_mask)
try:
button_values = self._ss.digital_read_bulk(self._button_mask)
except OSError:
return Buttons(*[False for button in
(BUTTON_UP, BUTTON_DOWN, BUTTON_LEFT, BUTTON_RIGHT,
BUTTON_A, BUTTON_B, BUTTON_SEL)])
return Buttons(*[not button_values & (1 << button) for button in
(BUTTON_UP, BUTTON_DOWN, BUTTON_LEFT, BUTTON_RIGHT,
BUTTON_A, BUTTON_B, BUTTON_SEL)])