I'm working with FRDM-K22F and i'm developing my own lib to control it but i'm struggling with IRQ which can be called from rx and tx.
The problem is that i want to handle non-blocking read and also non blocking write(both uses interrupt)
if(UART2->S1 & UART_S1_RDRF_MASK)
if(UART2->S1 & UART_S1_TDRE_MASK)
Problems starts when IRQhandler is invoked by RX, both flags RDRF and TDRE will be active but i dont want to send data unless interrupt was caused by TX. I could use else if statement and that "solves" the problem temporary.
Now let's assume there was interrupt caused by RX and TX almost at exact same time, would be UART2_RX_TX_IRQHandler called twice or there is small chance i would have to handle 2 interrupts in 1 handler?