Skip to content

Respect pin's pull in gamepad#733

Merged
tannewt merged 1 commit into
adafruit:masterfrom
pypewpew:gamepad-pull
Apr 2, 2018
Merged

Respect pin's pull in gamepad#733
tannewt merged 1 commit into
adafruit:masterfrom
pypewpew:gamepad-pull

Conversation

@deshipu
Copy link
Copy Markdown

@deshipu deshipu commented Mar 31, 2018

While it is traditional to have buttons on pins that are pulled up, and
have the button connect them to the ground, some CircuitPython boards
(notably the CPX) have the button pins pulled low and the button
connects them to VCC.

This patch makes the gamepad only change the pin's pull if it wasn't
already set when passed to the constructor, and also makes it consider
a button pressed when its value is the opposite of its pull.

While it is traditional to have buttons on pins that are pulled up, and
have the button connect them to the ground, some CircuitPython boards
(notably the CPX) have the button pins pulled low and the button
connects them to VCC.

This patch makes the gamepad only change the pin's pull if it wasn't
already set when passed to the constructor, and also makes it consider
a button pressed when its value is the opposite of its pull.
Copy link
Copy Markdown
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this!

@tannewt tannewt merged commit fc9340c into adafruit:master Apr 2, 2018
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.

2 participants