A set of data recording functions to locally store data in a circular buffer, with functions for offloading to an SD Card when convenient. dataRecorderr.h shows accessible functions to the main program - all direct SD operations are abstracted away by the library. When using this library, #include dataRecorder.h

Dependencies:   sd-driver_compatible_with_MAX32630FTHR

Fork of CircularBufferSDCardLib by Daniel Levine

Revision:
0:ebe71c7e7854
Child:
1:45627bbdeb69
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sdCardReader.h	Tue Apr 03 21:50:25 2018 +0000
@@ -0,0 +1,36 @@
+#include "mbed.h"
+#include "SDBlockDevice.h"
+#include "iostream"
+#include "stdio.h"
+#include "string"
+#include "vector"
+#include <errno.h>
+#include "HeapBlockDevice.h"
+
+// File systems
+//#include "LittleFileSystem.h"
+#include "FATFileSystem.h"
+
+class SDCardReader : public SDBlockDevice{
+    public:
+        SDCardReader(PinName a=MBED_CONF_SD_SPI_MOSI, PinName b=MBED_CONF_SD_SPI_MISO, PinName c=MBED_CONF_SD_SPI_CLK, PinName d=MBED_CONF_SD_SPI_CS):SDBlockDevice(a, b, c, d){
+            };
+        
+        //static SDBlockDevice m_sd(MBED_CONF_SD_SPI_MOSI, MBED_CONF_SD_SPI_MISO, MBED_CONF_SD_SPI_CLK, MBED_CONF_SD_SPI_CS);
+        //SDBlockDevice* m_sd;//(MBED_CONF_SD_SPI_MOSI, MBED_CONF_SD_SPI_MISO, MBED_CONF_SD_SPI_CLK, MBED_CONF_SD_SPI_CS);
+        
+        // File system declaration
+        FATFileSystem fs("fs");
+        
+        int writeBlock(uint8_t* blockToWrite, int dataLength);        
+        int writeData(string title, string dataToWrite);
+        
+        int writeFile(string filename); 
+        int eraseData();
+        //string readData();       
+    private:
+        FILE * mountFileSystem();
+        
+    
+        uint8_t block[512]; // block of data;
+};