Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: S25FL216K_FATFileSystem mbed
Fork of S25FL216K_HelloWorld by
Revision 6:d3431822f4a9, committed 2014-12-23
- Comitter:
- mkilivan
- Date:
- Tue Dec 23 21:41:08 2014 +0000
- Parent:
- 5:1a2c6c946686
- Commit message:
- tidy up and update library path
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/S25FL216K_FATFileSystem.lib Tue Dec 23 21:41:08 2014 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/mkilivan/code/S25FL216K_FATFileSystem/#3303a45c8980
--- a/S25FL216K_USBFileSystem.lib Fri Dec 19 14:45:49 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://developer.mbed.org/users/mkilivan/code/S25FL216K_USBFileSystem/#2642d0729f55
--- a/main.cpp Fri Dec 19 14:45:49 2014 +0000
+++ b/main.cpp Tue Dec 23 21:41:08 2014 +0000
@@ -1,17 +1,30 @@
#include "mbed.h"
-#include "Flash_USBFileSystem.h"
+#include "Flash_FileSystem.h"
-DigitalOut myled(LED1);
-//FlashUSB flash(PTD6, PTD7, PTB11, PTE4);
-FlashUSB flash(P0_9, P0_8, P0_7, P0_6);
-
+FlashSPI flash(P0_9, P0_8, P0_7, P0_6, "flash");
int main()
{
wait(0.1);
printf("Hello World!\r\n");
+ char buffer[100];
+ FILE *fp;
- FILE *fp = fopen("/USB/in1.txt", "w");
+ int i;
+
+ printf("directory list\r\n");
+ DIR *d = opendir("/flash"); // Opens the root directory of the local file system
+ struct dirent *p;
+ i = 0;
+ while((p = readdir(d)) != NULL) { // Print the names of the files in the local file system
+ printf("%s\r\n", p->d_name); // to stdout.
+ i++;
+ }
+ closedir(d);
+ printf("total %d files found.\r\n\n", i);
+
+ fp = fopen("/flash/in1.txt", "a");
+ printf("-0-\r\n");
if(fp == NULL) {
printf("Could not open file, assuming unformatted disk!\r\n");
@@ -22,15 +35,42 @@
while(1);
} else {
wait(0.2);
- fprintf(fp, "Type your text here!");
+ fprintf(fp, "hello ");
+ fclose(fp);
+ }
+
+ wait(0.5);
+
+ fp = fopen("/flash/in2.txt", "a");
+ if (fp == NULL) {
+ printf("out.txt can't created.\r\n");
+ } else {
+ wait(0.2);
+ fprintf(fp, "Hello 2 ");
fclose(fp);
}
- fp = fopen("/USB/in2.txt", "w");
+ wait(0.5);
+
+ fp = fopen("/flash/in1.txt", "r");
if (fp == NULL) {
- printf("out.txt can't created.\r\n");
- } else {
- fprintf(fp, "Hello World!\r\n");
+ printf("in1.txt can't open to read.\r\n");
+ } else
+ {
+ fgets (buffer, 100, fp);
+ printf("%s\r\n", buffer);
+ fclose(fp);
+ }
+
+ wait(0.5);
+
+ fp = fopen("/flash/in2.txt", "r");
+ if (fp == NULL) {
+ printf("in2.txt can't open to read.\r\n");
+ } else
+ {
+ fgets (buffer, 100, fp);
+ printf("%s\r\n", buffer);
fclose(fp);
}
--- a/mbed.lib Fri Dec 19 14:45:49 2014 +0000 +++ b/mbed.lib Tue Dec 23 21:41:08 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/#673126e12c73 +http://mbed.org/users/mbed_official/code/mbed/#4fc01daae5a5
