Skip to content

Conversation

@dmadison
Copy link
Owner

@dmadison dmadison commented Mar 7, 2019

Small pull request to change the button press/release/set functions to use an unsigned integer (uint8_t) rather than an enumerated control as an argument.

This lets the user press button numbers per their numbered listing in joy.cpl rather than using the enumerated values. It also lets them iterate through the button list without explicitly casting the enumeration as an XInputControl, which is easier to write. And since the control enumeration isn't scoped, this should cause no issues with passing enumerated values like normal.

This pull request also disables joysticks by default in the GamepadPins example, which means it will work properly on a bare Leonardo even if the user doesn't attach two joysticks to the analog pins.

dmadison added 2 commits March 6, 2019 01:17
This allows the user to pass a button number or iterate through them without having to explicitly cast to the enum type (XInputControl). The function will still take an enum value without complaint, this just makes it more flexible.
If the user uploads this without any joysticks connected, the inputs float and bounce all over the place. With these disabled by default, the user can upload this example to a bare board without any unexpected effects. Easy enough to flip the boolean and enable them if required.
@dmadison dmadison merged commit 4038334 into master Mar 7, 2019
@dmadison dmadison deleted the development branch March 7, 2019 04:13
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