Manejo de puerto SPI y librería Fat File System

Dependencies:   mbed SDFileSystem

Committer:
lscordovar
Date:
Fri Feb 07 20:25:50 2020 +0000
Revision:
2:e5ff7e210edf
Parent:
0:bdbd3d6fc5d5
Interfaz a Micro SD

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 0:bdbd3d6fc5d5 1 #include "mbed.h"
mbed_official 0:bdbd3d6fc5d5 2 #include "SDFileSystem.h"
mbed_official 0:bdbd3d6fc5d5 3
lscordovar 2:e5ff7e210edf 4 SDFileSystem sd(PA_7, PA_6, PA_5, PB_6, "sd"); // the pinout on the mbed Cool Components workshop board
mbed_official 0:bdbd3d6fc5d5 5
mbed_official 0:bdbd3d6fc5d5 6 int main() {
mbed_official 0:bdbd3d6fc5d5 7 printf("Hello World!\n");
mbed_official 0:bdbd3d6fc5d5 8
mbed_official 0:bdbd3d6fc5d5 9 mkdir("/sd/mydir", 0777);
mbed_official 0:bdbd3d6fc5d5 10
mbed_official 0:bdbd3d6fc5d5 11 FILE *fp = fopen("/sd/mydir/sdtest.txt", "w");
mbed_official 0:bdbd3d6fc5d5 12 if(fp == NULL) {
mbed_official 0:bdbd3d6fc5d5 13 error("Could not open file for write\n");
mbed_official 0:bdbd3d6fc5d5 14 }
mbed_official 0:bdbd3d6fc5d5 15 fprintf(fp, "Hello fun SD Card World!");
mbed_official 0:bdbd3d6fc5d5 16 fclose(fp);
mbed_official 0:bdbd3d6fc5d5 17
mbed_official 0:bdbd3d6fc5d5 18 printf("Goodbye World!\n");
mbed_official 0:bdbd3d6fc5d5 19 }