diff options
Diffstat (limited to 'demos/STM32/RT-STM32-LWIP-FATFS-USB/main.c')
-rw-r--r-- | demos/STM32/RT-STM32-LWIP-FATFS-USB/main.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/demos/STM32/RT-STM32-LWIP-FATFS-USB/main.c b/demos/STM32/RT-STM32-LWIP-FATFS-USB/main.c index 0eaa80c40..ff591be05 100644 --- a/demos/STM32/RT-STM32-LWIP-FATFS-USB/main.c +++ b/demos/STM32/RT-STM32-LWIP-FATFS-USB/main.c @@ -1,5 +1,5 @@ /*
- ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
+ ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -204,12 +204,20 @@ static void InsertHandler(eventid_t id) { /*
* On insertion SDC initialization and FS mount.
*/
+#if HAL_USE_SDC
if (sdcConnect(&SDCD1))
+#else
+ if (mmcConnect(&MMCD1))
+#endif
return;
err = f_mount(&SDC_FS, "/", 1);
if (err != FR_OK) {
+#if HAL_USE_SDC
sdcDisconnect(&SDCD1);
+#else
+ mmcDisconnect(&MMCD1);
+#endif
return;
}
fs_ready = TRUE;
@@ -221,7 +229,11 @@ static void InsertHandler(eventid_t id) { static void RemoveHandler(eventid_t id) {
(void)id;
- sdcDisconnect(&SDCD1);
+#if HAL_USE_SDC
+ sdcDisconnect(&SDCD1);
+#else
+ mmcDisconnect(&MMCD1);
+#endif
fs_ready = FALSE;
}
@@ -300,15 +312,30 @@ int main(void) { */
shellInit();
+#if HAL_USE_SDC
/*
* Activates the SDC driver 1 using default configuration.
*/
+
sdcStart(&SDCD1, NULL);
/*
* Activates the card insertion monitor.
*/
tmr_init(&SDCD1);
+#else
+ /*
+ * Initializes the MMC driver to work with SPI3.
+ */
+ palSetPad(IOPORT3, GPIOC_SPI3_SD_CS);
+ mmcObjectInit(&MMCD1);
+ mmcStart(&MMCD1, &portab_mmccfg);
+
+ /*
+ * Activates the card insertion monitor.
+ */
+ tmr_init(&MMCD1);
+#endif
/*
* Creates the blinker thread.
|