File System Example - Writing a text file on FRMD-K64F board using 4GB Kingston SDHC
Dependencies: SDFileSystem mbed
Fork of FRDM_K64F-SDCard by
Revision 0:457fb4f2657b, committed 2014-09-17
- Comitter:
- issaiass
- Date:
- Wed Sep 17 23:53:07 2014 +0000
- Commit message:
- Initial FRDM-K64F Functional Example with SD File System library
Changed in this revision
diff -r 000000000000 -r 457fb4f2657b SDFileSystem.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SDFileSystem.lib Wed Sep 17 23:53:07 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/teams/mbed/code/SDFileSystem/#7b35d1709458
diff -r 000000000000 -r 457fb4f2657b main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Sep 17 23:53:07 2014 +0000 @@ -0,0 +1,38 @@ +/* +******************************************************************************* +* HTTP://WWW.CERESCONTROLS.COM +* PANAMÁ, REPÚBLICA DE PANAMÁ +* +* File : main.cpp +* Programer(s) : Rangel Alvarado +* Language : C/C++ +* Description : Simple SD Card File System Write +* +* Notes : Using standard mbed classes to write information data in +* the SD Card. +* http://cache.freescale.com/files/32bit/doc/user_guide/FRDMK64FUG.pdf +* +******************************************************************************* +*/ + +#include "mbed.h" // mbed application libraries +#include "SDFileSystem.h" // SD File System functions + +#define DAT0 PTE3 // MOSI +#define CMD PTE1 // MISO +#define CLK PTE2 // SCLK +#define CD PTE4 // CS + +SDFileSystem sd(DAT0, CMD, CLK, CD, "sd"); // MOSI, MISO, SCLK, CS +Serial pc(USBTX, USBRX); // Virtual COM Port + +int main() { + FILE *File = fopen("/sd/sdfile.txt", "w"); // open file + if(File == NULL) { // check if present + pc.printf("No SD Card or bad format\n"); // print message + } else { // otherwise + pc.printf("Ready to write\n"); // message preparing to write + } + fprintf(File, "FRDM-K64F"); // write data + fclose(File); // close file on SD +} \ No newline at end of file
diff -r 000000000000 -r 457fb4f2657b mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Sep 17 23:53:07 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1 \ No newline at end of file