Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ The Arduino_UnifiedStorage library provides a unified interface to access differ

## Examples
* [**examples/SimpleStorageWriteRead**](https://github.com/arduino-libraries/Arduino_UnifiedStorage/blob/main/examples/SimpleStorageWriteRead/SimpleStorageWriteRead.ino) - this example is concerned with reading/writing and seeking
* [**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
* [**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.
* [**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 structures and moving/copying from one storage medium to another
* [**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 device 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.
* [**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.

## Instructions
Expand All @@ -18,13 +18,13 @@ The Arduino_UnifiedStorage library provides a unified interface to access differ
* Flash the `QSPIFormat` example that can be found in the `STM32H747_System` folder (For Portenta H7/Opta/Giga)
* Open the serial monitor and select answer with "n" when this appears "Do you want to use partition scheme 1? Y/[n]"
* The sketch will warn you that the content of the QSPI flash will be erased. Answer with "Y".
* When asked if you'd like to use LittleFS on the data parition, select "n". Most of the examples assume that the drive is formatted as FAT. You can use the library to format to LittleFS later.
* When asked if you'd like to use LittleFS on the data partition, select "n". Most of the examples assume that the drive is formatted as FAT. You can use the library to format to LittleFS later.
* Reboot the board

### Formatting the Portenta C33 Internal Storage
* Flash the `QSPIFormat` example that can be found in the `Storage` folder for Portenta C33.
* Open the Serial Monitor. The sketch will warn you that the content of the QSPI flash will be erased. Answer with "Y".
* When asked if you'd like to use LittleFS on the data parition, select "n". Most of the examples assume that the drive is formatted as FAT. You can use the library to format to LittleFS later.
* When asked if you'd like to use LittleFS on the data partition, select "n". Most of the examples assume that the drive is formatted as FAT. You can use the library to format to LittleFS later.
* Reboot the board

## Features
Expand Down
12 changes: 6 additions & 6 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ Class representing a directory.
`public String ` [`getPathString`](#class_folder_1a30dd952da8ae977dca4e3dfde8fbd5be)`()` | Returns the path of the file.
`public ` [`Folder`](#class_folder)` ` [`createSubfolder`](#class_folder_1a78f2f9b297f62b67c2e0656b15a95868)`(const char * subfolderName, bool overwrite)` | Creates a subfolder in the directory.
`public ` [`Folder`](#class_folder)` ` [`createSubfolder`](#class_folder_1ab50743664becb7b2a1fb564b5513d69c)`(String subfolderName, bool overwrite)` | Creates a subfolder in the directory.
`public std::vector< ` [`UFile`](#class_u_file)` > ` [`getFiles`](#class_folder_1a3c2e01e19b48e3aa709cbdbb0acbdd78)`()` | Returns File objects for all files in the current dirctory.
`public std::vector< ` [`Folder`](#class_folder)` > ` [`getFolders`](#class_folder_1a69d3df42dacbd1d64d0f527e090f1fbb)`()` | Returns [Folder](#class_folder) objects for all files in the current dirctory.
`public std::vector< ` [`UFile`](#class_u_file)` > ` [`getFiles`](#class_folder_1a3c2e01e19b48e3aa709cbdbb0acbdd78)`()` | Returns File objects for all files in the current directory.
`public std::vector< ` [`Folder`](#class_folder)` > ` [`getFolders`](#class_folder_1a69d3df42dacbd1d64d0f527e090f1fbb)`()` | Returns [Folder](#class_folder) objects for all files in the current directory.
`public bool ` [`copyTo`](#class_folder_1aabf0818b7ee45b2d871e82e86edb4ebd)`(` [`Folder`](#class_folder)` destination, bool overwrite)` | Copies the current directory.
`public bool ` [`copyTo`](#class_folder_1a058d193f53c559eefe343b30797500eb)`(const char * destination, bool overwrite)` | Copies the current directory.
`public bool ` [`copyTo`](#class_folder_1a3162979e4c679c7f5503cc4584949714)`(String destination, bool overwrite)` | Copies the current directory.
Expand Down Expand Up @@ -128,7 +128,7 @@ Creates a file inside the directory.
* `const` char * fileName - The name of the file to create.

#### Returns
A File object if successfull, NULL if not.
A File object if successful, NULL if not.

### `public ` [`UFile`](#class_u_file)` ` [`createFile`](#class_folder_1a44255e2c0c4ffa37d7637a601bc590f6)`(String fileName, FileMode fmode)` <a id="class_folder_1a44255e2c0c4ffa37d7637a601bc590f6" class="anchor"></a>

Expand All @@ -138,7 +138,7 @@ Creates a file inside the directory.
* `String` fileName - The name of the file to create.

#### Returns
A File object if successfull, NULL if not.
A File object if successful, NULL if not.

### `public bool ` [`remove`](#class_folder_1aca893daac6c6747895d50987cf9cf34c)`()` <a id="class_folder_1aca893daac6c6747895d50987cf9cf34c" class="anchor"></a>

Expand Down Expand Up @@ -217,14 +217,14 @@ The created subfolder.

### `public std::vector< ` [`UFile`](#class_u_file)` > ` [`getFiles`](#class_folder_1a3c2e01e19b48e3aa709cbdbb0acbdd78)`()` <a id="class_folder_1a3c2e01e19b48e3aa709cbdbb0acbdd78" class="anchor"></a>

Returns File objects for all files in the current dirctory.
Returns File objects for all files in the current directory.

#### Returns
A std::vector of File objects representing the files in the directory.

### `public std::vector< ` [`Folder`](#class_folder)` > ` [`getFolders`](#class_folder_1a69d3df42dacbd1d64d0f527e090f1fbb)`()` <a id="class_folder_1a69d3df42dacbd1d64d0f527e090f1fbb" class="anchor"></a>

Returns [Folder](#class_folder) objects for all files in the current dirctory.
Returns [Folder](#class_folder) objects for all files in the current directory.

#### Returns
A std::vector of [Folder](#class_folder) objects representing the files in the directory.
Expand Down
2 changes: 1 addition & 1 deletion examples/PortentaH7Logger/PortentaH7Logger.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ INSTRUCTIONS
* This sketch will log data, and check if there is any USB MSD Device connected to the USB Port of the Opta.
The USB device is mounted and unmounted after every update operation. The first status LED is on when the USB drive is mounted.
So as long as the status LED is off you can safely remove the drive.
The skecth will log to internal storage in the meantime, and wait for the USB drive to be inserted again.
The sketch will log to internal storage in the meantime, and wait for the USB drive to be inserted again.
*/

#include "Arduino_UnifiedStorage.h"
Expand Down
2 changes: 1 addition & 1 deletion extras/tests/TestFileOperations/TestFileOperations.ino
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ void runTests(Arduino_UnifiedStorage * storage, String storageType) {
testMovingFile(root);

Serial.println("\n========= FS Contents after File Tests =========");
Serial.println("Should be empty if deletion was succesful");
Serial.println("Should be empty if deletion was successful");

printFolderContents(root);
Serial.println("=============================\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void runRepeatedMountTest(Arduino_UnifiedStorage * storage, String storageType,
Serial.println(umountResult);
Serial.println(getErrno());
} else {
Serial.println("Succesfully unmounted");
Serial.println("Successfully unmounted");
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions extras/tests/TestUnified/TestUnified.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ InternalStorage * qspi = new InternalStorage();
#endif


void test(String opperation, Arduino_UnifiedStorage* sourceStorage, Arduino_UnifiedStorage* destinationStorage, const char* storageTypeA, const char* storageTypeB) {
void test(String operation, Arduino_UnifiedStorage* sourceStorage, Arduino_UnifiedStorage* destinationStorage, const char* storageTypeA, const char* storageTypeB) {
Serial.println("----------------------------------------------------------");
Serial.println("Running test for " + opperation + " from " + String(storageTypeA) + " to " + String(storageTypeB) + "\n");
Serial.println("Running test for " + operation + " from " + String(storageTypeA) + " to " + String(storageTypeB) + "\n");

int mountSource = sourceStorage -> begin();
int mountDest = destinationStorage->begin();
Expand All @@ -36,18 +36,18 @@ void test(String opperation, Arduino_UnifiedStorage* sourceStorage, Arduino_Unif
fileToMove.close();

int opperationResult = -1;
if (opperation == "move") {
if (operation == "move") {
opperationResult = fileToMove.moveTo(destinationStorage->getRootFolder(), true);
fileToMove.close();
fileToMove.remove();
} else if(opperation == "copy"){
} else if(operation == "copy"){
opperationResult = fileToMove.copyTo(destinationStorage->getRootFolder(), true);
fileToMove.close();
fileToMove.remove();
}

if (opperationResult) {
Serial.println(opperation + " from " + String(storageTypeA) + " to " + String(storageTypeB) + " successful");
Serial.println(operation + " from " + String(storageTypeA) + " to " + String(storageTypeB) + " successful");
}


Expand Down
8 changes: 4 additions & 4 deletions src/Folder.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ class Folder {
/**
* @brief Creates a file inside the directory.
* @param const char * fileName - The name of the file to create.
* @return A File object if successfull, NULL if not.
* @return A File object if successful, NULL if not.
*/
UFile createFile(const char * fileName, FileMode fmode);

/**
* @brief Creates a file inside the directory.
* @param String fileName - The name of the file to create.
* @return A File object if successfull, NULL if not.
* @return A File object if successful, NULL if not.
*/
UFile createFile(String fileName, FileMode fmode);

Expand Down Expand Up @@ -101,13 +101,13 @@ class Folder {
Folder createSubfolder(String subfolderName, bool overwrite = false);

/**
* @brief Returns File objects for all files in the current dirctory.
* @brief Returns File objects for all files in the current directory.
* @return A std::vector of File objects representing the files in the directory.
*/
std::vector<UFile> getFiles();

/**
* @brief Returns Folder objects for all files in the current dirctory.
* @brief Returns Folder objects for all files in the current directory.
* @return A std::vector of Folder objects representing the files in the directory.
*/
std::vector<Folder> getFolders();
Expand Down