nodemcu / nodemcu-firmware

Lua based interactive firmware for ESP8266, ESP8285 and ESP32

Home Page:https://nodemcu.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The ESP32 i2s module should have a non-blocking option

pjsg opened this issue · comments

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.

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.

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.