/* Send data on RS485 bus with specified parity stick value (9-bit mode).  */
uint32_t UART_RS485Send(LPC_UART_TypeDef *UARTx, uint8_t *pDatFrm, uint32_t size, uint8_t ParityStick)
/* Send data on RS485 bus with specified parity stick value (9-bit mode).  */
uint32_t UART_RS485Send(LPC_UART_TypeDef *UARTx, uint8_t *pDatFrm, uint32_t size, uint8_t ParityStick)
{
    uint8_t tmp, save;
    uint32_t cnt;
    if (ParityStick)
    {
        save = tmp = UARTx->LCR & UART_LCR_BITMASK;
        tmp &= ~(UART_LCR_PARITY_EVEN);
        UARTx->LCR = tmp;
        cnt = UART_Send((LPC_UART_TypeDef *)UARTx, pDatFrm, size, BLOCKING);
        while (!(UARTx->LSR & UART_LSR_TEMT));
        UARTx->LCR = save;
    }
    else
    {
        cnt = UART_Send((LPC_UART_TypeDef *)UARTx, pDatFrm, size, BLOCKING);
        while (!(UARTx->LSR & UART_LSR_TEMT));
    }
    return cnt;
}