greiman / SdFat

Arduino FAT16/FAT32 exFAT Library
MIT License
1.05k stars 496 forks source link

RingBuf with ExFAT usage #331

Open noisymime opened 2 years ago

noisymime commented 2 years ago

Firstly fantastic work with this library! It's a great implementation.

I'm writing a logger routine using Teensy 3.5 that is fairly time critical and so I'm using the SDIO FIFO interface based on the TeensySdioLogger example. That works fine, but looks to be based around the FAT32 FsFile class. I'd prefer to use ExFat to get the preallocation benefits, but it looks like RingBuf doesn't support the ExFile class.

So that makes me wonder, what's the recommended way of doing fast, non-blocking writes? If I'm using the SDIO FIFO already, is it better to stick with FAT32 + RingBuf or ExFat and writing directly?

greiman commented 2 years ago

The FsFile and SdFs classes support FAT16/FAT32 and exFAT.

RingBuf is a template that supports any file class. for exFAT only use ExFile and SdExFat like this.

SdExFat sd;

ExFile file;
RingBuf<ExFile, RING_BUF_CAPACITY> rb;
...
  rb.begin(&file);

ExFat is best for most logging applications. So use either (FsFile, SdFs) or (ExFile, SdExFat). The same code will be used for exFAT.