HI there
I am trying to receive data from a display. The display has a serial port and the system is configured to connect the serial port to the UART4. The display is a touch screen and has various soft keys configured such that when a key is pressed it sends the UART a stream of 6 hex characters. The first character for a key press us 0x07 and tells us there should be 5 more characters to follow.
I have tried to use the UART interrupt example, within the SDK for the development board we have (TWRK60-based product) but in the interrupt handler only the first byte is read.
How can I get the handler to read more than just the first byte in the stream of 6...?
I assumed if I did multiple reads of the UART ie something like;
void DEMO_UART_IRQHandler(void)
{
uint8_t data;
uint8_t No_of_Bytes;
uint8_t i;
/* If new data arrived. */
if ((kUART_RxDataRegFullFlag | kUART_RxOverrunFlag) & UART_GetStatusFlags(DEMO_UART))
{
data = UART_ReadByte(DEMO_UART);
/* If ring buffer is not full, add data to ring buffer. */
if (((rxIndex + 1) % DEMO_RING_BUFFER_SIZE) != txIndex)
{
if (data == 0x07)
{
No_of_Bytes = 5;
for (i = 0;i < No_of_Bytes;++i)
{
data = UART_ReadByte(DEMO_UART);
demoRingBuffer[rxIndex] = data;
rxIndex++;
rxIndex %= DEMO_RING_BUFFER_SIZE;
}
}
}
}
}
Hope you can help