2017年度の製作を開始します。

Dependencies:   BufferedSoftSerial2 SDFileSystem-RTOS mbed mbed-rtos INA226_ver1

Fork of keiki2016ver5 by albatross

Files at this revision

API Documentation at this revision

Comitter:
tsumagari
Date:
Sat May 27 03:23:13 2017 +0000
Branch:
Thread-gyogetsuMPU
Parent:
55:a291462053d3
Child:
57:d415d463a605
Commit message:
SDfilesystem-rtos??????????

Changed in this revision

SDFileSystem-RTOS.lib Show annotated file Show diff for this revision Revisions of this file
SDFileSystem.lib Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem-RTOS.lib	Sat May 27 03:23:13 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/Sissors/code/SDFileSystem-RTOS/#da69a01b8096
--- a/SDFileSystem.lib	Fri May 19 10:02:09 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://developer.mbed.org/users/mbed_official/code/SDFileSystem/#8a6740f6c555
--- a/main.cpp	Fri May 19 10:02:09 2017 +0000
+++ b/main.cpp	Sat May 27 03:23:13 2017 +0000
@@ -5,11 +5,11 @@
 #include "Fusokukei.h"
 #include "MPU6050.h"
 #include "BufferedSoftSerial.h"
-//#include "SDFileSystem.h"
+#include "SDFileSystem.h"//2014.6/5以前の環境で動作します。アップデートすると動きません。
 
 #define SOUDA_DATAS_NUM 28 //(yokutan 7 + input 7)*2
 #define YOKUTAN_DATAS_NUM 14
-#define WRITE_DATAS_NUM 30 // souda_datas_num + 6( rpy, airspeed, height, cadence)
+#define WRITE_DATAS_NUM 34 // souda_datas_num + 6( rpy, airspeed, height, cadence)
 #define SD_WRITE_NUM 20
 #define MPU_LOOP_TIME 0.01
 #define AIR_LOOP_TIME 0.01//(0.002005)
@@ -33,8 +33,8 @@
 }
 //-------------------------------------------------------
 
-//SDFileSystem sd(p5, p6, p7, p8, "sd");
-//FILE* fp;
+SDFileSystem sd(p5, p6, p7, p8, "sd");
+FILE* fp;
 
 //RawSerial pc(USBTX,USBRX);
 Serial android(p9,p10);
@@ -85,7 +85,7 @@
 void mpuProcessing(void const *arg);
 void DataReceiveFromSouda(void const *arg);
 void SdInit();
-//void SDprintf();
+void SDprintf();
 void WriteDatas();
 float calcAttackAngle();
 float calcKXdeg(float x);
@@ -142,7 +142,7 @@
     android.baud(9600);
     //writeTimer.start();
     FusokukeiInit();
-//    SdInit();
+    SdInit();
 //    MpuInit();
     //writeDatasTicker.attach(&WriteDatas,1);
 //    cadenceUpdateTicker.attach(&updateCadence, 0.2);
@@ -246,30 +246,30 @@
     }//if
 //    }//while(1)
 }
-//
-//void SdInit(){
-//    mkdir("/sd/mydir", 0777);
-//    fp = fopen("/sd/mydir/sdtest2.csv", "w");
-//    if(fp == NULL) {
-//        error("Could not open file for write\n");
-//    }
-//    fprintf(fp, "Hello fun SD Card World!\n\r");
-//    fclose(fp);
-//}
-//
-//void SDprintf(){
-//    fp = fopen("/sd/mydir/data.csv", "a");
-//    if(fp == NULL) {
-//        error("Could not open file for write\n");
-//    }
-//    for(int i = 0; i < SD_WRITE_NUM; i++){
-//        for(int j = 0; j < WRITE_DATAS_NUM; j++){
-//            fprintf(fp,"%f,", writeDatas[i][j]);
-//        }
-//    }
-//    fprintf(fp,"\n\r");
-//    fclose(fp);
-//}
+
+void SdInit(){
+    mkdir("/sd/mydir", 0777);
+    fp = fopen("/sd/mydir/sdtest2.csv", "w");
+    if(fp == NULL) {
+        error("Could not open file for write\n");
+    }
+    fprintf(fp, "Hello fun SD Card World!\n\r%f",0.1f);
+    fclose(fp);
+}
+
+void SDprintf(){
+    fp = fopen("/sd/mydir/data.csv", "a");
+    if(fp == NULL) {
+        error("Could not open file for write\n");
+    }
+    for(int i = 0; i < SD_WRITE_NUM; i++){
+        for(int j = 0; j < WRITE_DATAS_NUM; j++){
+            fprintf(fp,"%f,", writeDatas[i][j]);
+        }
+    }
+    fprintf(fp,"\n");
+    fclose(fp);
+}
 
 void WriteDatas()
 {
@@ -292,7 +292,7 @@
 //    //pc.printf("\n\r");
 //    twe.printf("\n\r");
     if(write_datas_index == SD_WRITE_NUM-1) {
-//        SDprintf();
+        SDprintf();
         write_datas_index=0;
     } else {
         write_datas_index++;
@@ -331,7 +331,7 @@
 //        }
 //        android.printf("%f,%f,%f,",pitch,roll,yaw);
 //        android.printf("%f,%f,\r\n",airSpeed,sonarDist);
-        android.printf("%4.2f,%4.2f,%4.2,\n,",roll,airSpeed,cadence_twe.cadence);
+        android.printf("%4.2f,%4.2f,%4.2f,\n,",roll,airSpeed,cadence_twe.cadence);
         led2 = !led2;
     }
 //    SDprintf();
@@ -383,7 +383,7 @@
 int main()
 {
 //    Thread cadence_thread(&updateCadence);
-    Thread mpu_thread(&mpuProcessing);
+//    Thread mpu_thread(&mpuProcessing);
 //    Thread soudaSerial_thread(&DataReceiveFromSouda);
     init();
     while(1) {
--- a/mbed-rtos.lib	Fri May 19 10:02:09 2017 +0000
+++ b/mbed-rtos.lib	Sat May 27 03:23:13 2017 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/mbed_official/code/mbed-rtos/#58563e6cba1e
+http://developer.mbed.org/users/mbed_official/code/mbed-rtos/#3761f69dbbb2
--- a/mbed.bld	Fri May 19 10:02:09 2017 +0000
+++ b/mbed.bld	Sat May 27 03:23:13 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/093f2bd7b9eb
\ No newline at end of file
+https://mbed.org/users/mbed_official/code/mbed/builds/0b3ab51c8877
\ No newline at end of file