Skip to content

Commit d6dd6eb

Browse files
added overloaded constructor for InternalStorage
1 parent f8717bc commit d6dd6eb

File tree

6 files changed

+17
-187
lines changed

6 files changed

+17
-187
lines changed

examples/opta_logger/opta_logger.ino

Lines changed: 0 additions & 173 deletions
This file was deleted.

src/Folder.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,14 @@ bool Folder::remove() {
4141
if(this->exists()){
4242
std::vector<UFile> files = this->getFiles();
4343
for (UFile file : files) {
44-
Serial.println(file.getPathString());
44+
4545
file.remove();
4646

4747
}
4848

4949
// Remove all subfolders in the directory
5050
std::vector<Folder> folders = this->getFolders();
5151
for (Folder directory : folders) {
52-
Serial.println(directory.getPathString());
5352
directory.remove();
5453
}
5554

src/InternalStorage.cpp

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

33
InternalStorage::InternalStorage(){
4+
5+
}
6+
7+
InternalStorage::InternalStorage(int partition, const char * name ){
8+
this -> setQSPIPartition(partition);
9+
this -> setQSPIPartitionName(name);
10+
}
11+
12+
13+
int InternalStorage::begin(){
414
#if defined(ARDUINO_PORTENTA_C33)
515
this -> blockDevice = BlockDevice::get_default_instance();
616
this -> userData = new MBRBlockDevice(this->blockDevice, this->partitionNumber);
717
this -> userDataFileSystem = new FATFileSystem(this->partitionName);
18+
int err = this -> userDataFileSystem -> mount(userData);
19+
if(err == 0) return 1;
820
#elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
921
this -> blockDevice = QSPIFBlockDevice::get_default_instance();
1022
this -> userData = new mbed::MBRBlockDevice(this->blockDevice, this->partitionNumber);
1123
this -> userDataFileSystem = new mbed::FATFileSystem(this->partitionName);
12-
#endif
13-
}
14-
15-
int InternalStorage::begin(){
16-
#if defined(ARDUINO_PORTENTA_C33)
17-
int err = this -> userDataFileSystem -> mount(userData);
18-
if(err == 0) return 1;
19-
#elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
2024
int err = this -> userDataFileSystem -> mount(this -> userData);
2125
if(err == 0) return 1;
2226
#endif

src/InternalStorage.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ class InternalStorage : public Arduino_UnifiedStorage {
1111
public:
1212
InternalStorage();
1313
// Override begin() method for SD card initialization
14+
InternalStorage(int partition, const char * name);
15+
1416
int begin() override;
1517

1618
int unmount() override;

src/USBStorage.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
USBStorage::USBStorage(){
1010
#if defined(ARDUINO_PORTENTA_C33)
1111
register_hotplug_callback(DEV_USB, [](){
12-
Serial.println("caalllback");
1312
available = !available;
1413

1514
});

src/USBStorage.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
#ifndef USBStorage_H
44
#define USBStorage_H
55

6-
static bool available = false;
76

87

98
static bool available = false;
109

11-
1210
class USBStorage : public Arduino_UnifiedStorage {
1311
public:
1412
USBStorage();
@@ -30,7 +28,8 @@ class USBStorage : public Arduino_UnifiedStorage {
3028

3129

3230
private:
33-
31+
32+
3433
bool connected = false;
3534

3635
unsigned long previousMillis;

0 commit comments

Comments
 (0)