An example program for the S25FL216K flash memory

Dependencies:   S25FL216K_FATFileSystem mbed

Fork of S25FL216K_HelloWorld by Erik -

Files at this revision

API Documentation at this revision

Comitter:
Sissors
Date:
Wed Jul 31 19:21:41 2013 +0000
Child:
1:e8698224bb08
Commit message:
v1.0

Changed in this revision

S25FL216K_USBFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-src.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/S25FL216K_USBFileSystem.lib	Wed Jul 31 19:21:41 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/S25FL216K_USBFileSystem/#9056eb697726
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jul 31 19:21:41 2013 +0000
@@ -0,0 +1,43 @@
+#include "mbed.h"
+#include "Flash_USBFileSystem.h"
+
+DigitalOut myled(LED1);
+FlashUSB flash(PTD6, PTD7, PTB11, PTE4);
+
+void usbCallback(bool available)
+{
+    if (available) {
+        FILE *fp = fopen("/USB/usbtest.txt", "r");
+        char buffer[100];
+        fgets (buffer, 100, fp);
+        printf("%s\r\n", buffer);
+        fclose(fp);
+    }
+}
+
+int main()
+{
+    flash.attachUSB(&usbCallback);
+
+    wait(0.1);
+    printf("Hello World!\r\n");
+
+    FILE *fp = fopen("/USB/usbtest.txt", "w");
+
+    if(fp == NULL) {
+        printf("Could not open file, assuming unformatted disk!\r\n");
+        printf("Click in the nice popup window to format disk with default settings!\r\n");
+    } else {
+        wait(0.2);
+        fprintf(fp, "Type your text here!");
+        fclose(fp);
+    }
+
+    //Connect USB
+    flash.connect();
+    while(1) {
+        wait(0.2);
+        myled = !myled;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-src.lib	Wed Jul 31 19:21:41 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/mbed-src2/#aee376ec5d1a