uint8_t array[]={0x80, 0x30, 0x31, 0x50};
Chip_UART_Send(LPC_USART, "UART_Send!\n\r", 12);
Chip_UART_Send(LPC_USART, (const uint8_t *) &array[i], 10);
Chip_UART_Send(LPC_USART, (const uint8_t *) array[i], 10);
Chip_UART_SendBlocking(LPC_USART, "\n\rUART_SendBlocking\n\r", 21);
Chip_UART_SendBlocking(LPC_USART, (const uint8_t *) &array[i], 10);
Chip_UART_SendBlocking(LPC_USART, (const uint8_t *) array[i], 10);
/* 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;
/* Send until the transmit FIFO is full or out of bytes */
while ((sent < numBytes) && ((Chip_UART_ReadLineStatus(pUART) & UART_LSR_THRE) != 0))
{
Chip_UART_SendByte(pUART, *p8);
p8++;
sent++;
}
return sent;
}
/* Transmit a byte array through the UART peripheral (blocking) */
int Chip_UART_SendBlocking(LPC_USART_T *pUART, const void *data, int numBytes)
{
int pass, sent = 0;
uint8_t *p8 = (uint8_t *) data;
while (numBytes > 0) {
pass = Chip_UART_Send(pUART, p8, numBytes);
numBytes -= pass;
sent += pass;
p8 += pass;
}
return sent;
}