Christian Lerche
/
EAOLED_HelloWorld
EA OLED Hello World (Runs through the different possibilities with the OLED software
Embed:
(wiki syntax)
Show/hide line numbers
TextDisplay.cpp
00001 /* mbed TextDisplay Display Library Base Class 00002 * Copyright (c) 2007-2009 sford 00003 * Released under the MIT License: http://mbed.org/license/mit 00004 */ 00005 00006 #include "TextDisplay.h" 00007 00008 TextDisplay::TextDisplay() { 00009 _row = 0; 00010 _column = 0; 00011 } 00012 00013 int TextDisplay::_putc(int value) { 00014 if(value == '\n') { 00015 _column = 0; 00016 _row++; 00017 if(_row >= rows()) { 00018 _row = 0; 00019 } 00020 } else { 00021 character(_column, _row, value); 00022 _column++; 00023 if(_column >= columns()) { 00024 _column = 0; 00025 _row++; 00026 if(_row >= rows()) { 00027 _row = 0; 00028 } 00029 } 00030 } 00031 return value; 00032 } 00033 00034 // crude cls implementation, should generally be overwritten in derived class 00035 void TextDisplay::cls() { 00036 locate(0, 0); 00037 for(int i=0; i<columns()*rows(); i++) { 00038 putc(' '); 00039 } 00040 } 00041 00042 void TextDisplay::locate(int column, int row) { 00043 _column = column; 00044 _row = row; 00045 } 00046 00047 int TextDisplay::_getc() { 00048 return -1; 00049 } 00050 00051 void TextDisplay::foreground(int colour) { 00052 _foreground = colour; 00053 } 00054 00055 void TextDisplay::background(int colour) { 00056 _background = colour; 00057 }
Generated on Tue Jul 19 2022 15:52:01 by 1.7.2