![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Initial Publish Leaning GPS/SDCARD
Dependencies: FileManager GPSGms6 SDFileSystem mbed
Fork of 2545_SD_Card by
main.cpp
- Committer:
- Lucyjungz
- Date:
- 2016-05-09
- Revision:
- 4:aa7ac2ac6913
- Parent:
- 3:78eaf4291b84
- Child:
- 5:07aaa6e3784c
File content as of revision 4:aa7ac2ac6913:
/* 2545_SD_Card Example Example of writing data to SD card. Based on FTF2014_lab4 Example https://developer.mbed.org/teams/Freescale/wiki/FTF2014_workshop Craig A. Evans, University of Leeds, Mar 2016 */ #include "mbed.h" #include "SDFileSystem.h" #include "GPSGms6.h" #include "FileManager.h" // Connections to SD card holder on K64F (SPI interface) SDFileSystem sd(PA_7, PA_6, PA_5, PA_0, "sd"); // MOSI, MISO, SCK, CS Serial serial(USBTX, USBRX); // for PC debug GPSGms6 gps; Timeout t1; DigitalOut myled(LED1); float gps_interval = 3; void t1out(void) { myled = !myled; printf("\r\nGps header = %s", gps.latestGPRMC().header); printf("\r\nGps status = %s", gps.latestGPRMC().status); printf("\r\nGps time = %s", gps.latestGPRMC().time); printf("\r\nGps date = %s", gps.latestGPRMC().date); printf("\r\nGps lat = %s", gps.latestGPRMC().latitude); printf("\r\nGps long = %s", gps.latestGPRMC().longitude); printf("\r\nGps indicator = %s", gps.latestGPRMC().indicator); logGPSData( gps.latestGPRMC().date, gps.latestGPRMC().time); serial.printf("\r\n#### Restart Timer #####"); t1.attach(&t1out,gps_interval); } int main() { serial.baud(9600); // full-speed! serial.printf("\n#### SD Card Initialization #####"); // wait(1); ////////////////////// read Setup File ////////////////////////// readSetupFile(); gps_interval = (float)GPSInterval()/1000; Variable_Data_TypeDef * var_list = readVarFile(); logSystemData(gps_interval); unsigned int amount = getVarListAmount(); for (int i = 0; i < amount ; i++) { serial.printf("\r\n first var name = %s ",var_list[i].varName); serial.printf("\r\n first addr name = %s ",var_list[i].varAddress); } /////////////////////////////////////////////////// serial.printf("\n End of SD Card Initialization "); gps.start_GPS(); t1.attach(&t1out,gps_interval); while(1); }