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

sdCardReader.h

Committer:
DVLevine
Date:
2018-04-03
Revision:
0:ebe71c7e7854
Child:
1:45627bbdeb69

File content as of revision 0:ebe71c7e7854:

#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;
};