mbed menu system

console.cpp

Committer:
mbedDevLondon
Date:
2013-02-28
Revision:
2:5c4911aba273
Parent:
0:a5ece7312edc

File content as of revision 2:5c4911aba273:

// console.cpp
//

#include "console.h"
#include "ANSITerm.h"

using namespace std;


extern ANSITerm pc;

//
// Clears the screen
//
void clrscr()
{
  pc.clear_screen();
}

//
// Moves the cursor to x, y in console window
// ie x=left\right y=top\bottom
//
void gotoxy(int x, int y)
{
   pc.set_cursor_position(x,y);
}

void printXY( char * text, int x, int y)
{
    static bool runOnce = false;
    if (runOnce == false){
        clrscr();
        runOnce = true;
        }

    gotoxy( x, y);
    pc.printf("%s", text);
}

//
// Set text and background colors
//
void setrgb(int color)
{
    switch (color)
    {
    case 0:    // White on Black
        
        break;
    case 1:    // Red on Black
      
        break;
    case 2:    // Green on Black
      
        break;
    case 3:    // Yellow on Black
        
        break;
    case 4:    // Blue on Black
       
        break;
    case 5:    // Magenta on Black
      
        break;
    case 6:    // Cyan on Black
        
        break;
    case 7:    // Black on Gray
        
        break;
    case 8:    // Black on White
        
        break;
    case 9:    // Red on White
       
        break;
    case 10: // Green on White
     
        break;
    case 11: // Yellow on White
       
        break;
    case 12: // Blue on White
      
        break;
    case 13: // Magenta on White
      
        break;
    case 14: // Cyan on White
       
        break;
    case 15: // White on White
       
        break;
    default : // White on Black
       
        break;
    }
}