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.
Dependencies: ANSITermMenuSystem
Fork of menuSystemMbed by
Constantdisplay.cpp
00001 // 00002 // MainMenu.cpp 00003 // menuSystem 00004 // 00005 // Created by BradDSmith on 2013-02-26. 00006 // Copyright (c) 2013 BradDSmith. All rights reserved. 00007 // 00008 00009 #include "Constantdisplay.h" 00010 00011 #include "console.h" 00012 00013 Constantdisplay::Constantdisplay() 00014 { 00015 maxitems = MAXCDISPLAYITEMS; 00016 } 00017 00018 void Constantdisplay::setMaxCdisplayItems(int max) 00019 { 00020 maxitems = max; 00021 } 00022 00023 void Constantdisplay::setCdisplayItem(int locID, const char * CdisplayText, int x, int y, int x2, int y2) 00024 { 00025 CdisplayItem[locID].initialize( (char *)CdisplayText,x, y, x2 ,y2); 00026 } 00027 00028 void Constantdisplay::printCdisplay() 00029 { 00030 for (int i = 0; i < maxitems; i++) { 00031 CdisplayItem[i].print(); 00032 } 00033 } 00034 00035 void Constantdisplay::updatedisplayitem(int ID, char * updateText) 00036 { 00037 CdisplayItem[ID].setValue(updateText); 00038 } 00039 00040 void Constantdisplay::printrect(int ID, int x1, int y1, int x2, int y2) 00041 { 00042 CdisplayItem[ID].Crect(x1, y1, x2, y2); 00043 } 00044 /* 00045 void Constantdisplay::deleterect(int ID, int x1, int y1, int x2, int y2) 00046 { 00047 CdisplayItem[ID].DeleteCrect(x1, y1, x2, y2); 00048 } 00049 */ 00050 /* itoa: convert n to characters in s */ 00051 void Constantdisplay::itoa(int n, char s[]) 00052 { 00053 int i, sign; 00054 00055 if ((sign = n) < 0) /* record sign */ 00056 n = -n; /* make n positive */ 00057 i = 0; 00058 do { /* generate digits in reverse order */ 00059 s[i++] = n % 10 + '0'; /* get next digit */ 00060 } while ((n /= 10) > 0); /* delete it */ 00061 if (sign < 0) 00062 s[i++] = '-'; 00063 s[i] = '\0'; 00064 reverse(s); 00065 } 00066 00067 void Constantdisplay::reverse(char *s) 00068 { 00069 char *j; 00070 int c; 00071 00072 j = s + strlen(s) - 1; 00073 while(s < j) { 00074 c = *s; 00075 *s++ = *j; 00076 *j-- = c; 00077 } 00078 } 00079 00080 00081
Generated on Sat Jul 23 2022 00:51:58 by
1.7.2
