-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 missing pin definitions for 42. Keebs Frood #7165
Conversation
@@ -43,6 +43,11 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { | |||
{ MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, | |||
{ MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, | |||
|
|||
{ MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, // User LED | |||
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO17) }, | |||
{ MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO17) }, // VBUS sensing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you confirm that GPIO17 should really be available as all these names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks for catching that. It was a stupid copy&paste mistake. Fixed.
By the way, is it OK to give each pin these two names (a generic one and a "friendly" one), or should I rather choose one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it's fine. The one that appears first will be used when printing the pin, so just keep that in mind when writing the pin definition. For instance, on pygamer, LED and D13 are the same, and both print as board.LED:
>>> board.D13
board.LED
this is due to the order in the pins file:
{ MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA23) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA23) },
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. so as you've written it, board.LED would print as D17, which is the reverse of what we usually do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, got it, thanks for the explanation! Let me fix it quickly.
fff09e0
to
2b3c012
Compare
2b3c012
to
f3ec46b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working through the details with me!
This change adds some additional pin definitions that were missed in the initial support (or weren't used then - like the user LED one)