hi all.
I am using BW16 RTL870DN. I am trying UART Rx interrupt but the interrupt is not working. Can anyone please help me in this. please check my code below.
Thanks.
#include “serial_api.h”
#define UART_TX PB_1
#define UART_RX PB_2
#define UART_BAUD 115200
serial_t serial;
void uart_rx_handler(uint32_t id, SerialIrq event) {
if (event == RxIrq) {
char c = serial_getc(&serial); // Get the received character
serial_putc(&serial, c); // Echo it back
}
}
void setup_uart() {
serial_init(&serial, UART_TX, UART_RX);
serial_baud(&serial, UART_BAUD);
serial_irq_handler(&serial, uart_rx_handler, 0);
serial_irq_set(&serial, RxIrq, 1); // Enable RX interrupt
}
void setup()
{
setup_uart();
}
void loop()
{
}