internal idle in uart.write / fs.read ? #432
Replies: 4 comments
-
Posted at 2015-06-21 by DrAzzy fs.read() blocks. I don't think UART sending does, though (it'd be madness if it did - I haven't looked at the implementation here, but I suspect it's implemented similar to Arduino, where it sticks the text into a buffer, and uses interrupts to feed the data to the UART.) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-06-22 by @gfwilliams Yes, @drazzy's right. I don't think there are any functions to tell how full that output buffer is though, so you'll need to use eg.
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-06-22 by JumJum There is a nice event in NodeMCU (the LUA-version for ESP8266).
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-06-23 by @gfwilliams Hmm - yes, it's possible something like that could be implemented... Node.js has the drain event that could be similar. I guess doing it that way would mean you could just pipe data to Serial. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-06-21 by JumJum
I need to read some data from a file (fs.read) and later on write a lot of data to uart.
This takes some time, and I don't want to block other code during this.
Is Espruino adding idles states internally, or do I need to add something like setTimeout(function(){...},1) inside the loops for reading from SD and writing to UART ?
Beta Was this translation helpful? Give feedback.
All reactions