59
59
#if defined(ARDUINO_PORTENTA_C33)
60
60
#include < SDCardBlockDevice.h>
61
61
#include < UsbHostMsd.h>
62
- #elif defined(ARDUINO_PORTENTA_H7_M7)
63
- #include < SDMMCBlockDevice.h>
62
+ #elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
64
63
#include < Arduino_USBHostMbed5.h>
65
64
#include < BlockDevice.h>
66
65
// Necessary for Portenta Machine Control detection
67
66
#include < DigitalIn.h>
67
+
68
+
69
+ #elif defined(ARDUINO_PORTENTA_H7_M7) || ! defined(ARDUINO_OPTA)
70
+ #include < SDMMCBlockDevice.h>
68
71
#else
69
72
#error "The POSIXStorage library does not support this board"
70
73
#endif
75
78
*********************************************************************************************************
76
79
*/
77
80
78
- #if defined(ARDUINO_PORTENTA_H7_M7)
81
+ #if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
79
82
using mbed::BlockDevice;
80
83
using mbed::FileSystem;
81
84
#endif
@@ -142,7 +145,7 @@ bool runningOnMachineControl = false;
142
145
namespace {
143
146
144
147
// This detection code only works on the Portenta H7 boards -->
145
- #if defined(ARDUINO_PORTENTA_H7_M7)
148
+ #if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
146
149
147
150
// WARNING: This algorithm has been tested for radiated interference immunity with a
148
151
// chattering relay device, so please don't modify it without running such a test again!
@@ -210,7 +213,7 @@ enum BoardTypes detectBoardType()
210
213
{
211
214
#if defined(ARDUINO_PORTENTA_C33)
212
215
return BOARD_PORTENTA_C33;
213
- #elif defined(ARDUINO_PORTENTA_H7_M7)
216
+ #elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
214
217
#if (defined(AUTOMATIC_OVERRIDE_PORTENTA_H7) && defined(AUTOMATIC_OVERRIDE_PORTENTA_MACHINE_CONTROL))
215
218
#error "You have defined AUTOMATIC_OVERRIDE_PORTENTA_H7 and AUTOMATIC_OVERRIDE_PORTENTA_MACHINE_CONTROL at the same time"
216
219
#endif
@@ -231,7 +234,7 @@ void deleteDevice(const enum DeviceNames deviceName, struct DeviceFileSystemComb
231
234
// The USBHostMSD class for the H7 doesn't correctly support object destruction, so we only delete
232
235
// the device object on other platforms or if the device is an SD Card -->
233
236
bool deleteDevice = false ;
234
- #if (!defined(ARDUINO_PORTENTA_H7_M7))
237
+ #if (!defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA) )
235
238
(void ) deviceName; // Silence -Wunused-parameter, because this variable is only used on the H7
236
239
deleteDevice = true ;
237
240
#else
@@ -360,7 +363,7 @@ int mountOrFormatSDCard(const enum FileSystems fileSystem,
360
363
}
361
364
362
365
// The Machine Control doesn't have an SD Card connector
363
- #if defined(ARDUINO_PORTENTA_H7_M7)
366
+ #if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
364
367
if (true == runningOnMachineControl)
365
368
{
366
369
return ENOTBLK;
@@ -377,7 +380,7 @@ int mountOrFormatSDCard(const enum FileSystems fileSystem,
377
380
PIN_SDHI_D3,
378
381
PIN_SDHI_CD,
379
382
PIN_SDHI_WP);
380
- #elif defined(ARDUINO_PORTENTA_H7_M7)
383
+ #elif defined(ARDUINO_PORTENTA_H7_M7) || !defined(ARDUINO_OPTA)
381
384
sdcard.device = new (std::nothrow) SDMMCBlockDevice ();
382
385
#else
383
386
sdcard.device = nullptr ;
@@ -402,7 +405,7 @@ int mountOrFormatSDCard(const enum FileSystems fileSystem,
402
405
int mountOrFormatUSBDevice (const enum FileSystems fileSystem,
403
406
const enum ActionTypes mountOrFormat)
404
407
{
405
- #if defined(ARDUINO_PORTENTA_H7_M7)
408
+ #if defined(ARDUINO_PORTENTA_H7_M7)
406
409
if (true == runningOnMachineControl)
407
410
{
408
411
// We need to apply power manually to the female USB A connector on the Machine Control
@@ -597,7 +600,7 @@ int register_hotplug_callback(const enum DeviceNames deviceName, void (* const c
597
600
errno = EBUSY;
598
601
return -1 ;
599
602
}
600
- #if defined(ARDUINO_PORTENTA_H7_M7)
603
+ #if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
601
604
// There is no support for callbacks in the USBHostMSD class on this platform
602
605
errno = ENOTSUP;
603
606
return -1 ;
0 commit comments