This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf_atfifo_item_get issues incorrect warning

void * nrf_atfifo_item_get(nrf_atfifo_t * const p_fifo, nrf_atfifo_item_get_t * p_context)
{
    if (nrf_atfifo_rspace_req(p_fifo, &(p_context->last_head)))
    {
        void * p_item = ((uint8_t*)(p_fifo->p_buf)) + p_context->last_head.pos.rd;
        NRF_LOG_INST_DEBUG(p_fifo->p_log, "Get element: 0x%08X", p_item);
        return p_item;
    }
    NRF_LOG_INST_WARNING(p_fifo->p_log, "Get failed - no item in the FIFO.");
    return NULL;
}

This routine issues a warning if there are no items in the FIFO however RTC routine always checks for items in the FIFO even if empty. This then results in warnings being issued incorrectly.

The warning is useful for debugging code, but this then may require a function to check if there items in the FIFO before calling to get an item to suppress this warning

e.g.

bool * nrf_atfifo_item_check(nrf_atfifo_t * const p_fifo, nrf_atfifo_item_get_t * p_context)
{
    if (nrf_atfifo_rspace_req(p_fifo, &(p_context->last_head)))
    {
        return true;
    }

    return false;

}

Parents Reply Children
No Data
Related