Base library for various projects.

Dependents:   LEDFun NetTester

Base library for various projects.

Files at this revision

API Documentation at this revision

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

Functions.cpp Show annotated file Show diff for this revision Revisions of this file
Functions.h Show annotated file Show diff for this revision Revisions of this file
variables.h Show annotated file Show diff for this revision Revisions of this file
diff -r a5f21c409f51 -r a3deb705b78e Functions.cpp
--- 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
diff -r a5f21c409f51 -r a3deb705b78e Functions.h
--- 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
diff -r a5f21c409f51 -r a3deb705b78e variables.h
--- 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