diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-11-14 19:17:40 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-11-14 19:17:40 +0000 |
commit | 99b688bc5e1ef930459d2523883539b1948ff5cd (patch) | |
tree | b98ac58d434321a7b1dbded9070ee776117a50d4 /demos | |
parent | 5e1dae48aa2456e7ed58b782fb3ae80e005d5e08 (diff) | |
download | ChibiOS-99b688bc5e1ef930459d2523883539b1948ff5cd.tar.gz ChibiOS-99b688bc5e1ef930459d2523883539b1948ff5cd.tar.bz2 ChibiOS-99b688bc5e1ef930459d2523883539b1948ff5cd.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1296 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos')
-rw-r--r-- | demos/ARMCM3-STM32F103-FATFS-GCC/main.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/demos/ARMCM3-STM32F103-FATFS-GCC/main.c b/demos/ARMCM3-STM32F103-FATFS-GCC/main.c index a41d666f8..e01977ac0 100644 --- a/demos/ARMCM3-STM32F103-FATFS-GCC/main.c +++ b/demos/ARMCM3-STM32F103-FATFS-GCC/main.c @@ -25,6 +25,8 @@ #include <evtimer.h>
#include <test.h>
+#include <ff.h>
+
#include "board.h"
/*
@@ -67,6 +69,11 @@ static bool_t mmc_is_protected(void) { return (bool_t)palReadPad(IOPORT3, GPIOC_MMCWP);
}
+/**
+ * @brief FS object. + */
+FATFS MMC_FS;
+
/*
* Red LEDs blinker thread, times are in milliseconds.
*/
@@ -97,9 +104,19 @@ static void TimerHandler(eventid_t id) { * MMC card insertion event.
*/
static void InsertHandler(eventid_t id) {
+ FRESULT err;
(void)id;
- mmcConnect(&MMCD1);
+ /*
+ * On insertion MMC initialization and FS mount. + */
+ if (mmcConnect(&MMCD1))
+ return;
+ err = f_mount(0, &MMC_FS);
+ if (err != FR_OK) {
+ mmcDisconnect(&MMCD1);
+ return;
+ }
}
/*
@@ -146,8 +163,6 @@ int main(int argc, char **argv) { */
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
-// spiStop(&SPID1);
-
/*
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and listed for events.
|