5959#if defined(ARDUINO_PORTENTA_C33)
6060 #include < SDCardBlockDevice.h>
6161 #include < UsbHostMsd.h>
62- #elif defined(ARDUINO_PORTENTA_H7_M7)
63- #include < SDMMCBlockDevice.h>
62+ #elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
6463 #include < Arduino_USBHostMbed5.h>
6564 #include < BlockDevice.h>
6665 // Necessary for Portenta Machine Control detection
6766 #include < DigitalIn.h>
67+
68+
69+ #elif defined(ARDUINO_PORTENTA_H7_M7) || ! defined(ARDUINO_OPTA)
70+ #include < SDMMCBlockDevice.h>
6871#else
6972 #error "The POSIXStorage library does not support this board"
7073#endif
7578*********************************************************************************************************
7679*/
7780
78- #if defined(ARDUINO_PORTENTA_H7_M7)
81+ #if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
7982 using mbed::BlockDevice;
8083 using mbed::FileSystem;
8184#endif
@@ -142,7 +145,7 @@ bool runningOnMachineControl = false;
142145namespace {
143146
144147// 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)
146149
147150// WARNING: This algorithm has been tested for radiated interference immunity with a
148151// chattering relay device, so please don't modify it without running such a test again!
@@ -210,7 +213,7 @@ enum BoardTypes detectBoardType()
210213{
211214#if defined(ARDUINO_PORTENTA_C33)
212215 return BOARD_PORTENTA_C33;
213- #elif defined(ARDUINO_PORTENTA_H7_M7)
216+ #elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
214217 #if (defined(AUTOMATIC_OVERRIDE_PORTENTA_H7) && defined(AUTOMATIC_OVERRIDE_PORTENTA_MACHINE_CONTROL))
215218 #error "You have defined AUTOMATIC_OVERRIDE_PORTENTA_H7 and AUTOMATIC_OVERRIDE_PORTENTA_MACHINE_CONTROL at the same time"
216219 #endif
@@ -231,7 +234,7 @@ void deleteDevice(const enum DeviceNames deviceName, struct DeviceFileSystemComb
231234 // The USBHostMSD class for the H7 doesn't correctly support object destruction, so we only delete
232235 // the device object on other platforms or if the device is an SD Card -->
233236 bool deleteDevice = false ;
234- #if (!defined(ARDUINO_PORTENTA_H7_M7))
237+ #if (!defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA) )
235238 (void ) deviceName; // Silence -Wunused-parameter, because this variable is only used on the H7
236239 deleteDevice = true ;
237240#else
@@ -360,7 +363,7 @@ int mountOrFormatSDCard(const enum FileSystems fileSystem,
360363 }
361364
362365 // 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)
364367 if (true == runningOnMachineControl)
365368 {
366369 return ENOTBLK;
@@ -377,7 +380,7 @@ int mountOrFormatSDCard(const enum FileSystems fileSystem,
377380 PIN_SDHI_D3,
378381 PIN_SDHI_CD,
379382 PIN_SDHI_WP);
380- #elif defined(ARDUINO_PORTENTA_H7_M7)
383+ #elif defined(ARDUINO_PORTENTA_H7_M7) || !defined(ARDUINO_OPTA)
381384 sdcard.device = new (std::nothrow) SDMMCBlockDevice ();
382385#else
383386 sdcard.device = nullptr ;
@@ -402,7 +405,7 @@ int mountOrFormatSDCard(const enum FileSystems fileSystem,
402405int mountOrFormatUSBDevice (const enum FileSystems fileSystem,
403406 const enum ActionTypes mountOrFormat)
404407{
405- #if defined(ARDUINO_PORTENTA_H7_M7)
408+ #if defined(ARDUINO_PORTENTA_H7_M7)
406409 if (true == runningOnMachineControl)
407410 {
408411 // 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
597600 errno = EBUSY;
598601 return -1 ;
599602 }
600- #if defined(ARDUINO_PORTENTA_H7_M7)
603+ #if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_OPTA)
601604 // There is no support for callbacks in the USBHostMSD class on this platform
602605 errno = ENOTSUP;
603606 return -1 ;
0 commit comments