Skip to content
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

Add Logo Button #46

Closed

Conversation

BenjaminVanRyseghem
Copy link
Contributor

Add support for logo button, and shift pins accordingly.

Add support for logo button, and shift pins accordingly.
@dmadison
Copy link
Owner

Thanks for the PR. Believe it or not this was an intentional omission, as the Leonardo only has enough pins for the controls listed.

I don't have a good solution to support boards that include more pins, as the examples are supposed to be simple and easy to understand for beginners and not a comprehensive solution.

The simplest answer is to use the NOT_A_PIN value, but that returns LOW on digitalRead() which doesn't work using the pull-up logic. Another solution is to build a helper function for each button that takes the pin number as a parameter and check if it's equal to NOT_A_PIN, but again beginners and functions and trying to keep things simple to understand. Or we could use a few preprocessor directives to select between pins dependent on the board, but that quickly gets unwieldy.

@BenjaminVanRyseghem
Copy link
Contributor Author

ah ok 😄

Then, could we just add somewhere (in a comment at the beginning of the script maybe) the available buttons?

To find that BUTTON_LOGO exists, it requires to dig up a bit into the code (I personally found it here)

@dmadison
Copy link
Owner

dmadison commented Feb 1, 2021

Hmm. I'll have to think about how best to do that. Most of the other buttons are self-explanatory because they're used, but I don't want to do a dummy variable/call with the logo button because it implies that the rest of the code (setting the pin mode, reading the pin, setting the output) also exists. And listing all of the buttons before they're immediately used seems redundant, especially if they're only listed in a single example.

For what it's worth the button is mentioned in the "How To" documentation I wrote up here (...which I really should add to the README). It's also used in the WiiClassicController example. It's omitted from the GamepadPins as because there isn't a pin for it, and it's omitted from SimulateAll because on Windows 10 it can do unexpected things like shut down the system if the user isn't careful. And it's not good to have the board do that automatically without the user's control 😉

@BenjaminVanRyseghem
Copy link
Contributor Author

Maybe you could just list the available inputs in the README? 😄

@dmadison
Copy link
Owner

dmadison commented Feb 1, 2021

I do! Just not by the enum name 😛 Though frankly if you're looking at the README it's not a far jump to look at the first line of code in the only header file.

A more permanent solution would be to implement Doxygen support, but I'm currently tied up with other projects.

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.

None yet

2 participants