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 9:113f4934b907, committed 2018-12-19
- Comitter:
- Swabey89
- Date:
- Wed Dec 19 13:09:15 2018 +0000
- Parent:
- 8:ee8f65745141
- Child:
- 10:f2b8e3b587d5
- Commit message:
- Added ability to mount and unmount SD card
Changed in this revision
| SDCard.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/SDCard.cpp Wed Dec 19 12:02:14 2018 +0000
+++ b/SDCard.cpp Wed Dec 19 13:09:15 2018 +0000
@@ -3,9 +3,7 @@
void SDcard(void)
{
- static time_t seconds;
-
- //REQUIRES IMPROVEMENTS, SEE ONENOTE
+ static time_t seconds; //static reqiured?
//Initialise the SD card
if (sd.init() != 0) {
@@ -47,7 +45,7 @@
//Last message before sampling begins - probably remove
lcd.cls();
- lcd.printf("SYSTEM READY\n\n");
+ lcd.printf("SD CARD INIT...\n\n");
}
void SDread(int n)
@@ -79,3 +77,29 @@
//puts("SD THREAD ALIVE\n");
}
+void SDmount(void)
+{
+ while(true)
+ {
+ Thread::signal_wait(SIGNAL_SD);
+
+ //Change state of SD card
+ if (sd_init)
+ {
+ fclose(fp);
+ sd.deinit();
+ pc->printf("SD CARD UNMOUNTED\n\r");
+ lcd.cls();
+ lcd.printf("Unmounted..\n\n");
+ sd_init = false;
+
+ }
+ else
+ {
+ //try to init, if failed say cannot init, if pass then say init passed and change state of sd_init
+ SDcard();
+ }
+
+ }
+}
+
