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.
Revision 2:a3deb705b78e, committed 2013-08-01
- Comitter:
- Searle95
- Date:
- Thu Aug 01 12:14:19 2013 +0000
- Parent:
- 1:a5f21c409f51
- Commit message:
- Added in a system restart at the end of cycle, version variable added for ease and minor timing changes. Version updated to 1.05.
Changed in this revision
--- a/Functions.cpp Thu Aug 01 09:14:47 2013 +0000
+++ b/Functions.cpp Thu Aug 01 12:14:19 2013 +0000
@@ -1,6 +1,7 @@
#include "Functions.h"
#include "screens.h"
#include "variables.h"
+#include "rtos.h"
Ethernet eth;
EthernetInterface eth1;
@@ -13,6 +14,8 @@
int loading_loop;
int loading_line;
+double version = 1.05;
+
void Functions::Intro() {
lcd.init();
lcd.cls();
@@ -20,7 +23,8 @@
wait(1);
lcd.cls();
lcd.writeString(16, 1, "NetTester", NORMAL);
- lcd.writeString(26, 2, "V1.00", NORMAL);
+ lcd.writeString(26, 2, "V", NORMAL);
+ lcd.printf("%g", version);
lcd.writeString(13, 3, "Dan Searle", NORMAL);
wait(5);
}
@@ -32,7 +36,8 @@
lcd.cls();
lcd.writeString(3, 1,"To change the", NORMAL);
lcd.writeString(2, 2,"contrast level", NORMAL);
- lcd.writeString(3, 3,"use 'u' & 'd'", NORMAL);
+ lcd.writeString(1, 3,"use the up and", NORMAL);
+ lcd.writeString(8, 4,"down arrows", NORMAL);
wait(5);
while(1) {
@@ -42,18 +47,18 @@
lcd.writeString(7, 4,"Contrast:", NORMAL);
lcd.printf("\n%X", contrast);
char c = pc.getc();
- if(c == 'u') {
+ if(c == 0x41) {
contrast += 1;
lcd.init();
}
- if(c == 'd') {
+ if(c == 0x42) {
contrast -= 1;
lcd.init();
}
if(c == 'c') {
break;
}
- wait(0.5);
+ wait(0.1);
}
}
@@ -156,4 +161,32 @@
lcd.cls();
lcd.printf("IP:\n\n\n\n\n\n\n\n\n\n\n");
lcd.printf("%s", eth1.getIPAddress());
+}
+
+void Functions::SystemRestart() {
+ double led1_bright = 0.0;
+ double led2_bright = 0.0;
+ double led3_bright = 0.0;
+ double led4_bright = 0.0;
+
+ lcd.writeString(1, 4,"'z' to restart", NORMAL);
+
+ while(1) {
+ char c = pc.getc();
+ if(c == 'z') {
+ lcd.cls();
+ lcd.writeString(24, 2, "System", NORMAL);
+ lcd.writeString(22, 3, "Restart", NORMAL);
+ led1_bright += 1.0;
+ led2_bright += 1.0;
+ led3_bright += 1.0;
+ led4_bright += 1.0;
+ led1 = led1_bright;
+ led2 = led2_bright;
+ led3 = led3_bright;
+ led4 = led4_bright;
+ wait(2);
+ NVIC_SystemReset();
+ }
+ }
}
\ No newline at end of file
--- a/Functions.h Thu Aug 01 09:14:47 2013 +0000
+++ b/Functions.h Thu Aug 01 12:14:19 2013 +0000
@@ -25,6 +25,9 @@
/*Retreive and display current IP address on lcd screen*/
void IPSettings();
+
+ /*On z key press restart system*/
+ void SystemRestart();
};
#endif
\ No newline at end of file
--- a/variables.h Thu Aug 01 09:14:47 2013 +0000 +++ b/variables.h Thu Aug 01 12:14:19 2013 +0000 @@ -11,5 +11,6 @@ extern int packets; extern int loading_loop; extern int loading_line; +extern double version; #endif \ No newline at end of file