#include <SD.h>
#include <USBHost_t36.h>
#include <MTP_Teensy.h>
#include <LittleFS.h>
#define CS_PIN BUILTIN_SDCARD
USBHost myusb;
USBHub hub1(myusb);
USBDrive mydrive1(myusb);
USBDrive mydrive2(myusb);
USBDrive mydrive3(myusb);
USBDrive mydrive4(myusb);
USBDrive mydrive5(myusb);
USBFilesystem mydisk1(myusb);
USBFilesystem mydisk2(myusb);
USBFilesystem mydisk3(myusb);
USBFilesystem mydisk4(myusb);
USBFilesystem mydisk5(myusb);
LittleFS_SPIFlash sFlash3;
LittleFS_SPIFlash sFlash4;
LittleFS_SPINAND sNand5;
LittleFS_SPINAND sNand6;
void setup() {
Serial.begin(9600);
MTP.begin();
SD.begin(CS_PIN);
MTP.addFilesystem(SD, "SD Card");
myusb.begin();
MTP.addFilesystem(mydisk1, "USB Disk1");
MTP.addFilesystem(mydisk2, "USB Disk2");
MTP.addFilesystem(mydisk3, "USB Disk3");
MTP.addFilesystem(mydisk4, "USB Disk4");
MTP.addFilesystem(mydisk5, "USB Disk5");
//Memboard configuration
sFlash3.begin(3, SPI);
MTP.addFilesystem(sFlash3, "sflash3");
sFlash4.begin(4, SPI);
MTP.addFilesystem(sFlash4, "sflash4");
sNand5.begin(5, SPI);
MTP.addFilesystem(sNand5, "sNand5");
sNand5.begin(6, SPI);
MTP.addFilesystem(sNand6, "sNand6");
// sets the storage for the index file
//MTP.useFileSystemIndexFileStore(0);
Serial.println("\nSetup done");
}
void loop() {
MTP.loop();
myusb.Task();
// do other things here...
static elapsedMillis msec;
if (msec > 500) {
msec = 0;
Serial.printf("mediaPresent = %s - %s\n",
(mydisk1.mediaPresent() ? "Yes" : "No"),
(mydisk2.mediaPresent() ? "Yes" : "No"),
(mydisk3.mediaPresent() ? "Yes" : "No"),
(mydisk4.mediaPresent() ? "Yes" : "No"),
(mydisk5.mediaPresent() ? "Yes" : "No"));
}
}