Closed
Description
Related area
HardwareSerial UART Interrupts
Hardware specification
Any ESP32 with UARTs
Is your feature request related to a problem?
Hi, the current HardwareSerial has an onReceive() function (#5678) that uses interrupts to call a user function when data is received, but there is no equivalent for the UART_TX_DONE_INT or UART_TXFIFO_EMPTY_INT. I require these interrupts to implement an RS485 solution for ESP32.
Describe the solution you'd like
I would propose two new functions similar to the existing function
void HardwareSerial::onReceive(OnReceiveCb function, bool onlyOnTimeout)
The proposed functions are:
void HardwareSerial::onTransmitComplete(OnTransmitCompleteCb function)
void HardwareSerial::onTransmitBufferEmpty(OnTransmitBufferEmptyCb function, uint8_t threshold)
To be triggered on UART_TX_DONE_INT
and UART_TXFIFO_EMPTY_INT
respectively. The second function should also take a threshold parameter and update the uart_intr_config_t.txfifo_empty_intr_thresh
value as requested by the user.
Describe alternatives you've considered
No response
Additional context
No response
I have checked existing list of Feature requests and the Contribution Guide
- I confirm I have checked existing list of Feature requests and Contribution Guide.