25
25
26
26
using namespace arduino ;
27
27
28
+ #if defined (COMPONENT_4343W_FS)
29
+ extern QSPIFBlockDevice *qspi_bd;
30
+ #endif
31
+
28
32
/* *****************************************************************************
29
33
CTOR/DTOR
30
34
******************************************************************************/
@@ -33,7 +37,6 @@ Arduino_Portenta_OTA_QSPI::Arduino_Portenta_OTA_QSPI(StorageTypePortenta const s
33
37
: Arduino_Portenta_OTA(storage_type, data_offset)
34
38
, _bd_qspi{NULL }
35
39
, _fs_qspi{NULL }
36
- , _block_device_qspi(PD_11, PD_12, PF_7, PD_13, PF_10, PG_6, QSPIF_POLARITY_MODE_1, 40000000 )
37
40
{
38
41
assert (_storage_type == QSPI_FLASH_FATFS || _storage_type == QSPI_FLASH_FATFS_MBR);
39
42
}
@@ -44,13 +47,18 @@ Arduino_Portenta_OTA_QSPI::Arduino_Portenta_OTA_QSPI(StorageTypePortenta const s
44
47
45
48
bool Arduino_Portenta_OTA_QSPI::init ()
46
49
{
47
- if (_block_device_qspi.init () != QSPIF_BD_ERROR_OK)
50
+ #if !defined (COMPONENT_4343W_FS)
51
+ qspi_bd = new QSPIFBlockDevice (PD_11, PD_12, PF_7, PD_13, PF_10, PG_6, QSPIF_POLARITY_MODE_1, 40000000 );
52
+ if (qspi_bd->init () != QSPIF_BD_ERROR_OK) {
53
+ Serial1.println (" Error: QSPI init failure." );
48
54
return false ;
55
+ }
56
+ #endif
49
57
50
58
if (_storage_type == QSPI_FLASH_FATFS)
51
59
{
52
60
_fs_qspi = new mbed::FATFileSystem (" fs" );
53
- int const err_mount = _fs_qspi->mount (&_block_device_qspi );
61
+ int const err_mount = _fs_qspi->mount (qspi_bd );
54
62
if (err_mount)
55
63
{
56
64
Serial1.print (" Error while mounting the filesystem. Err = " );
@@ -62,7 +70,7 @@ bool Arduino_Portenta_OTA_QSPI::init()
62
70
63
71
if (_storage_type == QSPI_FLASH_FATFS_MBR)
64
72
{
65
- _bd_qspi = new mbed::MBRBlockDevice (reinterpret_cast <mbed::BlockDevice *>(&_block_device_qspi ), _data_offset);
73
+ _bd_qspi = new mbed::MBRBlockDevice (reinterpret_cast <mbed::BlockDevice *>(qspi_bd ), _data_offset);
66
74
_fs_qspi = new mbed::FATFileSystem (" fs" );
67
75
int const err_mount = _fs_qspi->mount (_bd_qspi);
68
76
if (err_mount) {
0 commit comments