Daniel Levine / CircularBufferSDCardLib

Dependencies:   sd-driver_compatible_with_MAX32630FTHR

Fork of CircularBufferSDCardLib by Daniel Levine

Files at this revision

API Documentation at this revision

Comitter:
DVLevine
Date:
Sat Apr 07 04:57:09 2018 +0000
Parent:
9:a2ba4015796e
Child:
11:c70e8305ddd7
Commit message:
added field to change number of data fields to be written

Changed in this revision

dataRecorder.cpp Show annotated file Show diff for this revision Revisions of this file
dataRecorder.h Show annotated file Show diff for this revision Revisions of this file
--- a/dataRecorder.cpp	Fri Apr 06 04:01:33 2018 +0000
+++ b/dataRecorder.cpp	Sat Apr 07 04:57:09 2018 +0000
@@ -1,7 +1,7 @@
 #include "dataRecorder.h"
 
 /* CONSTRUCTOR*/
-DataRecorder::DataRecorder(){
+DataRecorder::DataRecorder(int numDataFields){
   //Initialize SDCard Reader Class
   m_saveBuddy = new SDCardReader();
 
@@ -113,8 +113,10 @@
     timeArr[i] = popLastTimeStamp(); 
     
     //data aggregation
-    vector<uint16_t> dataEntry(1);
-    dataEntry[0] = popLastDataPoint(); 
+    vector<uint16_t> dataEntry(m_numDataFields);
+    for (int j=0;j<m_numDataFields;j++){
+        dataEntry[i] = popLastDataPoint(); 
+    }
     allDataArr[i] = dataEntry;
     printf("%i\n",static_cast<int>(dataEntry[0]));
   }
--- a/dataRecorder.h	Fri Apr 06 04:01:33 2018 +0000
+++ b/dataRecorder.h	Sat Apr 07 04:57:09 2018 +0000
@@ -11,7 +11,7 @@
 #define SSTR( x ) static_cast< std::ostringstream & >(( std::ostringstream() << std::dec << x ) ).str()
 
 // Define circular buffer size
-#define BUF_SIZE    350
+#define BUF_SIZE    2000
 
 
 /** Data Recorder is a class that stores data measurements in a ring buffer. 
@@ -19,7 +19,7 @@
 
 class DataRecorder{
   public:
-  DataRecorder();
+  DataRecorder(int numDataFields);
     /** Get Information **/
     // gets the number of values stored in the circular buffer
     int getDataQuantity();
@@ -57,6 +57,8 @@
     
     /* SD Card Interface Object  */
     SDCardReader* m_saveBuddy;
+    
+    int m_numDataFields;