Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of menuSystemMbed by
console.cpp
00001 // console.cpp 00002 // 00003 00004 #include "console.h" 00005 #include "ANSITerm.h" 00006 00007 using namespace std; 00008 00009 00010 extern ANSITerm pc; 00011 00012 // 00013 // Clears the screen 00014 // 00015 void clrscr() 00016 { 00017 pc.clear_screen(); 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 pc.set_cursor_position(x,y); 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 pc.printf("%s", text); 00039 } 00040 00041 // 00042 // Set text and background colors 00043 // 00044 void setrgb(int color) 00045 { 00046 switch (color) 00047 { 00048 case 0: // White on Black 00049 00050 break; 00051 case 1: // Red on Black 00052 00053 break; 00054 case 2: // Green on Black 00055 00056 break; 00057 case 3: // Yellow on Black 00058 00059 break; 00060 case 4: // Blue on Black 00061 00062 break; 00063 case 5: // Magenta on Black 00064 00065 break; 00066 case 6: // Cyan on Black 00067 00068 break; 00069 case 7: // Black on Gray 00070 00071 break; 00072 case 8: // Black on White 00073 00074 break; 00075 case 9: // Red on White 00076 00077 break; 00078 case 10: // Green on White 00079 00080 break; 00081 case 11: // Yellow on White 00082 00083 break; 00084 case 12: // Blue on White 00085 00086 break; 00087 case 13: // Magenta on White 00088 00089 break; 00090 case 14: // Cyan on White 00091 00092 break; 00093 case 15: // White on White 00094 00095 break; 00096 default : // White on Black 00097 00098 break; 00099 } 00100 } 00101
Generated on Tue Jul 12 2022 23:00:53 by
1.7.2
