Repository navigation
esp32/machine_pin: Add mode and pull in machine_pin_print() as repr() function. - #12293
Conversation
|
@jimmo |
|
Thanks @IhorNehrutsa -- I can definitely see that adding this information to the print output is useful for debugging, and making the pin serialisable is certainly a nice bonus. However, there are two main concerns:
It's quite useful (for debugging) that it prints the mode strings rather than the numbers too. (I guess you could in theory make this work with eval with the right combination of globals passed to eval).
What if we turned |
|
I opened the ESP-IDF issue: |
0364afd to
ac21d87
Compare
ac21d87 to
d3ea66f
Compare
|
Function gpio_dump_io_configuration() Commit espressif/esp-idf@321f628 |
|
|
feat(gpio): add a dump API to dump IO configurations (IDFGH-11366) |
c306ff3 to
f02d047
Compare
|
This is an automated heads-up that we've just merged a Pull Request See #13763 A search suggests this PR might apply the STATIC macro to some C code. If it Although this is an automated message, feel free to @-reply to me directly if |
|
Now that esp32 port uses IDF 5.2.2, are the required IDF functions available to retrieve the GPIO state? Also, would be nice to print the string of the mode/pull, rather than just the integer (like the rp2 port does). |
|
Code size report: |
aeb7ca4 to
41cf3bc
Compare
3598998 to
fd13deb
Compare
|
Test code is: The output is: This PR requires in esp-idf |
fd13deb to
10f4f37
Compare
This PR requires: See also comment |
|
Thanks @IhorNehrutsa for persisting with this PR. I've marked it as a draft for now, because we won't be able to review and merge it until there's a release version of ESP-IDF v5.5 that MicroPython supports. When this happens, please feel free to rebase and click "Ready for review". (One thing to note, it will be a very long time before we drop support for all older ESP-IDF, so this PR will probably need some |
10f4f37 to
a2d5db4
Compare
Done. |
8f9e9cd to
3291f87
Compare
|
Ready with IDF v.5.5 |
Ready |
projectgus
left a comment
There was a problem hiding this comment.
LGTM, thanks @IhorNehrutsa!
This commit adds mode, pull, drive parameters to the Pin repr function. This allows to serialize Pin object to str and restore the Pin object from the string. Signed-off-by: IhorNehrutsa <[email protected]>
|
Merged! Thanks for keeping this going. |
Summary
This PR adds
mode,pull,driveparameters to the Pin repr function.The main advantage:
This PR allows to serialize Pin object to str and restore the Pin object from the string:
Output is:
Testing
Test code is:
Output is: