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

Implement Serial.available() function #79

Closed
wants to merge 1 commit into from
Closed

Implement Serial.available() function #79

wants to merge 1 commit into from

Conversation

tanakamasayuki
Copy link

-1 means if(Serial.available()) is always true.
Returns reception status.

Implement available function.
@maxint-rd
Copy link
Contributor

That's an interesting PR.
Seems like you took a much simpler approach than my convoluted attempt to reintroduce the receive buffer to enable available() and peek().
Nice!

@tanakamasayuki
Copy link
Author

https://gist.github.com/tanakamasayuki/56251790ad3c06a9837895054fd2f15e

I actually want to use reception interrupts.
It's currently being tested.

@maxint-rd
Copy link
Contributor

maxint-rd commented Apr 12, 2024

I actually want to use reception interrupts.

Excellent! I'm looking forward to do some testing of your code as soon as I can find the time.

For my I2C slave implementation I managed to enable interrupts. For enabling Serial.peek() that would be a welcome improvement, as my feeble attempt without interrupts certainly limits data reception.

@maxint-rd
Copy link
Contributor

FYI - Some time ago i submitted PR #145, which implements interrupt driven Serial1. It enables Serial.available(), Serial.peek() and improves Serial.read() to prevent lost data. Tested mainly on CH32V003, but also confirmed to work on other CH32 chips. Would be nice if more CH32 chips could be tested.

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