#include #include #include "settings.h" #include "gps.h" SdFat* card = NULL; void store_reading(uint32_t id, GPSLocation location) { SdFat card; card.begin(PIN_SPI_CS_SD); // Port the rest of this to SdFat from SD // Open the file to write the data to. If it doesn't exist it will be created. // Unlike elsewhere, FILE_WRITE opens the file with the cursor starting at the end, so it's basically actually equivalent to FILE_APPEND that we use in other environments. Confusing, I know. File handle = SD.open(SD_FILENAME, FILE_WRITE); handle.print(id); handle.print(F("\t")); handle.print(location.lat); handle.print(F("\t")); handle.print(location.lng); handle.println(); handle.close(); } void store_debug(char* buffer, int size) { File handle = SD.open(SD_FILENAME_DEBUG, FILE_WRITE); handle.write(buffer, size); handle.println(); handle.close(); }