File tree 12 files changed +63
-1168
lines changed 12 files changed +63
-1168
lines changed Original file line number Diff line number Diff line change 2
2
#ifndef UnifiedStorage_H
3
3
#define UnifiedStorage_H
4
4
5
- #define HAS_SD defined (ARDUINO_PORTENTA_C33) || defined(ARDUINO_PORTENTA_H7_M7)
6
- #define HAS_USB defined (ARDUINO_PORTENTA_C33) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
7
- #define HAS_QSPI defined (ARDUINO_PORTENTA_C33) || defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA) || defined(ARDUINO_NICLA_VISION)
8
-
9
- #define USES_RENESAS_CORE defined (ARDUINO_PORTENTA_C33)
10
- #define USES_MBED_CORE defined (ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA) || defined(ARDUINO_NICLA_VISION)
11
-
12
5
13
6
#include " Arduino.h"
14
7
#include " Arduino_POSIXStorage.h"
15
- #include < vector>
16
- #include " Types.h"
8
+ #include " Boards.h"
17
9
#include " Utils.h"
10
+ #include " Types.h"
11
+ #include " Partitioning.h"
12
+
18
13
#include " Folder.h"
19
14
#include " UFile.h"
20
15
21
16
22
17
23
18
24
- #if defined(HAS_USB)
25
- #include " USBStorage.h"
26
- #endif
27
-
28
- #if defined(HAS_SD)
29
- #include " SDStorage.h"
30
- #endif
31
-
32
- #if defined(HAS_QSPI)
33
- #include " InternalStorage.h"
34
- #endif
35
19
36
20
37
21
@@ -75,8 +59,17 @@ class Arduino_UnifiedStorage {
75
59
};
76
60
77
61
62
+ #if defined(HAS_USB)
63
+ #include " USBStorage.h"
64
+ #endif
78
65
66
+ #if defined(HAS_SD)
67
+ #include " SDStorage.h"
68
+ #endif
79
69
70
+ #if defined(HAS_QSPI)
71
+ #include " InternalStorage.h"
72
+ #endif
80
73
81
74
#endif
82
75
Original file line number Diff line number Diff line change
1
+ #if defined(ARDUINO_PORTENTA_C33 )
2
+ #define HAS_SD
3
+ #define HAS_USB
4
+ #define HAS_QSPI
5
+ #define USES_RENESAS_CORE
6
+ #endif
7
+
8
+ #if defined(ARDUINO_PORTENTA_H7_M7 )
9
+ #define HAS_SD
10
+ #define HAS_USB
11
+ #define HAS_QSPI
12
+ #define USES_MBED_CORE
13
+ #endif
14
+
15
+ #if defined(ARDUINO_OPTA )
16
+ #define HAS_USB
17
+ #define HAS_QSPI
18
+ #define USES_MBED_CORE
19
+ #endif
20
+
21
+ #if defined(ARDUINO_NICLA_VISION )
22
+ #define HAS_QSPI
23
+ #define USES_MBED_CORE
24
+ #endif
25
+
26
+
27
+
28
+
29
+
Original file line number Diff line number Diff line change 1
1
#ifndef Folder_H
2
2
#define Folder_H
3
3
4
+
4
5
#include " Utils.h"
5
6
#include " UFile.h"
6
-
7
-
7
+ #include < vector>
8
8
9
9
class UFile ;
10
10
/* *
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ bool InternalStorage::partition(std::vector<Partition> partitions){
20
20
Partitioning::partitionDrive (QSPIFBlockDeviceType::get_default_instance (), partitions);
21
21
}
22
22
23
+
24
+
23
25
bool InternalStorage::begin (){
24
26
this -> blockDevice = BlockDeviceType::get_default_instance ();
25
27
this -> userData = new MBRBlockDeviceType (this ->blockDevice , this ->partitionNumber );
Original file line number Diff line number Diff line change 2
2
#define InternalStorage_H
3
3
4
4
#include " Arduino_UnifiedStorage.h"
5
- #include " Partitioning.h"
6
5
#include " Types.h"
7
6
7
+
8
8
/* *
9
9
* Represents internal storage using the Arduino Unified Storage library.
10
10
*/
@@ -84,6 +84,8 @@ class InternalStorage : public Arduino_UnifiedStorage {
84
84
BlockDeviceType *getBlockDevice ();
85
85
86
86
static bool partition (std::vector<Partition> partitions);
87
+ // partition() -> one Partition
88
+ // restoreDefaultPartitions();
87
89
88
90
89
91
private:
Original file line number Diff line number Diff line change 19
19
}
20
20
21
21
bool Partitioning::isPartitionSchemeValid (BlockDeviceType * bd, std::vector<Partition> partitions){
22
- size_t driveSize = bd -> size () / 1024 ;
22
+ size_t driveSize = bd -> size () / 1024 ; //
23
23
int totalSize = 0 ;
24
24
25
25
for (size_t i = 1 ; i < partitions.size () + 1 ; ++i) {
Original file line number Diff line number Diff line change 1
1
2
2
#include " Arduino.h"
3
- #include " Arduino_UnifiedStorage.h"
4
3
#include " Types.h"
4
+ #include " Arduino_POSIXStorage.h"
5
5
#include < vector>
6
6
7
7
struct Partition {
@@ -17,6 +17,5 @@ class Partitioning{
17
17
static bool isPartitionSchemeValid (BlockDeviceType * bd, std::vector<Partition> partitions);
18
18
static bool formatPartition (BlockDeviceType * bd, int partitionNumber, FileSystems fs);
19
19
static bool createAndFormatPartitions (BlockDeviceType * bd, std::vector<Partition> partitions);
20
-
21
-
20
+
22
21
};
Original file line number Diff line number Diff line change 1
1
2
+ #include "Boards.h"
3
+
2
4
#if defined(USES_RENESAS_CORE )
3
5
#include "BlockDevice.h"
4
6
#include "MBRBlockDevice.h"
15
17
#elif defined(USES_MBED_CORE )
16
18
#include "QSPIFBlockDevice.h"
17
19
#include "MBRBlockDevice.h"
20
+ #include "LittleFileSystem.h"
18
21
#include "FATFileSystem.h"
19
22
20
23
typedef QSPIFBlockDevice QSPIFBlockDeviceType ;
23
26
typedef mbed ::FATFileSystem FATFileSystemType ;
24
27
typedef mbed ::LittleFileSystem LittleFileSystemType ;
25
28
typedef mbed ::FileSystem FileSystemType ;
26
-
27
29
#endif
Original file line number Diff line number Diff line change 3
3
4
4
#include < Arduino.h>
5
5
#include < string.h>
6
+ #include < vector>
6
7
#include " Utils.h"
7
8
8
9
class Folder ;
Original file line number Diff line number Diff line change @@ -20,15 +20,15 @@ void USBStorage::onConnect(void (* const callbackFunction)()){
20
20
register_hotplug_callback (DEV_USB, callbackFunction);
21
21
}
22
22
23
- void USBStorage::removeConnectCallback (){
23
+ void USBStorage::removeOnConnectCallback (){
24
24
deregister_hotplug_callback (DEV_USB);
25
25
}
26
26
27
27
void USBStorage::onDisconnect (void (* const callbackFunction)()){
28
28
register_unplug_callback (DEV_USB, callbackFunction);
29
29
}
30
30
31
- void USBStorage::removeDisconnectCallback (){
31
+ void USBStorage::removeOnDisconnectCallback (){
32
32
deregister_unplug_callback (DEV_USB);
33
33
}
34
34
Original file line number Diff line number Diff line change 1
- # include " Arduino_UnifiedStorage.h "
1
+
2
2
3
3
#ifndef USBStorage_H
4
4
#define USBStorage_H
5
5
6
+ #include " Arduino_UnifiedStorage.h"
6
7
/* *
7
8
* Represents a USB storage using the Arduino Unified Storage library.
8
9
*/
@@ -59,19 +60,18 @@ class USBStorage : public Arduino_UnifiedStorage {
59
60
60
61
void onConnect (void (* const callbackFunction)());
61
62
62
- void removeConnectCallback ();
63
+ void removeOnConnectCallback ();
63
64
64
65
void onDisconnect (void (* const callbackFunction)());
65
66
66
- void removeDisconnectCallback ();
67
+ void removeOnDisconnectCallback ();
67
68
68
69
69
70
private:
70
71
FileSystems fileSystem = FS_FAT;
71
72
bool mounted = false ;
72
73
unsigned long previousMillis;
73
- unsigned int interval = 500 ;
74
-
74
+ unsigned int interval = 500 ; // document what this does too, make it constexp (mountRetryInterval)
75
75
};
76
76
77
77
#endif
You can’t perform that action at this time.
0 commit comments