Example #1
0
void LOGUARTClass::begin( const uint32_t dwBaudRate )
{
#if LOG_UART_MODIFIABLE_BAUD_RATE
    /* log uart initialize in 38400 baud rate.
     * If we change baud rate here, Serail Monitor would not detect this change and show nothing on screen.
     */
    log_uart_init(&log_uart_obj, dwBaudRate, 8, ParityNone, 1);
#else
    log_uart_init(&log_uart_obj, 38400, 8, ParityNone, 1);
#endif
    log_uart_irq_set(&log_uart_obj, IIR_RX_RDY, 1);
    log_uart_irq_handler(&log_uart_obj, arduino_loguart_irq_handler, (uint32_t)_rx_buffer);
}
Example #2
0
void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id) 
{

#ifdef CONFIG_MBED_ENABLED
    if (obj->index == UART_3) {
        log_irq_handler = handler;
        serial_log_irq_ids = id;
        log_uart_irq_handler(&stdio_uart_log, serial_loguart_irq_handler, id);
        return;
    }
#endif
    PHAL_RUART_ADAPTER pHalRuartAdapter;
    u8 uart_idx;
    pHalRuartAdapter = &(obj->hal_uart_adp);
    uart_idx = pHalRuartAdapter->UartIndex;
    irq_handler[uart_idx] = handler;
    serial_irq_ids[uart_idx] = id;
    pHalRuartAdapter->TxTDCallback = SerialTxDoneCallBack;
    pHalRuartAdapter->TxTDCbPara = (void*)pHalRuartAdapter;
    pHalRuartAdapter->RxDRCallback = SerialRxDoneCallBack;
    pHalRuartAdapter->RxDRCbPara = (void*)pHalRuartAdapter;    
}