arranged by katano

Dependencies:   MPU9150_DMP Neon_F303K8 QuaternionMath iSDIO mbed-rtos mbed

Fork of Neon_F303K8 by Yasuhiro ISHII

taskFA.cpp

Committer:
yishii
Date:
2016-05-14
Revision:
0:65a0ae5578da
Child:
1:73543a1fbe62

File content as of revision 0:65a0ae5578da:

#include "mbed.h"
#include "common.h"
#include "SDFileSystem.h"
#include "rtos.h"

static SDFileSystem sd(PA_7,PA_6,PA_5,PA_4,"sd"); // MOSI,MISO,SCK,CS

/*
    +--------+
    |        |VOUT---+               ,--------+
    |        |       +-[47k]-----DAT2|9       |
    |    PA_4|CS-----|-------------CS|1       |
    |    PA_7|MOSI---|------------CMD|2       |
    |        |       |       +---VSS1|3   SD  |
    |  Neon  |       +-------|----VDD|4 memory|
    |    PA_5|SCK----|-------|----CLK|5  card |
    |        |       |       +---VSS2|6       |
    |    PA_6|MISO---|-------|---DAT0|7       |
    |        |       +-[47k]-|---DAT1|8       |
    |        |GND------------+       +--------+
    +--------+
*/

void TaskFA(void const *argument)
{
    pc.printf("iSDIO Initialize\r\n");
    mkdir("/sd/mydir", 0777);
    
    FILE *fp = fopen("/sd/mydir/sdtest.txt", "w");
    if(fp == NULL) {
        pc.printf("Could not open file for write\r\n");
    }
    fprintf(fp, "Hello fun SD Card World!");
    fclose(fp);
    
    pc.printf("SD process end\r\n");

    while(1){
        Thread::wait(100);
    }
}