Implement Serial.available() function - #79
Conversation
Implement available function.
|
That's an interesting PR. |
|
https://gist.github.com/tanakamasayuki/56251790ad3c06a9837895054fd2f15e 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. |
|
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. |
-1 means if(Serial.available()) is always true.
Returns reception status.