2525
2626using namespace arduino ;
2727
28+ #if defined (COMPONENT_4343W_FS)
29+ extern QSPIFBlockDevice *qspi_bd;
30+ #endif
31+
2832/* *****************************************************************************
2933 CTOR/DTOR
3034 ******************************************************************************/
@@ -33,7 +37,6 @@ Arduino_Portenta_OTA_QSPI::Arduino_Portenta_OTA_QSPI(StorageTypePortenta const s
3337: Arduino_Portenta_OTA(storage_type, data_offset)
3438, _bd_qspi{NULL }
3539, _fs_qspi{NULL }
36- , _block_device_qspi(PD_11, PD_12, PF_7, PD_13, PF_10, PG_6, QSPIF_POLARITY_MODE_1, 40000000 )
3740{
3841 assert (_storage_type == QSPI_FLASH_FATFS || _storage_type == QSPI_FLASH_FATFS_MBR);
3942}
@@ -44,13 +47,18 @@ Arduino_Portenta_OTA_QSPI::Arduino_Portenta_OTA_QSPI(StorageTypePortenta const s
4447
4548bool Arduino_Portenta_OTA_QSPI::init ()
4649{
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." );
4854 return false ;
55+ }
56+ #endif
4957
5058 if (_storage_type == QSPI_FLASH_FATFS)
5159 {
5260 _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 );
5462 if (err_mount)
5563 {
5664 Serial1.print (" Error while mounting the filesystem. Err = " );
@@ -62,7 +70,7 @@ bool Arduino_Portenta_OTA_QSPI::init()
6270
6371 if (_storage_type == QSPI_FLASH_FATFS_MBR)
6472 {
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);
6674 _fs_qspi = new mbed::FATFileSystem (" fs" );
6775 int const err_mount = _fs_qspi->mount (_bd_qspi);
6876 if (err_mount) {
0 commit comments