Based on Terminal lib from Simon Ford, some adds

Fork of TerminalPlus by Max Scordamaglia

Committer:
MaxScorda
Date:
Mon Sep 14 21:33:00 2015 +0000
Revision:
5:d045e3561533
Parent:
4:ee2311717b80
Child:
6:f8c90e147000
Primo abbozzo di VT100 funzionante

Who changed what in which revision?

UserRevisionLine numberNew contents of line
simon 1:96ae39e58792 1 /* mbed Terminal Library, for ANSI/VT200 Terminals and ecape codes
simon 2:85184c13476c 2 * Copyright (c) 2007-2010, sford, http://mbed.org
MaxScorda 3:e72f2addfaf8 3 * Modified by Max Scordamaglia (c) 2015
simon 1:96ae39e58792 4 *
simon 1:96ae39e58792 5 * Permission is hereby granted, free of charge, to any person obtaining a copy
simon 1:96ae39e58792 6 * of this software and associated documentation files (the "Software"), to deal
simon 1:96ae39e58792 7 * in the Software without restriction, including without limitation the rights
simon 1:96ae39e58792 8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
simon 1:96ae39e58792 9 * copies of the Software, and to permit persons to whom the Software is
simon 1:96ae39e58792 10 * furnished to do so, subject to the following conditions:
simon 0:2bf27af3c759 11 *
simon 1:96ae39e58792 12 * The above copyright notice and this permission notice shall be included in
simon 1:96ae39e58792 13 * all copies or substantial portions of the Software.
simon 1:96ae39e58792 14 *
simon 1:96ae39e58792 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
simon 1:96ae39e58792 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
simon 1:96ae39e58792 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
simon 1:96ae39e58792 18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
simon 1:96ae39e58792 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
simon 1:96ae39e58792 20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
simon 1:96ae39e58792 21 * THE SOFTWARE.
simon 0:2bf27af3c759 22 */
simon 0:2bf27af3c759 23
simon 0:2bf27af3c759 24 #include "mbed.h"
simon 0:2bf27af3c759 25
simon 0:2bf27af3c759 26 #ifndef MBED_TERMINAL_H
simon 0:2bf27af3c759 27 #define MBED_TERMINAL_H
simon 0:2bf27af3c759 28
simon 2:85184c13476c 29 /** Control and display on an ANSI/VT100 Terminal
simon 2:85184c13476c 30 *
simon 2:85184c13476c 31 * This allows you to control an ANSI serial terminal
MaxScorda 5:d045e3561533 32 */
MaxScorda 5:d045e3561533 33 class Terminal : public Serial
MaxScorda 5:d045e3561533 34 {
simon 0:2bf27af3c759 35 public:
MaxScorda 5:d045e3561533 36 /** Create the Terminal interface
MaxScorda 5:d045e3561533 37 *
simon 1:96ae39e58792 38 * @param tx Serial transmit
simon 1:96ae39e58792 39 * @param rx Serial recieve
MaxScorda 5:d045e3561533 40 */
simon 0:2bf27af3c759 41 Terminal(PinName tx, PinName rx);
simon 0:2bf27af3c759 42
simon 1:96ae39e58792 43 #if DOXYGEN_ONLY
simon 1:96ae39e58792 44 /** Write a character to the terminal
simon 1:96ae39e58792 45 *
simon 1:96ae39e58792 46 * @param c The character to write to the display
simon 1:96ae39e58792 47 */
simon 1:96ae39e58792 48 int putc(int c);
simon 0:2bf27af3c759 49
simon 1:96ae39e58792 50 /** Write a formated string to the terminal
simon 1:96ae39e58792 51 *
simon 1:96ae39e58792 52 * @param format A printf-style format string, followed by the
simon 1:96ae39e58792 53 * variables to use in formating the string.
simon 1:96ae39e58792 54 */
simon 1:96ae39e58792 55 int printf(const char* format, ...);
MaxScorda 5:d045e3561533 56
simon 1:96ae39e58792 57 // also baud etc
simon 1:96ae39e58792 58 #endif
simon 1:96ae39e58792 59
simon 1:96ae39e58792 60 /** Locate to a screen column and row
simon 1:96ae39e58792 61 *
simon 1:96ae39e58792 62 * @param column The horizontal position from the left, indexed from 0
simon 1:96ae39e58792 63 * @param row The vertical position from the top, indexed from 0
simon 1:96ae39e58792 64 */
simon 1:96ae39e58792 65 void locate(int column, int row);
simon 1:96ae39e58792 66
simon 1:96ae39e58792 67 /** Clear the screen and locate to 0,0 */
simon 0:2bf27af3c759 68 void cls();
simon 1:96ae39e58792 69
MaxScorda 5:d045e3561533 70 /** Reset Screen */
MaxScorda 5:d045e3561533 71 void reset();
MaxScorda 5:d045e3561533 72
MaxScorda 5:d045e3561533 73 /** Erase line */
MaxScorda 5:d045e3561533 74 void eraseline();
MaxScorda 5:d045e3561533 75
simon 1:96ae39e58792 76 /** Set the foreground colour */
simon 0:2bf27af3c759 77 void foreground(int colour);
simon 1:96ae39e58792 78
simon 1:96ae39e58792 79 /** Set the background colour */
simon 0:2bf27af3c759 80 void background(int colour);
MaxScorda 5:d045e3561533 81
MaxScorda 5:d045e3561533 82 /*printf formattato con dimensione e posizione*/
MaxScorda 5:d045e3561533 83 void formatPrintf(char sstr[], int xx, int yy, int padb=0);
MaxScorda 5:d045e3561533 84
MaxScorda 5:d045e3561533 85 /**Draw box */
MaxScorda 4:ee2311717b80 86 void frame(int x, int y, int w, int h, int boxtype=1);
MaxScorda 3:e72f2addfaf8 87
MaxScorda 5:d045e3561533 88 /**Banner */
MaxScorda 5:d045e3561533 89 void banner();
MaxScorda 5:d045e3561533 90
MaxScorda 5:d045e3561533 91 /**Default input pos */
MaxScorda 5:d045e3561533 92 void readypos();
MaxScorda 5:d045e3561533 93
simon 0:2bf27af3c759 94 };
simon 0:2bf27af3c759 95
simon 0:2bf27af3c759 96 #endif