Skip to content

Commit e02bdbe

Browse files
fixed default partitions in InternalStorage, added format back to FAT in TestUnified
1 parent aa22f38 commit e02bdbe

File tree

4 files changed

+29
-10
lines changed

4 files changed

+29
-10
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ The Arduino_UnifiedStorage library provides a unified interface to access differ
44

55

66
## Examples
7-
* **examples/SimpleStorageWriteRead** - this example is concerned with reading/writing and seeking
8-
* **examples/AdvancedUSBInternalOperations** - this example is concerned with more advanced features like creating folders, traversing folder sturctures and moving/copying from one storage medium to another
9-
* **examples/PortentaH7Logger** - this is more of a real life usecase, where this library is used to log sensor data to a file on the internal storage and check if a USB Mass Storage deviece is inserted. If it is detected it will backup the information on the internal storage, only copying the bytes that are new since the last update.
10-
* **examples/BackupInternalPartitions** - Another real life usecase, where this library is used to back-up all partitions on the internal storage to a USB Mass Storage device.
11-
*
7+
* [**examples/SimpleStorageWriteRead**](https://github.com/arduino-libraries/Arduino_UnifiedStorage/blob/main/examples/SimpleStorageWriteRead/SimpleStorageWriteRead.ino) - this example is concerned with reading/writing and seeking
8+
* [**examples/AdvancedUSBInternalOperations**](https://github.com/arduino-libraries/Arduino_UnifiedStorage/blob/main/examples/AdvancedUSBInternalOperations/AdvancedUSBInternalOperations.ino) - this example is concerned with more advanced features like creating folders, traversing folder sturctures and moving/copying from one storage medium to another
9+
* [**examples/PortentaH7Logger**](https://github.com/arduino-libraries/Arduino_UnifiedStorage/blob/main/examples/PortentaH7Logger/PortentaH7Logger.ino) - this is more of a real life usecase, where this library is used to log sensor data to a file on the internal storage and check if a USB Mass Storage deviece is inserted. If it is detected it will backup the information on the internal storage, only copying the bytes that are new since the last update.
10+
* [**examples/BackupInternalPartitions**](https://github.com/arduino-libraries/Arduino_UnifiedStorage/blob/main/examples/BackupInternalPartitions/BackupInternalPartitions.ino) - Another real life usecase, where this library is used to back-up all partitions on the internal storage to a USB Mass Storage device.
11+
1212
## Instructions
1313
1. Download and install this library
1414
2. Check compatibility with your platform

examples/tests/TestUnified/TestUnified.ino

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,24 @@ void setup(){
215215
qspi_and_usb();
216216
sd_and_usb();
217217
qspi_and_sd();
218-
Serial.println("Tests finished");
218+
Serial.println("Tests finished, formatting all partitions back to FAT:");
219+
Serial.println("\t * Formatting QSPI to FAT:" + String(qspi->formatFAT()));
220+
Serial.println("\t * Formatting SD to FAT:" + String(sd->formatFAT()));
221+
Serial.println("\t * Formatting USB to FAT:" + String(usb->formatFAT()));
219222
#elif defined(HAS_USB) && defined(HAS_SD)
220223
sd_and_usb();
224+
Serial.println("\t * Formatting SD to FAT:" + String(sd->formatFAT()));
225+
Serial.println("\t * Formatting USB to FAT:" + String(usb->formatFAT()));
221226
#elif defined(HAS_USB) && defined(HAS_QSPI)
222227
qspi_and_usb();
228+
Serial.println("Tests finished, formatting all partitions back to FAT:");
229+
Serial.println("\t * Formatting QSPI to FAT:" + String(qspi->formatFAT()));
230+
Serial.println("\t * Formatting USB to FAT:" + String(usb->formatFAT()));
223231
#elif defined(HAS_SD) && defined(HAS_QSPI)
224232
qspi_and_sd();
233+
Serial.println("Tests finished, formatting all partitions back to FAT:");
234+
Serial.println("\t * Formatting QSPI to FAT:" + String(qspi->formatFAT()));
235+
Serial.println("\t * Formatting SD to FAT:" + String(sd->formatFAT()));
225236
#elif defined(HAS_USB)
226237
Serial.println("Cannot perform tests if only one storage type is selected");
227238
#elif defined(HAS_SD)

src/InternalStorage.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
#include "Arduino_UnifiedStorage.h"
22

33
InternalStorage::InternalStorage(){
4-
this -> fs = FS_FAT;
5-
this -> setQSPIPartition(2);
6-
this -> setQSPIPartitionName("user");
4+
this -> fs = FS_FAT;
5+
6+
#if defined(ARDUINO_PORTENTA_C33)
7+
this -> setQSPIPartition(2);
8+
#elif defined(ARDUINO_PORTENTA_H7_M7)
9+
this -> setQSPIPartition(3);
10+
#endif
11+
12+
this -> setQSPIPartitionName("user");
713
}
814

915
InternalStorage::InternalStorage(int partition, const char * name, FileSystems fs){

src/InternalStorage.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,15 @@ class InternalStorage : public Arduino_UnifiedStorage {
4545
BlockDevice * blockDevice;
4646
MBRBlockDevice * userData;
4747
FileSystem * userDataFileSystem;
48+
int partitionNumber = 2;
4849
#elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
4950
mbed::BlockDevice * blockDevice;
5051
mbed::MBRBlockDevice * userData;
5152
mbed::FileSystem * userDataFileSystem;
53+
int partitionNumber = 3;
5254
#endif
5355

54-
int partitionNumber = 2;
56+
5557
char * partitionName = "user";
5658
FileSystems fs = FS_FAT;
5759
};

0 commit comments

Comments
 (0)