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