nodemcu-firmware icon indicating copy to clipboard operation
nodemcu-firmware copied to clipboard

The ESP32 i2s module should have a non-blocking option

Open pjsg opened this issue 4 years ago • 2 comments
trafficstars

Missing feature

Current the i2s.write function can block when called. This is unfortunate in an event driven system. I suggest a way to configure the channel so that the queue has more than 2 elements and have the i2s.write return true if the message was queued and false otherwise. The application can figure out roughly when to retry the call based on the sizes of the messages and the data rate configured.

pjsg avatar Oct 24 '21 19:10 pjsg

Maybe it makes more sense to return the size of the queue. In an event driven system also a callback on QueueEmpty or QueueLow would make sense. Or even every time an entry has been removed from the queue. But maybe the underlying api doesn't expose the needed functionality.

HHHartmann avatar Oct 25 '21 06:10 HHHartmann

I'm also wondering if we can merge in the audio stream stuff that the IDF supports to make it easy to play (say) an MP3 from disk (or network). It isn't clear to me what the model ought to be.

pjsg avatar Oct 26 '21 03:10 pjsg