Skip to content

Commit 3721af5

Browse files
committed
Storage: FatFsOnQSPIFlash use BlockDevice::get_default_instance();
Former-commit-id: e58c522
1 parent d2361cc commit 3721af5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

libraries/Storage/examples/FatFsOnQSPIFlash/FatFsOnQSPIFlash.ino

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include <vector>
1616
#include <string>
1717
#include "QSPIFlashBlockDevice.h"
18+
#include <BlockDevice.h>
19+
#include <MBRBlockDevice.h>
1820
#include "FATFileSystem.h"
1921

2022
#define TEST_FS_NAME "qspi"
@@ -23,7 +25,8 @@
2325
#define DELETE_FILE_DIMENSION 150
2426

2527

26-
QSPIFlashBlockDevice block_device(PIN_QSPI_CLK, PIN_QSPI_SS, PIN_QSPI_D0, PIN_QSPI_D1, PIN_QSPI_D2, PIN_QSPI_D3);
28+
BlockDevice* block_device = BlockDevice::get_default_instance();
29+
MBRBlockDevice mbr(block_device, 2);
2730
FATFileSystem fs(TEST_FS_NAME);
2831

2932
std::string root_folder = std::string("/") + std::string(TEST_FS_NAME);
@@ -51,12 +54,12 @@ void setup() {
5154
*/
5255

5356
Serial.println("Mounting QSPI FLASH...");
54-
int err = fs.mount(&block_device);
57+
int err = fs.mount(&mbr);
5558
if (err) {
5659
// Reformat if we can't mount the filesystem
5760
// this should only happen on the first boot
5861
Serial.println("No filesystem found, formatting... ");
59-
err = fs.reformat(&block_device);
62+
err = fs.reformat(&mbr);
6063
}
6164

6265
if (err) {

0 commit comments

Comments
 (0)