Using LittleFS and SD_MMC interchangeably

37 Views Asked by At

I want to write a program for the Olimex EVB (ESP32 microcontroller with built-in SD card reader) where I can interchangeably access the internal flash storage (via LittleFS) and the SD card (via SD_MMC). What would be the best way so that I control which one to write to just by setting a variable? Since both are based on FS.h, I was thinking that I could do something like this:

#include <LittleFS.h>
using SD = LittleFS;

and the same for

#include "SD_MMC.h"
using SD = SD_MMC;

and afterwards just do any operation on SD, such as SD.begin(). However, the compiler tells me that LittleFS and SD_MMC do not name a type.

What kind of abstraction layer would be needed in order to once define SD based on the desired storage, and then just access the chosen storage via SD.?

0

There are 0 best solutions below