2525
2626using namespace arduino ;
2727
28- #if defined (COMPONENT_4343W_FS)
29- extern QSPIFBlockDevice *qspi_bd;
30- #endif
31-
3228/* *****************************************************************************
3329 CTOR/DTOR
3430 ******************************************************************************/
@@ -47,18 +43,20 @@ Arduino_Portenta_OTA_QSPI::Arduino_Portenta_OTA_QSPI(StorageTypePortenta const s
4743
4844bool Arduino_Portenta_OTA_QSPI::init ()
4945{
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) {
46+ #if defined (COMPONENT_4343W_FS)
47+ _bd_raw_qspi = mbed::BlockDevice::get_default_instance ();
48+ #else
49+ _bd_raw_qspi = new QSPIFBlockDevice (PD_11, PD_12, PF_7, PD_13, PF_10, PG_6, QSPIF_POLARITY_MODE_1, 40000000 );
50+ #endif
51+ if (_bd_raw_qspi->init () != QSPIF_BD_ERROR_OK) {
5352 Serial1.println (" Error: QSPI init failure." );
5453 return false ;
5554 }
56- #endif
5755
5856 if (_storage_type == QSPI_FLASH_FATFS)
5957 {
6058 _fs_qspi = new mbed::FATFileSystem (" fs" );
61- int const err_mount = _fs_qspi->mount (qspi_bd );
59+ int const err_mount = _fs_qspi->mount (_bd_raw_qspi );
6260 if (err_mount)
6361 {
6462 Serial1.print (" Error while mounting the filesystem. Err = " );
@@ -70,7 +68,7 @@ bool Arduino_Portenta_OTA_QSPI::init()
7068
7169 if (_storage_type == QSPI_FLASH_FATFS_MBR)
7270 {
73- _bd_qspi = new mbed::MBRBlockDevice (reinterpret_cast <mbed::BlockDevice *>(qspi_bd) , _data_offset);
71+ _bd_qspi = new mbed::MBRBlockDevice (_bd_raw_qspi , _data_offset);
7472 _fs_qspi = new mbed::FATFileSystem (" fs" );
7573 int const err_mount = _fs_qspi->mount (_bd_qspi);
7674 if (err_mount) {
0 commit comments