-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
esp32/machine_pin: Add mode and pull in machine_pin_print() as repr() function. #12293
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
base: master
Are you sure you want to change the base?
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 |
Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
10f4f37
to
a2d5db4
Compare
Done. |
Summary
This PR adds
mode
,pull
,drive
parameters 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:
This PR requires:
esp-idf commit espressif/esp-idf@4535c27
esp32: IDF v.5.5 compile. #16565
See also comment
espressif/esp-idf#14923 (comment)