Mathew Swabey / SDCard

Dependents:   ELEC350_Project2 SDcard

Files at this revision

API Documentation at this revision

Comitter:
Swabey89
Date:
Sat Nov 10 16:28:49 2018 +0000
Parent:
3:c6e5dd2faa22
Child:
5:0d49326968ca
Commit message:
Changes made to have fs global. See OneNote for what to do

Changed in this revision

SDCard.cpp Show annotated file Show diff for this revision Revisions of this file
SDCard.hpp Show annotated file Show diff for this revision Revisions of this file
--- a/SDCard.cpp	Fri Nov 09 17:56:55 2018 +0000
+++ b/SDCard.cpp	Sat Nov 10 16:28:49 2018 +0000
@@ -17,10 +17,11 @@
     } 
     
     //Create a filing system for SD Card
-    FATFileSystem fs("sd", &sd);     
-
+    //FATFileSystem fs("sd", &sd);     
+    fs = new FATFileSystem("sd", &sd);
+    
     //Open to WRITE
-    FILE* fp = fopen("/sd/newtest.csv","a");
+    fp = fopen("/sd/q.csv","a");
     if (fp == NULL) {
         error("Could not open file for write\n");
         lcd.cls();
@@ -28,6 +29,7 @@
         errorCode(FATAL);
     }
     
+    
     fclose(fp);
     
     //Last message before sampling begins
@@ -74,9 +76,8 @@
 
 void SDaddSample(double temp, double pressure)
 {
-    //Add the sampled data to the SD card
-    
-    FILE* fp = fopen("/sd/newtest.csv","a");
+    //Add the sampled data to the SD card    
+    fp = fopen("/sd/q.csv","a");
     fprintf(fp, "%6.1f,%.2f\n\r", temp, pressure);
     fclose(fp);
     puts("SAMPLE ADDED TO SD CARD");
--- a/SDCard.hpp	Fri Nov 09 17:56:55 2018 +0000
+++ b/SDCard.hpp	Sat Nov 10 16:28:49 2018 +0000
@@ -7,6 +7,8 @@
 #include "mbed_events.h"
 
 extern EventQueue SDqueue;
+extern FILE* fp;
+extern FATFileSystem* fs;
 
 void SDcard(void);
 void SDread(int n);