arranged by katano

Dependencies:   MPU9150_DMP Neon_F303K8 QuaternionMath iSDIO mbed-rtos mbed

Fork of Neon_F303K8 by Yasuhiro ISHII

Committer:
yishii
Date:
Sat May 14 07:11:48 2016 +0000
Revision:
0:65a0ae5578da
Child:
1:73543a1fbe62
Supported to use with Nucleo F303K8

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yishii 0:65a0ae5578da 1 #include "mbed.h"
yishii 0:65a0ae5578da 2 #include "common.h"
yishii 0:65a0ae5578da 3 #include "SDFileSystem.h"
yishii 0:65a0ae5578da 4 #include "rtos.h"
yishii 0:65a0ae5578da 5
yishii 0:65a0ae5578da 6 static SDFileSystem sd(PA_7,PA_6,PA_5,PA_4,"sd"); // MOSI,MISO,SCK,CS
yishii 0:65a0ae5578da 7
yishii 0:65a0ae5578da 8 /*
yishii 0:65a0ae5578da 9 +--------+
yishii 0:65a0ae5578da 10 | |VOUT---+ ,--------+
yishii 0:65a0ae5578da 11 | | +-[47k]-----DAT2|9 |
yishii 0:65a0ae5578da 12 | PA_4|CS-----|-------------CS|1 |
yishii 0:65a0ae5578da 13 | PA_7|MOSI---|------------CMD|2 |
yishii 0:65a0ae5578da 14 | | | +---VSS1|3 SD |
yishii 0:65a0ae5578da 15 | Neon | +-------|----VDD|4 memory|
yishii 0:65a0ae5578da 16 | PA_5|SCK----|-------|----CLK|5 card |
yishii 0:65a0ae5578da 17 | | | +---VSS2|6 |
yishii 0:65a0ae5578da 18 | PA_6|MISO---|-------|---DAT0|7 |
yishii 0:65a0ae5578da 19 | | +-[47k]-|---DAT1|8 |
yishii 0:65a0ae5578da 20 | |GND------------+ +--------+
yishii 0:65a0ae5578da 21 +--------+
yishii 0:65a0ae5578da 22 */
yishii 0:65a0ae5578da 23
yishii 0:65a0ae5578da 24 void TaskFA(void const *argument)
yishii 0:65a0ae5578da 25 {
yishii 0:65a0ae5578da 26 pc.printf("iSDIO Initialize\r\n");
yishii 0:65a0ae5578da 27 mkdir("/sd/mydir", 0777);
yishii 0:65a0ae5578da 28
yishii 0:65a0ae5578da 29 FILE *fp = fopen("/sd/mydir/sdtest.txt", "w");
yishii 0:65a0ae5578da 30 if(fp == NULL) {
yishii 0:65a0ae5578da 31 pc.printf("Could not open file for write\r\n");
yishii 0:65a0ae5578da 32 }
yishii 0:65a0ae5578da 33 fprintf(fp, "Hello fun SD Card World!");
yishii 0:65a0ae5578da 34 fclose(fp);
yishii 0:65a0ae5578da 35
yishii 0:65a0ae5578da 36 pc.printf("SD process end\r\n");
yishii 0:65a0ae5578da 37
yishii 0:65a0ae5578da 38 while(1){
yishii 0:65a0ae5578da 39 Thread::wait(100);
yishii 0:65a0ae5578da 40 }
yishii 0:65a0ae5578da 41 }