Simon Fords Terminal with bug fix in ::locate

Dependents:   UARTSnoop BaseJpegDecode_example

Fork of Terminal by Simon Ford

Files at this revision

API Documentation at this revision

Comitter:
simon
Date:
Thu Jun 03 17:12:11 2010 +0000
Parent:
0:2bf27af3c759
Child:
2:85184c13476c
Commit message:

Changed in this revision

Terminal.cpp Show annotated file Show diff for this revision Revisions of this file
Terminal.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show diff for this revision Revisions of this file
mbed.bld Show diff for this revision Revisions of this file
--- a/Terminal.cpp	Thu Dec 31 09:50:48 2009 +0000
+++ b/Terminal.cpp	Thu Jun 03 17:12:11 2010 +0000
@@ -1,6 +1,23 @@
-/* mbed ANSI/VT100 Terminal Library
- * Copyright (c) 2007-2009 sford
- * Released under the MIT License: http://mbed.org/license/mit
+/* mbed Terminal Library, for ANSI/VT200 Terminals and ecape codes
+ * Copyright (c) 2007-2010 sford
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
  */
 
 #include "Terminal.h"
--- a/Terminal.h	Thu Dec 31 09:50:48 2009 +0000
+++ b/Terminal.h	Thu Jun 03 17:12:11 2010 +0000
@@ -1,9 +1,23 @@
-/* mbed Terminal TextDisplay Library
- * Copyright (c) 2007-2009 sford
- * Released under the MIT License: http://mbed.org/license/mit
+/* mbed Terminal Library, for ANSI/VT200 Terminals and ecape codes
+ * Copyright (c) 2007-2010 sford
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
  *
- * Implementation of ANSI/VT100 Terminal escape codes
- * for use with e.g. Teraterm, Hyperterminal
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
  */
 
 #include "mbed.h"
@@ -11,16 +25,47 @@
 #ifndef MBED_TERMINAL_H
 #define MBED_TERMINAL_H
 
+/** Interface with a ANSI/VT100 Terminal */ 
 class Terminal : public Serial {
 public:
-
+    /** Create the Terminal interface 
+     * 
+     * @param tx Serial transmit
+     * @param rx Serial recieve
+     */    
     Terminal(PinName tx, PinName rx);
 
-    // printf(), put(), baud() etc - inherited from Serial
+#if DOXYGEN_ONLY
+    /** Write a character to the terminal
+     *
+     * @param c The character to write to the display
+     */
+    int putc(int c);
 
+    /** Write a formated string to the terminal
+     *
+     * @param format A printf-style format string, followed by the
+     *               variables to use in formating the string.
+     */
+    int printf(const char* format, ...);
+    
+    // also baud etc
+#endif
+
+    /** Locate to a screen column and row
+     *
+     * @param column  The horizontal position from the left, indexed from 0
+     * @param row     The vertical position from the top, indexed from 0
+     */
+    void locate(int column, int row);
+
+    /** Clear the screen and locate to 0,0 */
     void cls();
-    void locate(int column, int row);
+
+    /** Set the foreground colour */
     void foreground(int colour);
+
+    /** Set the background colour */
     void background(int colour);
 };
 
--- a/main.cpp	Thu Dec 31 09:50:48 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-// simple test for a ANSI/VT100 Terminal, sford
-
-#include "mbed.h"
-
-#include "Terminal.h"
-
-Terminal term(USBTX, USBRX); // tx, rx
-
-int main() {
-    term.printf("Hello World!\nHow are you?");
-
-    wait(2);
-
-    term.locate(3,1);
-    term.foreground(0xFF0000);
-    term.printf("I'm Great!");
-
-    wait(3);
-
-    term.cls();
-}
--- a/mbed.bld	Thu Dec 31 09:50:48 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/32af5db564d4