@@ -17,12 +17,12 @@ InternalStorage::InternalStorage(int partition, const char * name, FileSystems f
1717 this -> fs = fs;
1818}
1919
20- int InternalStorage::begin (FileSystems fs){
20+ bool InternalStorage::begin (FileSystems fs){
2121 this -> fs = fs;
22- this -> begin ();
22+ return this -> begin ();
2323}
2424
25- int InternalStorage::begin (){
25+ bool InternalStorage::begin (){
2626 #if defined(ARDUINO_PORTENTA_C33)
2727 this -> blockDevice = BlockDevice::get_default_instance ();
2828 this -> userData = new MBRBlockDevice (this ->blockDevice , this ->partitionNumber );
@@ -51,13 +51,13 @@ int InternalStorage::begin(){
5151 this -> userDataFileSystem = new mbed::LittleFileSystem (this ->partitionName );
5252 }
5353 int err = this -> userDataFileSystem -> mount (this -> userData);
54- if ( err == 0 ) return 1 ;
54+ return err == 0 ? true : false ;
5555 #endif
5656}
5757
58- int InternalStorage::unmount (){
59- int err = this -> userDataFileSystem -> unmount ();
60- if ( err == 0 ) return 1 ;
58+ bool InternalStorage::unmount (){
59+ int err = this -> userDataFileSystem -> unmount ();
60+ return err == 0 ? true : false ;
6161}
6262
6363Folder InternalStorage::getRootFolder (){
@@ -72,7 +72,7 @@ void InternalStorage::setQSPIPartitionName(const char * name){
7272 this -> partitionName = (char *)name;
7373}
7474
75- int InternalStorage::format (FileSystems fs){
75+ bool InternalStorage::format (FileSystems fs){
7676 this -> begin ();
7777 this -> unmount ();
7878 this -> fs = fs;
@@ -81,18 +81,18 @@ int InternalStorage::format(FileSystems fs){
8181 if (fs == FS_FAT){
8282 #if defined(ARDUINO_PORTENTA_C33)
8383 this -> userDataFileSystem = new FATFileSystem (this ->partitionName );
84- return this -> userDataFileSystem -> reformat (this -> userData);
84+ return this -> userDataFileSystem -> reformat (this -> userData) == 0 ? true : false ;
8585 #elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
8686 this -> userDataFileSystem = new mbed::FATFileSystem (this ->partitionName );
87- return this -> userDataFileSystem -> reformat (this -> userData);
87+ return this -> userDataFileSystem -> reformat (this -> userData) == 0 ? true : false ;
8888 #endif
8989 } if (fs == FS_LITTLEFS) {
9090 #if defined(ARDUINO_PORTENTA_C33)
9191 this -> userDataFileSystem = new LittleFileSystem (this ->partitionName );
92- return this -> userDataFileSystem -> reformat (this -> userData);
92+ return this -> userDataFileSystem -> reformat (this -> userData) == 0 ? true : false ;
9393 #elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
9494 this -> userDataFileSystem = new mbed::LittleFileSystem (this ->partitionName );
95- return this -> userDataFileSystem -> reformat (this -> userData);
95+ return this -> userDataFileSystem -> reformat (this -> userData) == 0 ? true : false ;
9696 #endif
9797 }
9898}
0 commit comments