TextLCD compatible wrapper for NOKIA_5110 library
Fork of TextLCD by
TextLCD_NOKIA_5110.h
- Committer:
- davervw
- Date:
- 2014-01-18
- Revision:
- 9:8a3f38cbadd5
- Parent:
- TextLCD.h@ 8:308d188a2d3a
File content as of revision 9:8a3f38cbadd5:
/* mbed TextLCD5110 Library, for Nokia 5110 LCDs * Original Copyright (c) 2007-2010, sford, http://mbed.org * Revisions Copyright (c) 2014, David R. Van Wagner, https://mbed.org/users/davervw/ * * 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. */ #ifndef MBED_TEXTLCD_H #define MBED_TEXTLCD_H #include "mbed.h" #include "NOKIA_5110.h" /** A TextLCD compatible interface for driving Nokia 5110 LCDs * * @code * #include "mbed.h" * #include "TextLCD5110.h" * * TextLCD5110 lcd(p5, p7, p24, p25, p26); * * int main() { * lcd.printf("Hello World!\n"); * } * @endcode */ class TextLCD5110 : public Stream { public: /** Create a TextLCD5110 interface * * @param mosi serial in line (din) * @param sclk serial clock line (sclk) * @param dc data/command select line * @param cse Enable line (chip select) * @param reset Reset line */ TextLCD5110(PinName mosi, PinName sclk, PinName dc, PinName cse, PinName reset); #if DOXYGEN_ONLY /** Write a character to the LCD * * @param c The character to write to the display */ int putc(int c); /** Write a formated string to the LCD * * @param format A printf-style format string, followed by the * variables to use in formating the string. */ int printf(const char* format, ...); #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(); int rows(); int columns(); int get_row(); int get_column(); protected: // Stream implementation functions virtual int _putc(int value); virtual int _getc(); int _column; int _row; NokiaLcd *pLcd; void character(int column, int row, int c); }; #endif