Serial class med valgfri baudrate
Dependents: Fancy-Terminal-Menu Fancy-Terminal
Diff: SerialTerminal.h
- Revision:
- 0:f7f6e3220ea0
- Child:
- 2:64e7d86dbac1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SerialTerminal.h Fri Oct 16 15:39:16 2015 +0000 @@ -0,0 +1,60 @@ +#include "mbed.h" + +#ifndef MBED_TERMINAL_H +#define MBED_TERMINAL_H + +/** Control and display on an ANSI/VT100 Terminal + * + * This allows you to control an ANSI serial terminal + */ +class SerialTerminal : public Serial { +public: + /** Create the Terminal interface + * + * @param tx Serial transmit + * @param rx Serial recieve + * @param baud Serial baudreate speed + */ + SerialTerminal(PinName tx, PinName rx, int baudrate); + +#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(); + + /** Set the foreground colour */ + void foreground(int colour); + + /** Set the background colour */ + void background(int colour); + + /** Hide Cursor from terminal*/ + void hideCursor(); + + /** Hide Cursor from terminal*/ + void showCursor(); +}; + +#endif