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.
Diff: SavedGames/SavedGames.cpp
- Revision:
- 51:35cb8e604b72
- Parent:
- 50:13c8710985f4
- Child:
- 52:feb8cf28bcff
diff -r 13c8710985f4 -r 35cb8e604b72 SavedGames/SavedGames.cpp
--- a/SavedGames/SavedGames.cpp Tue May 19 16:05:18 2020 +0000
+++ b/SavedGames/SavedGames.cpp Tue May 19 16:46:40 2020 +0000
@@ -11,13 +11,14 @@
void SavedGames::init(SDFileSystem &sd,N5110 &lcd){
error_ = false;
check_sd_present(sd,lcd);
-
-
+ check_open_file(sd,lcd);
}
void SavedGames::check_sd_present(SDFileSystem &sd,N5110 &lcd){
if(!sd.card_present()) {
error_ = true;
+
+ //print error screen
lcd.clear();
lcd.printString("SD card not ",9,3);
lcd.printString(" present ",9,4);
@@ -26,6 +27,29 @@
}
}
+void SavedGames::check_open_file(SDFileSystem &sd,N5110 &lcd){
+ //opens file
+ FILE *fp;
+ fp = fopen("/sd/SavedGames.text", "a");
+
+ //checks if file is opened corectly
+ if (fp == NULL) {
+ error_ = true;
+
+ //print error screen
+ lcd.clear();
+ lcd.printString(" Unable to ",9,3);
+ lcd.printString(" open file ",9,4);
+ lcd.refresh();
+ wait(3);
+ }
+}
+
+void SavedGames::add_saved_data(SDFileSystem &sd, struct SavedGamesData){
+ FILE *fp;
+
+}
+
bool SavedGames::get_error(){
return error_;
}