Hello all!
For my current project I would like to increase the RX and TX buffer size for select UART ports.
While editing the corresponding HardwareSerialX.c files seems to work I would like to use a more flexible option.
So I was stumbling upon the functions addStorageForRead() and addStorageForWrite() in the HardwareSerial files. From a number of other threads (like this ) it seems like this is exactly what I need, but I'm a bit unsure on how to use them. Will the received bytes be copied directly to the buffer specified during the call to addStorageForRead() or is the user-defined buffer used internally. Looking at the code in HardwareSerial.cpp I assume the latter is true:
So I assume I simply call the procedure and forget about the buffer before calling HardwareSerial.begin()?
I would be very greatful for some clarification on that.
Kind regards,
Christian
For my current project I would like to increase the RX and TX buffer size for select UART ports.
While editing the corresponding HardwareSerialX.c files seems to work I would like to use a more flexible option.
So I was stumbling upon the functions addStorageForRead() and addStorageForWrite() in the HardwareSerial files. From a number of other threads (like this ) it seems like this is exactly what I need, but I'm a bit unsure on how to use them. Will the received bytes be copied directly to the buffer specified during the call to addStorageForRead() or is the user-defined buffer used internally. Looking at the code in HardwareSerial.cpp I assume the latter is true:
Code:
void HardwareSerial::addStorageForWrite(void *buffer, size_t length)
{
tx_buffer_storage_ = (BUFTYPE*)buffer;
if (buffer) {
tx_buffer_total_size_ = tx_buffer_total_size_ + length;
} else {
tx_buffer_total_size_ = tx_buffer_total_size_;
}
}
So I assume I simply call the procedure and forget about the buffer before calling HardwareSerial.begin()?
I would be very greatful for some clarification on that.
Kind regards,
Christian