This class encapsulates all the algorithms required for the displaying strings and time dependent patterns on the lcd.

Dependents:   200943412_QuickClick

Revision:
6:8840d7e48ce7
Parent:
5:f8df5fe3dc6c
Child:
7:635883dd8c35
diff -r f8df5fe3dc6c -r 8840d7e48ce7 Display.cpp
--- a/Display.cpp	Wed Apr 12 13:25:04 2017 +0000
+++ b/Display.cpp	Wed Apr 12 22:18:00 2017 +0000
@@ -1,6 +1,6 @@
 #include "Display.h"
 #include "N5110.h"
-#include "Gamepad.h"
+#include "Controller.h"
 #include <math.h>
 
 Display::Display()
@@ -31,13 +31,11 @@
      x = 0; 
      y = 0; 
      x0 = 0;
-    y0 = 0;
+    y0 = 0; 
 }
 
 void Display::drawCircle(N5110 &lcd)
 {  
-    lcd.clear();
-    random_instruction(lcd);
     Circle(lcd);  
     calculateWait(); 
     _h++; 
@@ -45,20 +43,19 @@
     lcd.refresh();
     } 
 
-int Display::calculateWait() 
+void Display::calculateWait() 
 {  
    _w = 0.4*exp(-0.03465*_h);
     
-    return _v;
 } 
    
-void Display::random_instruction(N5110 &lcd) { 
-    _v = rand() % 4 + 1;  
-    if (_v == 1){
+void Display::display_instruction(N5110 &lcd, int ran) {  
+    lcd.clear();
+    if (ran == 1){
         lcd.printChar('A',40,2); } 
-    else if (_v == 2){
+    else if (ran == 2){
         lcd.printChar('B',40,2); }  
-    else if (_v == 3){
+    else if (ran == 3){
         lcd.printChar('X',40,2); }  
     else {
         lcd.printChar('Y',40,2); }