Serial RX Interrupt

Dear realtek
Is there any method to use Serial RX Interrupt instead of while(Serial.available()) {}

Hi @time4china,

In cores/ambpro2, there are several UART interfaces. The main files to look at are LOGUARTCLASS.cpp, UARTClassOne.cpp, UARTClassTwo.cpp and UARTClassTri.cpp. Inside each begin() method of these cpp, there is a serial rx interrupt handler being set. Right now there is no method exposed for you to use the interrupt from the arduino sketch itself. You can modify the functions arduino_loguart_irq_handler, arduino_uart_irq_handler to suit your needs.

Thank you.

Hi! I modified the arduino_uart_irq_handler and added a callback function, but the arduino_uart_irq_handler function always fired by the Rx Irq event. I traced the Rx PIN value, which is always HIGH; why?