Question
Uart interrupt
Posted on December 19, 2015 at 19:15
Hello,
I tried to get working the uart with interrupt. I can send and receive data by polling with the function HAL_UART_Receive. First how I can do to check if a byte is in the data_register, because when I don't send a byte HAL_UART_Receive waits until time out, but I would check and then execute the other code and check if byte is received anytime later? The other thing is, how does it work to enable interrupt for uart. At the moment I have:HAL_NVIC_SetPriority(USART1_IRQ, 4,1);
HAL_NVIC_EnableIRQ(USART1_IRQ);
I found the function HAL_UART_Receive_IT(...) but I didn't understand how it works.
Can anyone explain me?
Martin