Enabling UART in a Mesh application

I'm trying to enable UART in a mesh application with SDK 15.1.0 and mesh SDK 3.3.0. This seems to be a real nightmare and I'm not sure why Nordic has so many different HAL libraries to drive the same peripheral. As an example, for a  UART application you can use:

component/libraries/uart/app_uart.c

modules/nrfx/drivers/nrfx_uart.c

These seem to be accomplishing the same thing with different variability of functionality, backwards compatibility, etc. The problem is in integration\nrfx\legacy\nrf_drv_uart.c which has a function that depends on the inclusion of bot nrfx_uarte_init and nrfx_uart_init. 

ret_code_t nrf_drv_uart_init(nrf_drv_uart_t const *        p_instance,
                             nrf_drv_uart_config_t const * p_config,
                             nrf_uart_event_handler_t      event_handler)
{
    uint32_t inst_idx = p_instance->inst_idx;
    m_handlers[inst_idx] = event_handler;
    m_contexts[inst_idx] = p_config->p_context;

#if defined(NRF_DRV_UART_WITH_UARTE) && defined(NRF_DRV_UART_WITH_UART)
#ifdef NRF52840_XXAA
    if (inst_idx == 1)
    {
        ASSERT(p_config->use_easy_dma);
    }
#endif
    nrf_drv_uart_use_easy_dma[inst_idx] = p_config->use_easy_dma;
#endif

    nrf_drv_uart_config_t config = *p_config;
    config.p_context = (void *)inst_idx;

    ret_code_t result = 0;
    if (NRF_DRV_UART_USE_UARTE)
    {
        result = nrfx_uarte_init(&p_instance->uarte,
                                 (nrfx_uarte_config_t const *)&config,
                                 event_handler ? uarte_evt_handler : NULL);
    }
    else if (NRF_DRV_UART_USE_UART)
    {
        result = nrfx_uart_init(&p_instance->uart,
                                (nrfx_uart_config_t const *)&config,
                                event_handler ? uart_evt_handler : NULL);
    }
    return result;
}

If you include both those files you have a " multiple definition of `UARTE0_UART0_IRQHandler'" error between nrfx_uarte and nrfx_uart, but you can't build nrf_drv_uart in the first place without both of these. 

Parents
No Data
Reply Children
No Data