TX buffer for HardwareSerial

What could be included in further releases, or for the forum.
Post Reply
smarq8
Posts: 23
Joined: Fri May 25, 2018 7:14 am

TX buffer for HardwareSerial

Post by smarq8 » Fri Jul 20, 2018 4:59 am

As in title. Without that I am forced to wait for end transmission before sending new data and availableforwrite() always return 1 so I am unable to catch when I am sending too much data.

If so it will also require to implement equivalent of arduino flush() (wait for end transmission) with is not same as STM32duino HWSerial flush.
https://www.arduino.cc/reference/en/lan ... ial/flush/

edogaldo
Posts: 432
Joined: Fri Jun 03, 2016 8:19 am

Re: TX buffer for HardwareSerial

Post by edogaldo » Fri Jul 20, 2018 6:36 am

Assuming you are talking about Roger's core: https://github.com/rogerclarkmelbourne/Arduino_STM32
Please search the forum and the repository too.
There is writing buffer for HW Serial since long ago.
Also flush implements Arduino v1.0 specs: https://github.com/rogerclarkmelbourne/ ... Serial.cpp
For availableForWrite instead I agree there is a fake implementation (but I never had to use it..).

Cheers, E.

smarq8
Posts: 23
Joined: Fri May 25, 2018 7:14 am

Re: TX buffer for HardwareSerial

Post by smarq8 » Fri Jul 20, 2018 7:32 am

so it look like it is only require to modyfi availableForWrite() as belowe? (I can not test it now).

Code: Select all

int HardwareSerial::availableForWrite(void)
{
return rb_full_count(this->usart_device->wb);
}

stevestrong
Posts: 3053
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: TX buffer for HardwareSerial

Post by stevestrong » Fri Jul 20, 2018 8:46 am

Check out the implementation for F4:
https://github.com/rogerclarkmelbourne/ ... #L344-L350
and
https://github.com/rogerclarkmelbourne/ ... #L148-L150
I don't know why is this missing from F1.

Post Reply