AllJoyn/Samples/BACnetAdapter/bacnet-stack-0.8.2/ports/xplained/rs485.c
bool rs485_bytes_send(uint8_t * buffer,
    uint16_t nbytes)
{
    bool status = false;
    bool start_required = false;
    uint8_t ch = 0;

    if (buffer && (nbytes > 0)) {
        if (FIFO_Empty(&Transmit_Queue)) {
            start_required = true;
        }
        status = FIFO_Add(&Transmit_Queue, buffer, nbytes);
        if (start_required && status) {
            rs485_rts_enable(true);
            timer_elapsed_start(&Silence_Timer);
            ch = FIFO_Get(&Transmit_Queue);
            usart_clear_tx_complete(&RS485_USART);
            usart_set_tx_interrupt_level(&RS485_USART, USART_INT_LVL_LO);
            usart_putchar(&RS485_USART, ch);
        }
    }

    return status;
}
/**
*  Transmit one or more bytes on RS-485. Can be called while transmitting to add
*  additional bytes to transmit queue.
*
* @param buffer - array of one or more bytes to transmit
* @param nbytes - number of bytes to transmit
*/
Transmit one or more bytes on RS-485. Can be called while transmitting to add
additional bytes to transmit queue.
Transmit one or more bytes on RS - 485 . Can be called while transmitting to add additional bytes to transmit queue .
bool rs485_bytes_send(uint8_t * buffer,
    uint16_t nbytes)
{
    bool status = false;
    bool start_required = false;
    uint8_t ch = 0;
    if (buffer && (nbytes > 0)) {
        if (FIFO_Empty(&Transmit_Queue)) {
            start_required = true;
        }
        status = FIFO_Add(&Transmit_Queue, buffer, nbytes);
        if (start_required && status) {
            rs485_rts_enable(true);
            timer_elapsed_start(&Silence_Timer);
            ch = FIFO_Get(&Transmit_Queue);
            usart_clear_tx_complete(&RS485_USART);
            usart_set_tx_interrupt_level(&RS485_USART, USART_INT_LVL_LO);
            usart_putchar(&RS485_USART, ch);
        }
    }
    return status;
}
bool rs485_bytes_send ( uint8_t * buffer , uint16_t nbytes ) { bool status = false ; bool start_required = false ; uint8_t ch = 0 ; if ( buffer && ( nbytes > 0 ) ) { if ( FIFO_Empty ( & Transmit_Queue ) ) { start_required = true ; } status = FIFO_Add ( & Transmit_Queue , buffer , nbytes ) ; if ( start_required && status ) { rs485_rts_enable ( true ) ; timer_elapsed_start ( & Silence_Timer ) ; ch = FIFO_Get ( & Transmit_Queue ) ; usart_clear_tx_complete ( & RS485_USART ) ; usart_set_tx_interrupt_level ( & RS485_USART , USART_INT_LVL_LO ) ; usart_putchar ( & RS485_USART , ch ) ; } } return status ; }
Transmit one or more bytes on RS-485.
Transmit one or more bytes on RS - 485 .