rb.write() is writing data INTO the RingBuf, while rb.writeOut() extracts data FROM RingBuf and writes TO the file on SD.I can't get my head around what write() is actually doing, and how to enforce 512 & is_busy() as used by the ISR function in main.cpp:
I usually choose to keep my ISRs as short as possible and write to SD from loop(), with this approach:main.cpp is running error-free for now, but I could redesign to not write in the ISR as per the TeensySdioLogger I suppose if needed.
[ISR] ----> RingBuf ----> [loop] ---> SD
Ah I think I seerb.write() is writing data INTO the RingBuf, while rb.writeOut() extracts data FROM RingBuf and writes TO the file on SD.
I usually choose to keep my ISRs as short as possible and write to SD from loop(), with this approach:
if (n >= 512) { // could be if ((n > 512) && !file.isBusy()) {
if (rb.writeOut(512) != 512) {
Serial.println("writeOut() failed");
file.close();
return;
}
}
* This function must only be used in non-interrupt code.
...
*/
size_t writeOut(size_t count) {