summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'stmhal/usb.c')
-rw-r--r--stmhal/usb.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/stmhal/usb.c b/stmhal/usb.c
index 3d795f1823..97ea2e1b41 100644
--- a/stmhal/usb.c
+++ b/stmhal/usb.c
@@ -31,11 +31,15 @@ void pyb_usb_dev_init(usb_device_mode_t mode, usb_storage_medium_t medium) {
USBD_Init(&hUSBDDevice, &VCP_Desc, 0);
USBD_RegisterClass(&hUSBDDevice, &USBD_CDC_MSC_HID);
USBD_CDC_RegisterInterface(&hUSBDDevice, (USBD_CDC_ItfTypeDef*)&USBD_CDC_fops);
+#if MICROPY_HW_HAS_SDCARD
if (medium == USB_STORAGE_MEDIUM_FLASH) {
USBD_MSC_RegisterStorage(&hUSBDDevice, (USBD_StorageTypeDef*)&USBD_FLASH_STORAGE_fops);
} else {
USBD_MSC_RegisterStorage(&hUSBDDevice, (USBD_StorageTypeDef*)&USBD_SDCARD_STORAGE_fops);
}
+#else
+ USBD_MSC_RegisterStorage(&hUSBDDevice, (USBD_StorageTypeDef*)&USBD_FLASH_STORAGE_fops);
+#endif
USBD_Start(&hUSBDDevice);
}
dev_is_enabled = 1;