Skip to content

How to write non-blocking I2S code #2747

Closed Answered by Geekachuqt
Geekachuqt asked this question in Q&A
Discussion options

You must be logged in to vote

Nevermind, I figured it out.

For posterity: using while(i2s.availableToWrite()){i2s.write()}, the write function and any other code in the while loop will trigger once per 1/samplerate seconds. Using this you can ensure that other things are also triggered in sync with writing to the dac if needed, and if you want other things to trigger asynchronously, you can simply have them execute outside of the while loop.

That said, if anyone else would like to share example code that utilizes the callbacks for more efficient processing, I'd be happy to see it.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Geekachuqt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant