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 RA8875 by
Diff: TextDisplay.cpp
- Revision:
- 19:3f82c1161fd2
- Parent:
- 0:de9d1462a835
- Child:
- 29:422616aa04bd
--- a/TextDisplay.cpp Tue Oct 22 20:17:29 2013 +0000 +++ b/TextDisplay.cpp Sun Jan 12 17:40:32 2014 +0000 @@ -2,10 +2,11 @@ * Copyright (c) 2007-2009 sford * Released under the MIT License: http://mbed.org/license/mit */ - + #include "TextDisplay.h" -TextDisplay::TextDisplay(const char *name) : Stream(name){ +TextDisplay::TextDisplay(const char *name) : Stream(name) +{ _row = 0; _column = 0; if (name == NULL) { @@ -15,8 +16,9 @@ sprintf(_path, "/%s", name); } } - -int TextDisplay::_putc(int value) { + +int TextDisplay::_putc(int value) +{ if(value == '\n') { _column = 0; _row++; @@ -38,33 +40,43 @@ } // crude cls implementation, should generally be overwritten in derived class -void TextDisplay::cls() { +RetCode_t TextDisplay::cls() +{ locate(0, 0); for(int i=0; i<columns()*rows(); i++) { putc(' '); } + return noerror; } -void TextDisplay::locate(int column, int row) { +RetCode_t TextDisplay::locate(unsigned int column, unsigned int row) +{ _column = column; _row = row; + return noerror; } -int TextDisplay::_getc() { +int TextDisplay::_getc() +{ return -1; } - -void TextDisplay::foreground(uint16_t colour) { + +RetCode_t TextDisplay::foreground(uint16_t colour) +{ _foreground = colour; + return noerror; } -void TextDisplay::background(uint16_t colour) { +RetCode_t TextDisplay::background(uint16_t colour) +{ _background = colour; + return noerror; } -bool TextDisplay::claim (FILE *stream) { +bool TextDisplay::claim (FILE *stream) +{ if ( _path == NULL) { - fprintf(stderr, "claim requires a name to be given in the instantioator of the TextDisplay instance!\r\n"); + fprintf(stderr, "claim requires a name to be given in the instantiator of the TextDisplay instance!\r\n"); return false; } if (freopen(_path, "w", stream) == NULL) { @@ -74,4 +86,4 @@ // make sure we use line buffering setvbuf(stdout, NULL, _IOLBF, columns()); return true; -} +}