This class encapsulates all the algorithms required for the displaying strings and time dependent patterns on the lcd.
Dependents: 200943412_QuickClick
Diff: Display.cpp
- Revision:
- 7:635883dd8c35
- Parent:
- 6:8840d7e48ce7
- Child:
- 8:aa20647ac4e6
--- a/Display.cpp Wed Apr 12 22:18:00 2017 +0000 +++ b/Display.cpp Wed Apr 12 23:45:40 2017 +0000 @@ -52,13 +52,26 @@ void Display::display_instruction(N5110 &lcd, int ran) { lcd.clear(); if (ran == 1){ - lcd.printChar('A',40,2); } - else if (ran == 2){ - lcd.printChar('B',40,2); } - else if (ran == 3){ - lcd.printChar('X',40,2); } + lcd.printString("PRESS",28,2); + lcd.printChar('A',40,3); } + else if (ran == 2){ + lcd.printString("PRESS",28,2); + lcd.printChar('B',40,3); } + else if (ran == 3){ + lcd.printString("PRESS",28,2); + lcd.printChar('X',40,3); } + else if (ran == 4){ + lcd.printString("PRESS",28,2); + lcd.printChar('Y',40,3); } + else if (ran == 5){ + lcd.printString("FLICK",28,2); + lcd.printChar('L',40,3); } + else if (ran == 6){ + lcd.printString("FLICK",28,2); + lcd.printChar('R',40,3); } else { - lcd.printChar('Y',40,2); } + lcd.printString("PRESS",28,2); + lcd.printString("JS",37,3); } lcd.refresh(); } @@ -87,7 +100,7 @@ int a1; int b1; - radiusError = 1-x; + radiusMod = 1-x; x0 = 42; y0 = 24; @@ -131,29 +144,18 @@ break; } } - - + lcd.setPixel( a1 + x0, b1 + y0); - - // lcd.setPixel(-x + x0, y + y0); - // lcd.setPixel( y + x0, x + y0); - // lcd.setPixel(-y + x0, x + y0); - // lcd.setPixel(-y + x0, -x + y0); - // lcd.setPixel( y + x0, -x + y0); - // lcd.setPixel( x + x0, -y + y0); - /// lcd.setPixel(-x + x0, -y + y0); - - y++; - if (radiusError<0) { - radiusError += 2 * y + 1; + if (radiusMod<0) { + radiusMod += 2*y+1; } else { x--; - radiusError += 2 * (y - x) + 1; + radiusMod += 2*(y-x)+1; } }