-
-
Notifications
You must be signed in to change notification settings - Fork 212
/
Copy path0078-PortentaH7-implement-and-use-get_default_instance-fo.patch
46 lines (39 loc) · 1.96 KB
/
0078-PortentaH7-implement-and-use-get_default_instance-fo.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From 531ab8f2cf8da34f4ecb84da172cf9eb0e64ddd9 Mon Sep 17 00:00:00 2001
From: pennam <m.pennasilico@arduino.cc>
Date: Thu, 22 Jul 2021 12:04:53 +0200
Subject: [PATCH 078/204] PortentaH7: implement and use get_default_instance
for QSPIBD
---
.../COMPONENT_WHD/port/wiced_filesystem.cpp | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/COMPONENT_WHD/port/wiced_filesystem.cpp b/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/COMPONENT_WHD/port/wiced_filesystem.cpp
index b6de4ece12..bea07abdef 100644
--- a/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/COMPONENT_WHD/port/wiced_filesystem.cpp
+++ b/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/COMPONENT_WHD/port/wiced_filesystem.cpp
@@ -36,12 +36,18 @@
#define WIFI_DEFAULT_PARTITION 1
#define WIFI_DEFAULT_FS 0
-QSPIFBlockDevice *qspi_bd = NULL;
+BlockDevice *qspi_bd = NULL;
MBRBlockDevice *mbr_bd = NULL;
FATFileSystem *wifi_fs = NULL;
wiced_filesystem_t resource_fs_handle;
+MBED_WEAK BlockDevice *BlockDevice::get_default_instance()
+{
+ static QSPIFBlockDevice default_bd(PD_11, PD_12, PF_7, PD_13, PF_10, PG_6, QSPIF_POLARITY_MODE_1, 40000000);
+ return &default_bd;
+}
+
MBED_WEAK void wiced_filesystem_mount_error(void)
{
WPRINT_WHD_ERROR(("Failed to mount the filesystem containing the WiFi firmware.\n\r"));
@@ -134,7 +140,7 @@ wiced_result_t wiced_filesystem_init(void)
{
if (mbr_bd == NULL && wifi_fs == NULL) {
WPRINT_WHD_DEBUG(("Initialize FileSystem with Mbed default settings\n\r"));
- qspi_bd = new QSPIFBlockDevice(PD_11, PD_12, PF_7, PD_13, PF_10, PG_6, QSPIF_POLARITY_MODE_1, 40000000);
+ qspi_bd = mbed::BlockDevice::get_default_instance();
if (qspi_bd->init() == BD_ERROR_OK) {
mbr_bd = new MBRBlockDevice(qspi_bd, WIFI_DEFAULT_PARTITION);
--
2.39.1