modified Library from sford for use with TeraTerm / VT100 emulation without sending any signs after a \"locate\" command. edited Line 35 -> deleted %c
Terminal.h@0:acdab91342e6, 2012-01-26 (annotated)
- Committer:
- Ipu
- Date:
- Thu Jan 26 19:30:33 2012 +0000
- Revision:
- 0:acdab91342e6
Version without sending different signs after locate
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Ipu | 0:acdab91342e6 | 1 | /* mbed Terminal Library, for ANSI/VT200 Terminals and ecape codes |
Ipu | 0:acdab91342e6 | 2 | * Copyright (c) 2007-2010, sford, http://mbed.org |
Ipu | 0:acdab91342e6 | 3 | * |
Ipu | 0:acdab91342e6 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
Ipu | 0:acdab91342e6 | 5 | * of this software and associated documentation files (the "Software"), to deal |
Ipu | 0:acdab91342e6 | 6 | * in the Software without restriction, including without limitation the rights |
Ipu | 0:acdab91342e6 | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
Ipu | 0:acdab91342e6 | 8 | * copies of the Software, and to permit persons to whom the Software is |
Ipu | 0:acdab91342e6 | 9 | * furnished to do so, subject to the following conditions: |
Ipu | 0:acdab91342e6 | 10 | * |
Ipu | 0:acdab91342e6 | 11 | * The above copyright notice and this permission notice shall be included in |
Ipu | 0:acdab91342e6 | 12 | * all copies or substantial portions of the Software. |
Ipu | 0:acdab91342e6 | 13 | * |
Ipu | 0:acdab91342e6 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
Ipu | 0:acdab91342e6 | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
Ipu | 0:acdab91342e6 | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
Ipu | 0:acdab91342e6 | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
Ipu | 0:acdab91342e6 | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
Ipu | 0:acdab91342e6 | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
Ipu | 0:acdab91342e6 | 20 | * THE SOFTWARE. |
Ipu | 0:acdab91342e6 | 21 | */ |
Ipu | 0:acdab91342e6 | 22 | |
Ipu | 0:acdab91342e6 | 23 | #include "mbed.h" |
Ipu | 0:acdab91342e6 | 24 | |
Ipu | 0:acdab91342e6 | 25 | #ifndef MBED_TERMINAL_H |
Ipu | 0:acdab91342e6 | 26 | #define MBED_TERMINAL_H |
Ipu | 0:acdab91342e6 | 27 | |
Ipu | 0:acdab91342e6 | 28 | /** Control and display on an ANSI/VT100 Terminal |
Ipu | 0:acdab91342e6 | 29 | * |
Ipu | 0:acdab91342e6 | 30 | * This allows you to control an ANSI serial terminal |
Ipu | 0:acdab91342e6 | 31 | */ |
Ipu | 0:acdab91342e6 | 32 | class Terminal : public Serial { |
Ipu | 0:acdab91342e6 | 33 | public: |
Ipu | 0:acdab91342e6 | 34 | /** Create the Terminal interface |
Ipu | 0:acdab91342e6 | 35 | * |
Ipu | 0:acdab91342e6 | 36 | * @param tx Serial transmit |
Ipu | 0:acdab91342e6 | 37 | * @param rx Serial recieve |
Ipu | 0:acdab91342e6 | 38 | */ |
Ipu | 0:acdab91342e6 | 39 | Terminal(PinName tx, PinName rx); |
Ipu | 0:acdab91342e6 | 40 | |
Ipu | 0:acdab91342e6 | 41 | #if DOXYGEN_ONLY |
Ipu | 0:acdab91342e6 | 42 | /** Write a character to the terminal |
Ipu | 0:acdab91342e6 | 43 | * |
Ipu | 0:acdab91342e6 | 44 | * @param c The character to write to the display |
Ipu | 0:acdab91342e6 | 45 | */ |
Ipu | 0:acdab91342e6 | 46 | int putc(int c); |
Ipu | 0:acdab91342e6 | 47 | |
Ipu | 0:acdab91342e6 | 48 | /** Write a formated string to the terminal |
Ipu | 0:acdab91342e6 | 49 | * |
Ipu | 0:acdab91342e6 | 50 | * @param format A printf-style format string, followed by the |
Ipu | 0:acdab91342e6 | 51 | * variables to use in formating the string. |
Ipu | 0:acdab91342e6 | 52 | */ |
Ipu | 0:acdab91342e6 | 53 | int printf(const char* format, ...); |
Ipu | 0:acdab91342e6 | 54 | |
Ipu | 0:acdab91342e6 | 55 | // also baud etc |
Ipu | 0:acdab91342e6 | 56 | #endif |
Ipu | 0:acdab91342e6 | 57 | |
Ipu | 0:acdab91342e6 | 58 | /** Locate to a screen column and row |
Ipu | 0:acdab91342e6 | 59 | * |
Ipu | 0:acdab91342e6 | 60 | * @param column The horizontal position from the left, indexed from 0 |
Ipu | 0:acdab91342e6 | 61 | * @param row The vertical position from the top, indexed from 0 |
Ipu | 0:acdab91342e6 | 62 | */ |
Ipu | 0:acdab91342e6 | 63 | void locate(int column, int row); |
Ipu | 0:acdab91342e6 | 64 | |
Ipu | 0:acdab91342e6 | 65 | /** Clear the screen and locate to 0,0 */ |
Ipu | 0:acdab91342e6 | 66 | void cls(); |
Ipu | 0:acdab91342e6 | 67 | |
Ipu | 0:acdab91342e6 | 68 | /** Set the foreground colour */ |
Ipu | 0:acdab91342e6 | 69 | void foreground(int colour); |
Ipu | 0:acdab91342e6 | 70 | |
Ipu | 0:acdab91342e6 | 71 | /** Set the background colour */ |
Ipu | 0:acdab91342e6 | 72 | void background(int colour); |
Ipu | 0:acdab91342e6 | 73 | }; |
Ipu | 0:acdab91342e6 | 74 | |
Ipu | 0:acdab91342e6 | 75 | #endif |