Esempio n. 1
0
/**@brief Function for UART initialization.
 */
static uint32_t uart_init(app_uart_stream_comm_params_t * p_comm_params)
{
    if (p_comm_params->baud_rate > UART_BAUD_RATE_115200)
    {
        return NRF_ERROR_INVALID_PARAM;
    }

    nrf_drv_uart_config_t config = NRF_DRV_UART_DEFAULT_CONFIG;

    config.pselrxd = p_comm_params->rx_pin_no;
    config.pseltxd = p_comm_params->tx_pin_no;
    config.baudrate = (nrf_uart_baudrate_t) m_baud_rates[p_comm_params->baud_rate];
    config.hwfc = NRF_UART_HWFC_DISABLED;
    config.parity = NRF_UART_PARITY_EXCLUDED;

    nrf_drv_uart_uninit();
    uint32_t err_code = nrf_drv_uart_init(&config, NULL);
    if (err_code != NRF_SUCCESS)
    {
        return err_code;
    }
    nrf_drv_uart_rx_enable();

    m_iterations_next_byte_max = m_iteration[p_comm_params->baud_rate];

    return NRF_SUCCESS;
}
Esempio n. 2
0
uint32_t app_uart_close(void)
{
    nrf_drv_uart_uninit();
    return NRF_SUCCESS;
}
Esempio n. 3
0
static void nrf_log_backend_uart_panic_set(nrf_log_backend_t const * p_backend)
{
    nrf_drv_uart_uninit(&m_uart);

    uart_init(false);
}
Esempio n. 4
0
uint32_t serial_dfu_transport_close(void)
{
    nrf_drv_uart_uninit(&m_dfu.uart_instance);
    return NRF_SUCCESS;
}
Esempio n. 5
0
void ser_phy_hci_slip_close(void)
{
    nrf_drv_uart_uninit(&m_uart);
    m_ser_phy_hci_slip_event_handler = NULL;
}