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