How do I know if the I2S transmission is finish?

Hi:

I am currently waiting for 2ms before stopping I2S.But I want to stop it after completing the event through I2S, rather than through delay.

 

static void dLed_i2s_Start(void)
{
    uint32_t err_code = NRF_SUCCESS;
    prepare_tx_data(m_led_tx_buf[0], analysisData, LED_MAX*RGB*3);

    nrf_drv_i2s_buffers_t const initial_buffers = {
        .p_tx_buffer = m_led_tx_buf[0],
    };
    err_code = nrf_drv_i2s_start(&initial_buffers, word_len, 0);
    APP_ERROR_CHECK(err_code);

    nrf_delay_ms(2);
    nrf_drv_i2s_stop();     
}

And I don't know when it will be completed in data_handler.

static void data_handler(nrf_drv_i2s_buffers_t const * p_released,
                         uint32_t                      status)
{
    // 'nrf_drv_i2s_next_buffers_set' is called directly from the handler
    // each time next buffers are requested, so data corruption is not
    // expected.
    ASSERT(p_released);

    // When the handler is called after the transfer has been stopped
    // (no next buffers are needed, only the used buffers are to be
    // released), there is nothing to do.
    if (!(status & NRFX_I2S_STATUS_NEXT_BUFFERS_NEEDED))
    {
        return;
    }
    //nrf_drv_i2s_stop(); 


}

Related