25
25
26
26
using namespace arduino ;
27
27
28
- #if defined (COMPONENT_4343W_FS)
29
- extern QSPIFBlockDevice *qspi_bd;
30
- #endif
31
-
32
28
/* *****************************************************************************
33
29
CTOR/DTOR
34
30
******************************************************************************/
@@ -47,18 +43,20 @@ Arduino_Portenta_OTA_QSPI::Arduino_Portenta_OTA_QSPI(StorageTypePortenta const s
47
43
48
44
bool Arduino_Portenta_OTA_QSPI::init ()
49
45
{
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) {
53
52
Serial1.println (" Error: QSPI init failure." );
54
53
return false ;
55
54
}
56
- #endif
57
55
58
56
if (_storage_type == QSPI_FLASH_FATFS)
59
57
{
60
58
_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 );
62
60
if (err_mount)
63
61
{
64
62
Serial1.print (" Error while mounting the filesystem. Err = " );
@@ -70,7 +68,7 @@ bool Arduino_Portenta_OTA_QSPI::init()
70
68
71
69
if (_storage_type == QSPI_FLASH_FATFS_MBR)
72
70
{
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);
74
72
_fs_qspi = new mbed::FATFileSystem (" fs" );
75
73
int const err_mount = _fs_qspi->mount (_bd_qspi);
76
74
if (err_mount) {
0 commit comments