summaryrefslogtreecommitdiff
path: root/stmhal/usb.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-03-30 12:30:35 +0100
committerDamien George <damien.p.george@gmail.com>2014-03-30 12:30:35 +0100
commit09d207785c77c85c957471b064ceebe0d2ee0a23 (patch)
tree6c34e11ee61c820c807db06d3d3cd69611c13ddb /stmhal/usb.c
parent24a140a444cfb2ebda7f0b6d0a88be9461a99d03 (diff)
stmhal: Unify naming of HW config; make SD detect configurable.
All board config macros now begin with MICROPY_HW_. Renamed PYBv10 to PYBV10, since macros should be all uppercase. Made SDCARD_DETECT configurable in mpconfigport.h, so that the SD detect pin can be easily configured.
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 3d795f182..97ea2e1b4 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;