An example program for the S25FL216K flash memory
Dependencies: S25FL216K_FATFileSystem mbed
Fork of S25FL216K_HelloWorld by
main.cpp
- Committer:
- mkilivan
- Date:
- 2014-12-19
- Revision:
- 4:6a2931c19204
- Parent:
- 3:321618d7c9a5
- Child:
- 6:d3431822f4a9
File content as of revision 4:6a2931c19204:
#include "mbed.h" #include "Flash_USBFileSystem.h" DigitalOut myled(LED1); //FlashUSB flash(PTD6, PTD7, PTB11, PTE4); FlashUSB flash(P0_9, P0_8, P0_7, P0_6); int main() { wait(0.1); printf("Hello World!\r\n"); FILE *fp = fopen("/USB/in1.txt", "w"); if(fp == NULL) { printf("Could not open file, assuming unformatted disk!\r\n"); printf("Formatting disk!\r\n"); flash.format(); printf("Disk formatted!\r\n"); printf("Reset your device!\r\n"); while(1); } else { wait(0.2); fprintf(fp, "Type your text here!"); fclose(fp); } fp = fopen("/USB/in2.txt", "w"); if (fp == NULL) { printf("out.txt can't created.\r\n"); } else { fprintf(fp, "Hello World!\r\n"); fclose(fp); } }