Lukas Piwowarski / SerialTerminal

Dependents:   IMP_projekt

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SerialTerminal.h Source File

SerialTerminal.h

00001 #include "mbed.h"
00002 
00003 #ifndef MBED_TERMINAL_H
00004 #define MBED_TERMINAL_H
00005 
00006 /** Control and display on an ANSI/VT100 Terminal (puTTy or similar...)
00007  *
00008  * This allows you to control an ANSI serial terminal
00009  * Set TX pin and RX . also spesify bauderate if needed different than default 9600
00010  */ 
00011 class SerialTerminal : public Serial {
00012 public:
00013     /** Create the Terminal interface 
00014      * 
00015      * @param tx Serial transmit
00016      * @param rx Serial recieve
00017      * @param baud Serial baudreate speed (default 9600)
00018      */    
00019     SerialTerminal(PinName tx, PinName rx, int baudrate=9600);
00020 
00021 #if DOXYGEN_ONLY
00022     /** Write a character to the terminal
00023      *
00024      * @param c The character to write to the display
00025      */
00026     int putc(int c);
00027 
00028     /** Write a formated string to the terminal
00029      *
00030      * @param format A printf-style format string, followed by the
00031      *               variables to use in formating the string.
00032      */
00033     int printf(const char* format, ...);
00034     
00035     // also baud etc
00036 #endif
00037 
00038     /** Locate to a screen column and row
00039      *
00040      * @param column  The horizontal position from the left, indexed from 0
00041      * @param row     The vertical position from the top, indexed from 0
00042      */
00043     void locate(int column, int row);
00044 
00045     /** Clear the screen and locate to 0,0 */
00046     void cls();
00047 
00048     /** Set the foreground colour */
00049     void foreground(int colour);
00050 
00051     /** Set the background colour */
00052     void background(int colour);
00053     
00054     /** Hide Cursor from terminal*/
00055     void hideCursor();
00056     
00057     /** Hide Cursor from terminal*/
00058     void showCursor();
00059     
00060         /** Moves cursor up by @var step_num */
00061     void move_cursor_up(int step_num);
00062     
00063     /** Moves cursor down by @var step_num */
00064     void move_cursor_down(int step_num);
00065     
00066     /** Moves cursor righ by @var step_num */
00067     void move_cursor_right(int step_num);
00068     
00069     /** Move cursor left by @var step_num */
00070     void move_cursor_left(int step_num);
00071     
00072     /** Hides cursor */
00073     void hide_cursor();
00074     
00075     /** Enables cursor */
00076     void show_cursor();
00077 };
00078 
00079 #endif