Ryan Scott / menuSystemMbedBroken

Dependencies:   ANSITermMenuSystem

Fork of menuSystemMbed by Ryan Scott

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers console.cpp Source File

console.cpp

00001 // console.cpp
00002 //
00003 
00004 #include "console.h"
00005 #include "SerialGraphicLCD.h"   // changed from "ANISTerm.h" April 2nd 2013
00006 
00007 using namespace std;
00008 
00009 
00010 extern SerialGraphicLCD lcd;  //Changed April 2nd 2013
00011 
00012 //
00013 // Clears the screen
00014 //
00015 void clrscr()
00016 {
00017   lcd.clear();    //changed from pc.clear_screen(); April 2nd 2013
00018 }
00019 
00020 //
00021 // Moves the cursor to x, y in console window
00022 // ie x=left\right y=top\bottom
00023 //
00024 void gotoxy(int x, int y)
00025 {
00026    lcd.pos(x, y);   //changed from pc.set_cursor_position(x,y); April 2nd 2013
00027 }
00028 
00029 void printXY( char * text, int x, int y)
00030 {
00031     static bool runOnce = false;
00032     if (runOnce == false){
00033         clrscr();
00034         runOnce = true;
00035         }
00036 
00037     gotoxy( x, y);
00038     lcd.printf("%s", text);    //changed from pc.printf("%s", text); April 2nd 2013
00039 }
00040 
00041 void printRec(int x1, int y1, int x2, int y2)
00042 {
00043     lcd.rect(x1, y1, x2, y2);
00044 }
00045 /*
00046 void eraseRec(int x1, int y1, int x2, int y2)
00047 {
00048     lcd.erase(x1, y1, x2, y2);              
00049 }
00050 */
00051 //
00052 // Set text and background colors
00053 //
00054 void setrgb(int color)
00055 {
00056     switch (color)
00057     {
00058     case 0:    // White on Black
00059         
00060         break;
00061     case 1:    // Red on Black
00062       
00063         break;
00064     case 2:    // Green on Black
00065       
00066         break;
00067     case 3:    // Yellow on Black
00068         
00069         break;
00070     case 4:    // Blue on Black
00071        
00072         break;
00073     case 5:    // Magenta on Black
00074       
00075         break;
00076     case 6:    // Cyan on Black
00077         
00078         break;
00079     case 7:    // Black on Gray
00080         
00081         break;
00082     case 8:    // Black on White
00083         
00084         break;
00085     case 9:    // Red on White
00086        
00087         break;
00088     case 10: // Green on White
00089      
00090         break;
00091     case 11: // Yellow on White
00092        
00093         break;
00094     case 12: // Blue on White
00095       
00096         break;
00097     case 13: // Magenta on White
00098       
00099         break;
00100     case 14: // Cyan on White
00101        
00102         break;
00103     case 15: // White on White
00104        
00105         break;
00106     default : // White on Black
00107        
00108         break;
00109     }
00110 }
00111