Skip to content

Instantly share code, notes, and snippets.

@electronut
Created August 19, 2017 03:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save electronut/0232ba246146e16da5ac4b25f8b5bc46 to your computer and use it in GitHub Desktop.
Save electronut/0232ba246146e16da5ac4b25f8b5bc46 to your computer and use it in GitHub Desktop.
main loop i2s
for (;;)
{
// start I2S
if(g_i2s_start && !g_i2s_running) {
err_code = nrf_drv_i2s_start(0, m_buffer_tx, I2S_BUFFER_SIZE, 0);
APP_ERROR_CHECK(err_code);
g_i2s_running = true;
}
// stop I2S
if(!g_i2s_start && g_i2s_running) {
nrf_drv_i2s_stop();
g_i2s_running = false;
}
nrf_delay_ms(250);
// update
if (g_i2s_running) {
nled = (nled + 1) % NLEDS;
set_led_data();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment