Based on Terminal lib from Simon Ford, some adds
Fork of TerminalPlus by
Diff: Terminal.cpp
- Revision:
- 5:d045e3561533
- Parent:
- 4:ee2311717b80
- Child:
- 6:f8c90e147000
--- a/Terminal.cpp Fri Sep 11 00:15:26 2015 +0000 +++ b/Terminal.cpp Mon Sep 14 21:33:00 2015 +0000 @@ -36,7 +36,7 @@ // Cursor Home <ESC>[{ROW};{COLUMN}H // this->printf("\033[%d;%dH%c", row + 1, column + 1); //original - this->printf("\033[%d;%dH", row + 1, column + 1); + this->printf("\033[%d;%dH", row+1 , column+1 ); } static int rgb888tobgr111(int colour) @@ -63,6 +63,40 @@ this->printf("\033[%dm", c); } +void Terminal::reset() +{ + // Reset Screen + this->printf("\033c"); +} + +void Terminal::eraseline() +{ + // Reset Screen + this->printf("\033[2K"); +} + + +//************************************* +void Terminal::formatPrintf(char sstr[], int xx, int yy, int padb) +{ + char i=0; //mettere lungo come stringa + int screenColumn=80; //per ora lo forziamo + locate(xx, yy); + + //this->printf("\033[%d;%dH", xx, yy); + this->printf(sstr); + +/* + //prosegui col pad + while ((padb>0) && (i<(screenColumn-xx-1))) { + this->printf(" "); //migliorare con stringa unica + i++; + padb--; + } +*/ +} + + void Terminal::frame(int x, int y, int w, int h, int boxtype) { char B_H=0, B_V=0, B_TL=0, B_TR=0, B_BL=0, B_BR=0 ; @@ -104,5 +138,29 @@ this->printf((char *) B_BL); for(int i=x+1; i<x+w; i++) this->printf((char *) B_H); this->printf((char *) B_BR); +} +void Terminal::banner() +{ + cls(); + formatPrintf("_____ Boot screen _____\n",25,1); + formatPrintf("___ Nucleo Scorda IO Test ___\n",22,2); + // formatPrintf(fA.string2char(fA.padstr("-\n",78,'-')),1,5); //azzo funziona... + formatPrintf("Parsing \n",2,5); + formatPrintf("Funzione\n",2,7); + formatPrintf("Numero\n",22,7); + formatPrintf("Parametro\n",42,7); + // formatPrintf(fA.string2char(fA.padstr("-\n",78,'-')),1,10); //azzo funziona... + formatPrintf("Status \n",2,10); + formatPrintf("Led 1 \n",2,12); + formatPrintf("Virtual Led \n",22,12); + formatPrintf("Other Commands \n",42,12); + formatPrintf("Real Out Serial\n",62,12); + formatPrintf("Input string\n",2,15); + formatPrintf("Result\n",42,15); + // formatPrintf(fA.string2char(fA.padstr("-\n",78,'-')),1,18); //azzo funziona... + formatPrintf("Serial Input \n",2,18); } +void Terminal::readypos(){ + formatPrintf("Command: > ",2,23); + } \ No newline at end of file