Skip to content

Latest commit

 

History

History
110 lines (72 loc) · 7.3 KB

api.md

File metadata and controls

110 lines (72 loc) · 7.3 KB

Summary

Members Descriptions
enum StorageDevices Enum to select the storage device to use.
enum FileSystems Enum to select the file system to use.
enum MountFlags Enum to select the mount mode to use. The default mode is Read/Write.
public int mount(const enum StorageDevicesdeviceName, const enum FileSystemsfileSystem, const enum MountFlags mountFlags) Attach a file system to a device.
public int umount(const enum StorageDevices deviceName) Remove the attached file system from a device.
public int register_hotplug_callback(const enum StorageDevices deviceName, void(*)() callbackFunction) Register a hotplug callback function. Currently only supported for DEV_USB on Portenta C33.
public int deregister_hotplug_callback(const enum StorageDevices deviceName) Deregister a previously registered hotplug callback function. Not currently supported on any platform.
public int mkfs(const enum StorageDevicesdeviceName, const enum FileSystems fileSystem) Format a device (make file system).

Members

Enum to select the storage device to use.

Values Descriptions
DEV_SDCARD SD Card.
DEV_USB USB Thumb Drive.

Enum to select the file system to use.

Values Descriptions
FS_FAT FAT file system.
FS_LITTLEFS LittleFS file system.

Enum to select the mount mode to use. The default mode is Read/Write.

Values Descriptions
MNT_DEFAULT Default mount mode (Read/Write)
MNT_RDONLY Read only mode.

public int mount(const enum StorageDevicesdeviceName, const enum FileSystemsfileSystem, const enum MountFlags mountFlags)

Attach a file system to a device.

Parameters

  • deviceName The device to attach to: DEV_SDCARD or DEV_USB.

  • fileSystem The file system type to attach: FS_FAT or FS_LITTLEFS.

  • mountFlags The only valid flag at this time: MNT_DEFAULT.

Returns

On success: 0. On failure: -1 with an error code in the errno variable.


public int umount(const enum StorageDevices deviceName)

Remove the attached file system from a device.

Parameters

  • deviceName The device to remove from: DEV_SDCARD or DEV_USB.

Returns

On success: 0. On failure: -1 with an error code in the errno variable.


public int register_hotplug_callback(const enum StorageDevices deviceName, void(*)() callbackFunction)

Register a hotplug callback function. Currently only supported for DEV_USB on Portenta C33.

Parameters

  • deviceName The device to register for: DEV_SDCARD or DEV_USB.

  • callbackFunction A function pointer to the callback.

Returns

On success: 0. On failure: -1 with an error code in the errno variable.


public int deregister_hotplug_callback(const enum StorageDevices deviceName)

Deregister a previously registered hotplug callback function. Not currently supported on any platform.

Parameters

  • deviceName The device to deregister for: DEV_SDCARD or DEV_USB.

Returns

On success: 0. On failure: -1 with an error code in the errno variable.


public int mkfs(const enum StorageDevicesdeviceName, const enum FileSystems fileSystem)

Format a device (make file system).

Parameters

  • deviceName The device to format: DEV_SDCARD or DEV_USB.

  • fileSystem The file system type to format: FS_FAT or FS_LITTLEFS. FS_FAT is probably the better choice for both SD Cards and USB thumb drives in most cases.

Returns

On success: 0. On failure: -1 with an error code in the errno variable.