Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: ELEC350_Project2 SDcard
Revision 17:c9ac3fc764b9, committed 2019-01-03
- Comitter:
- Swabey89
- Date:
- Thu Jan 03 12:18:25 2019 +0000
- Parent:
- 16:23b3be671415
- Commit message:
- Updates
Changed in this revision
| SDCard.cpp | Show annotated file Show diff for this revision Revisions of this file |
| SDCard.hpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 23b3be671415 -r c9ac3fc764b9 SDCard.cpp
--- a/SDCard.cpp Thu Jan 03 10:32:41 2019 +0000
+++ b/SDCard.cpp Thu Jan 03 12:18:25 2019 +0000
@@ -5,7 +5,7 @@
{
SD_tout.attach(SD_toutISR,TOUT_TIME_DEF);
- static time_t seconds; //static reqiured?
+ //static time_t seconds; //static reqiured?
//Initialise the SD card
if (sd.init() != 0) {
@@ -14,7 +14,7 @@
pc->printf("WARNING:SD CARD INITIALISATION FAILED\n\r");
printlock.unlock();
*/
- printQueue.call(printf,"WARNING:SD CARD INITIALISATION FAILED\n\r");
+ printQueue.call(puts,"WARNING:SD CARD INITIALISATION FAILED\r");
sd_init = false;
//lcd.cls();
//lcd.printf("CANNOT INIT SD");
@@ -29,14 +29,14 @@
pc->printf("\nSD CARD INITIALISED\n\r");
printlock.unlock();
*/
- printQueue.call(printf,"\nSD CARD INITIALISED\n\r");
+ printQueue.call(puts,"\nSD CARD INITIALISED\r\n");
//Open to WRITE
- char fileDate[30];
+ //char fileDate[30];
timeLock.lock();
seconds = time(NULL);
timeData = localtime(&seconds);
- set_time(mktime(timeData));
+ //set_time(mktime(timeData));
strftime(fileDate, 30, "sd/log_%d_%m_%y.csv", timeData);
timeLock.unlock();
fp = fopen(fileDate,"a");
@@ -48,7 +48,7 @@
pc->printf("WARNING: COULD NOT OPEN FILE FOR WRITE\n\r");
printlock.unlock();
*/
- printQueue.call(printf,"WARNING: COULD NOT OPEN FILE FOR WRITE\r\n\n");
+ printQueue.call(puts,"WARNING: COULD NOT OPEN FILE FOR WRITE\r\n");
//lcd.cls();
//lcd.printf("CANNOT OPEN FILE\n\n");
//errorCode(FATAL);
@@ -60,7 +60,7 @@
pc->printf("FILE OPEN FOR WRITING\n\n\n\r");
printlock.unlock();
*/
- printQueue.call(printf,"FILE OPEN FOR WRITING\r\n\n");
+ printQueue.call(puts,"FILE OPEN FOR WRITING\r\n");
sd_init = true;
}
fclose(fp);
@@ -120,15 +120,13 @@
{
if(sd_init)
{
- static time_t seconds;
- char fileDate[30];
+ //static time_t seconds;
+ //char fileDate[20];
timeLock.lock();
seconds = time(NULL);
- timeData = localtime(&seconds);
-
- //set_time(mktime(timeData));
-
- strftime(fileDate, 30, "sd/log_%d_%m_%y.csv", timeData);
+ timeData = localtime(&seconds);
+ //set_time(mktime(timeData));
+ strftime(fileDate, 20, "sd/log_%d_%m_%y.csv", timeData);
timeLock.unlock();
fp = fopen(fileDate,"a");
@@ -141,7 +139,7 @@
sd_init = false;
printlock.unlock();
*/
- printQueue.call(printf,"WARNING: FILE COULD NOT BE OPENED\r\n\n");
+ printQueue.call(puts,"WARNING: FILE COULD NOT BE OPENED\r\n");
sd_init = false;
samplesInBuffer.release();
oldestIndex = (oldestIndex?oldestIndex:BUFFERSIZE)-1; //Doesn't work properly - oldestindex will be increased by the conditional statement in the producer
@@ -247,7 +245,7 @@
pc->printf("SD CARD UNMOUNTED\n\r");
printlock.unlock();
*/
- printQueue.call(printf,"SD CARD UNMOUNTED\n\r");
+ printQueue.call(puts,"SD CARD UNMOUNTED\r\n");
//LCDlock.lock();
//lcd.cls();
diff -r 23b3be671415 -r c9ac3fc764b9 SDCard.hpp --- a/SDCard.hpp Thu Jan 03 10:32:41 2019 +0000 +++ b/SDCard.hpp Thu Jan 03 12:18:25 2019 +0000 @@ -6,6 +6,10 @@ #include "serial_terminal.hpp" #include "mbed_events.h" +extern char fileDate[30]; + + + extern bool sd_init; extern time_t seconds; extern tm* timeData;
