Menu system broken

Dependencies:   ANSITermMenuSystem

Fork of menuSystemMbed by Ryan Scott

Committer:
Rybowonder
Date:
Sat May 04 17:37:57 2013 +0000
Revision:
8:6ddb8c26387a
Parent:
7:df9f5b6dd4ed
For Mitchener

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbedDevLondon 0:a5ece7312edc 1 // console.cpp
mbedDevLondon 0:a5ece7312edc 2 //
mbedDevLondon 0:a5ece7312edc 3
mbedDevLondon 0:a5ece7312edc 4 #include "console.h"
Rybowonder 4:1178a1905490 5 #include "SerialGraphicLCD.h" // changed from "ANISTerm.h" April 2nd 2013
mbedDevLondon 0:a5ece7312edc 6
mbedDevLondon 0:a5ece7312edc 7 using namespace std;
mbedDevLondon 0:a5ece7312edc 8
mbedDevLondon 0:a5ece7312edc 9
Rybowonder 4:1178a1905490 10 extern SerialGraphicLCD lcd; //Changed April 2nd 2013
mbedDevLondon 0:a5ece7312edc 11
mbedDevLondon 0:a5ece7312edc 12 //
mbedDevLondon 0:a5ece7312edc 13 // Clears the screen
mbedDevLondon 0:a5ece7312edc 14 //
mbedDevLondon 0:a5ece7312edc 15 void clrscr()
mbedDevLondon 0:a5ece7312edc 16 {
Rybowonder 4:1178a1905490 17 lcd.clear(); //changed from pc.clear_screen(); April 2nd 2013
mbedDevLondon 0:a5ece7312edc 18 }
mbedDevLondon 0:a5ece7312edc 19
mbedDevLondon 0:a5ece7312edc 20 //
mbedDevLondon 0:a5ece7312edc 21 // Moves the cursor to x, y in console window
mbedDevLondon 0:a5ece7312edc 22 // ie x=left\right y=top\bottom
mbedDevLondon 0:a5ece7312edc 23 //
mbedDevLondon 0:a5ece7312edc 24 void gotoxy(int x, int y)
mbedDevLondon 0:a5ece7312edc 25 {
Rybowonder 4:1178a1905490 26 lcd.pos(x, y); //changed from pc.set_cursor_position(x,y); April 2nd 2013
mbedDevLondon 0:a5ece7312edc 27 }
mbedDevLondon 0:a5ece7312edc 28
mbedDevLondon 0:a5ece7312edc 29 void printXY( char * text, int x, int y)
mbedDevLondon 0:a5ece7312edc 30 {
mbedDevLondon 0:a5ece7312edc 31 static bool runOnce = false;
mbedDevLondon 0:a5ece7312edc 32 if (runOnce == false){
mbedDevLondon 0:a5ece7312edc 33 clrscr();
mbedDevLondon 0:a5ece7312edc 34 runOnce = true;
mbedDevLondon 0:a5ece7312edc 35 }
mbedDevLondon 0:a5ece7312edc 36
mbedDevLondon 0:a5ece7312edc 37 gotoxy( x, y);
Rybowonder 4:1178a1905490 38 lcd.printf("%s", text); //changed from pc.printf("%s", text); April 2nd 2013
mbedDevLondon 0:a5ece7312edc 39 }
mbedDevLondon 0:a5ece7312edc 40
Rybowonder 5:92389cf2106d 41 void printRec(int x1, int y1, int x2, int y2)
Rybowonder 5:92389cf2106d 42 {
Rybowonder 5:92389cf2106d 43 lcd.rect(x1, y1, x2, y2);
Rybowonder 5:92389cf2106d 44 }
Rybowonder 6:2f220f5d782d 45 /*
Rybowonder 5:92389cf2106d 46 void eraseRec(int x1, int y1, int x2, int y2)
Rybowonder 5:92389cf2106d 47 {
Rybowonder 7:df9f5b6dd4ed 48 lcd.erase(x1, y1, x2, y2);
Rybowonder 5:92389cf2106d 49 }
Rybowonder 6:2f220f5d782d 50 */
mbedDevLondon 0:a5ece7312edc 51 //
mbedDevLondon 0:a5ece7312edc 52 // Set text and background colors
mbedDevLondon 0:a5ece7312edc 53 //
mbedDevLondon 0:a5ece7312edc 54 void setrgb(int color)
mbedDevLondon 0:a5ece7312edc 55 {
mbedDevLondon 0:a5ece7312edc 56 switch (color)
mbedDevLondon 0:a5ece7312edc 57 {
mbedDevLondon 0:a5ece7312edc 58 case 0: // White on Black
mbedDevLondon 0:a5ece7312edc 59
mbedDevLondon 0:a5ece7312edc 60 break;
mbedDevLondon 0:a5ece7312edc 61 case 1: // Red on Black
mbedDevLondon 0:a5ece7312edc 62
mbedDevLondon 0:a5ece7312edc 63 break;
mbedDevLondon 0:a5ece7312edc 64 case 2: // Green on Black
mbedDevLondon 0:a5ece7312edc 65
mbedDevLondon 0:a5ece7312edc 66 break;
mbedDevLondon 0:a5ece7312edc 67 case 3: // Yellow on Black
mbedDevLondon 0:a5ece7312edc 68
mbedDevLondon 0:a5ece7312edc 69 break;
mbedDevLondon 0:a5ece7312edc 70 case 4: // Blue on Black
mbedDevLondon 0:a5ece7312edc 71
mbedDevLondon 0:a5ece7312edc 72 break;
mbedDevLondon 0:a5ece7312edc 73 case 5: // Magenta on Black
mbedDevLondon 0:a5ece7312edc 74
mbedDevLondon 0:a5ece7312edc 75 break;
mbedDevLondon 0:a5ece7312edc 76 case 6: // Cyan on Black
mbedDevLondon 0:a5ece7312edc 77
mbedDevLondon 0:a5ece7312edc 78 break;
mbedDevLondon 0:a5ece7312edc 79 case 7: // Black on Gray
mbedDevLondon 0:a5ece7312edc 80
mbedDevLondon 0:a5ece7312edc 81 break;
mbedDevLondon 0:a5ece7312edc 82 case 8: // Black on White
mbedDevLondon 0:a5ece7312edc 83
mbedDevLondon 0:a5ece7312edc 84 break;
mbedDevLondon 0:a5ece7312edc 85 case 9: // Red on White
mbedDevLondon 0:a5ece7312edc 86
mbedDevLondon 0:a5ece7312edc 87 break;
mbedDevLondon 0:a5ece7312edc 88 case 10: // Green on White
mbedDevLondon 0:a5ece7312edc 89
mbedDevLondon 0:a5ece7312edc 90 break;
mbedDevLondon 0:a5ece7312edc 91 case 11: // Yellow on White
mbedDevLondon 0:a5ece7312edc 92
mbedDevLondon 0:a5ece7312edc 93 break;
mbedDevLondon 0:a5ece7312edc 94 case 12: // Blue on White
mbedDevLondon 0:a5ece7312edc 95
mbedDevLondon 0:a5ece7312edc 96 break;
mbedDevLondon 0:a5ece7312edc 97 case 13: // Magenta on White
mbedDevLondon 0:a5ece7312edc 98
mbedDevLondon 0:a5ece7312edc 99 break;
mbedDevLondon 0:a5ece7312edc 100 case 14: // Cyan on White
mbedDevLondon 0:a5ece7312edc 101
mbedDevLondon 0:a5ece7312edc 102 break;
mbedDevLondon 0:a5ece7312edc 103 case 15: // White on White
mbedDevLondon 0:a5ece7312edc 104
mbedDevLondon 0:a5ece7312edc 105 break;
mbedDevLondon 0:a5ece7312edc 106 default : // White on Black
mbedDevLondon 0:a5ece7312edc 107
mbedDevLondon 0:a5ece7312edc 108 break;
mbedDevLondon 0:a5ece7312edc 109 }
mbedDevLondon 0:a5ece7312edc 110 }
mbedDevLondon 0:a5ece7312edc 111