/* Transmit a byte array through the UART peripheral (non-blocking) */
int Chip_UART_Send(LPC_USART_T *pUART, const void *data, int numBytes)
{
int sent = 0;
uint8_t *p8 = (uint8_t *) data;
/* beforehand, wait till the buffer is empty*/
while ((Chip_UART_ReadLineStatus(pUART) & UART_LSR_THRE) == 0)
;
/*send 16 bytes to bufferred Tx*/
while (sent < numBytes) {
Chip_UART_SendByte(pUART, *p8);
p8++;
sent++;
/*Wait till buffer is empty every 16 Bytes*/
if(!(sent % 16))
{
while ((Chip_UART_ReadLineStatus(pUART) & UART_LSR_THRE) == 0)
;
}
}
return sent;
}