Skip to content

Update UART examples #284

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

Merged
merged 2 commits into from
Oct 11, 2018
Merged

Update UART examples #284

merged 2 commits into from
Oct 11, 2018

Conversation

sam-bristow
Copy link
Contributor

The UART example was using the older pySerial API which was deprecated in v3.0. I have updated the example code to use the context-manager API which is clearer, shorter, and less error-prone.

I've also gone through and updated the remaining print statements to print() function calls while I was in there.

Low-hanging fruit of Python3 compatibility work.

I've left fix_py_compile.py as it is only ever going to be run under
Python 2.
Version 3.0 of python-serial introduced an updated API, we may as well
use it.

This change also uses context-managers for dealing with UARTs as they
are less error-prone and the code is much cleaner/shorter.
@pdp7
Copy link
Collaborator

pdp7 commented Oct 9, 2018

@sam-bristow thanks for making this PR.

Do you know if this change for the new python-serial API break backwards compatibility?

@sam-bristow
Copy link
Contributor Author

That change is purely documentation so it wont make any difference the library's compatibility.
The context-manager API I have used in the updated examples has been around for at least 3 years.

@pdp7 pdp7 merged commit 32b1f7e into adafruit:master Oct 11, 2018
@pdp7
Copy link
Collaborator

pdp7 commented Oct 11, 2018

@sam-bristow thanks!

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