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

Runtime.serial_bytes_available: return count instead of bool #9141

Merged
merged 2 commits into from Apr 5, 2024

Conversation

dhalbert
Copy link
Collaborator

@dhalbert dhalbert commented Apr 4, 2024

Change supervisor.Runtime.serial_bytes_available to return the number of available bytes instead of just a True or False. Since 0 is False-y, this works in the common case of if supervisor.runtime.serial_bytes_available:.

I looked in the Learn Guides and I only found one use of .serial_bytes_available, and it's exactly as above.

This was a much larger change than one might think because I did a refactor to reduce a bunch of identical common-hal/supervisor files to single files in supervisor/shared. So there is, net, a lot less code now.

@tannewt tannewt self-requested a review April 4, 2024 16:40
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple functional questions. Thanks for cleaning this up!

ports/espressif/supervisor/usb_serial_jtag.c Outdated Show resolved Hide resolved
supervisor/shared/serial.c Outdated Show resolved Hide resolved
@dhalbert dhalbert changed the title Runtime.serial_bytes_available: return count isntead of bool Runtime.serial_bytes_available: return count instead of bool Apr 4, 2024
@dhalbert dhalbert requested a review from tannewt April 4, 2024 19:35
@dhalbert dhalbert mentioned this pull request Apr 4, 2024
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt tannewt merged commit fbd9a6e into adafruit:main Apr 5, 2024
500 checks passed
@dhalbert dhalbert deleted the serial_bytes_available branch April 5, 2024 20:19
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.

runtime.serial_bytes_available should return count of bytes
2 participants