Yes. I have a problem. I don't know when the TX buffer is empty when i put data in it.
I don't have any CB or interrupt to know. We only have a flush() method but it is blocking and just doing a while loop.
This is because i have timing issues. Currently what i do is this:
digitalWrite(MBUS_EN, HIGH);
Serial1.write(buffer, length+2);
Serial1.flush(); // flush is blokcing and the RTOS switches tasks. By the time it gets back i'm missing a lot of bytes
digitalWrite(MBUS_EN, LOW);
This data cut is happening when i have other tasks running. The esp simply has no time to set the EN pin to LOW.
Describe the solution you'd like
I would like a callback or an interrupt when the tx buffer is empty.
Something like
Serial1.begin(MBUS_BAUD, SERIAL_8N1, MBUS_RX, MBUS_TX);
Serial1.onTxEmpty( [](){
// Tx buffer is empty. All data sent.
});
Or to attach an interrupt to it.
Describe alternatives you've considered
Interrupt or cb.
Additional context
This would be useful to set my modbus EN pin.
I have checked existing list of Feature requests and the Contribution Guide
[X] I confirm I have checked existing list of Feature requests and Contribution Guide.
Related area
UART
Hardware specification
UART
Is your feature request related to a problem?
Yes. I have a problem. I don't know when the TX buffer is empty when i put data in it. I don't have any CB or interrupt to know. We only have a flush() method but it is blocking and just doing a while loop. This is because i have timing issues. Currently what i do is this:
This data cut is happening when i have other tasks running. The esp simply has no time to set the EN pin to LOW.
Describe the solution you'd like
I would like a callback or an interrupt when the tx buffer is empty. Something like
Or to attach an interrupt to it.
Describe alternatives you've considered
Interrupt or cb.
Additional context
This would be useful to set my modbus EN pin.
I have checked existing list of Feature requests and the Contribution Guide