Terminal interface for communicating with serial ANSI/VT100 terminals

Dependents:   Terminal_HelloWorld geigercounter01 geigercounter04 DiscoTech ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Terminal.h Source File

Terminal.h

00001 /* mbed Terminal Library, for ANSI/VT200 Terminals and ecape codes
00002  * Copyright (c) 2007-2010, sford, http://mbed.org
00003  *
00004  * Permission is hereby granted, free of charge, to any person obtaining a copy
00005  * of this software and associated documentation files (the "Software"), to deal
00006  * in the Software without restriction, including without limitation the rights
00007  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00008  * copies of the Software, and to permit persons to whom the Software is
00009  * furnished to do so, subject to the following conditions:
00010  *
00011  * The above copyright notice and this permission notice shall be included in
00012  * all copies or substantial portions of the Software.
00013  *
00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00019  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00020  * THE SOFTWARE.
00021  */
00022 
00023 #include "mbed.h"
00024 
00025 #ifndef MBED_TERMINAL_H
00026 #define MBED_TERMINAL_H
00027 
00028 /** Control and display on an ANSI/VT100 Terminal
00029  *
00030  * This allows you to control an ANSI serial terminal
00031  */ 
00032 class Terminal : public Serial {
00033 public:
00034     /** Create the Terminal interface 
00035      * 
00036      * @param tx Serial transmit
00037      * @param rx Serial recieve
00038      */    
00039     Terminal(PinName tx, PinName rx);
00040 
00041 #if DOXYGEN_ONLY
00042     /** Write a character to the terminal
00043      *
00044      * @param c The character to write to the display
00045      */
00046     int putc(int c);
00047 
00048     /** Write a formated string to the terminal
00049      *
00050      * @param format A printf-style format string, followed by the
00051      *               variables to use in formating the string.
00052      */
00053     int printf(const char* format, ...);
00054     
00055     // also baud etc
00056 #endif
00057 
00058     /** Locate to a screen column and row
00059      *
00060      * @param column  The horizontal position from the left, indexed from 0
00061      * @param row     The vertical position from the top, indexed from 0
00062      */
00063     void locate(int column, int row);
00064 
00065     /** Clear the screen and locate to 0,0 */
00066     void cls();
00067 
00068     /** Set the foreground colour */
00069     void foreground(int colour);
00070 
00071     /** Set the background colour */
00072     void background(int colour);
00073 };
00074 
00075 #endif