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.
NokiaLCD.h
00001 /* mbed NokiaLCD Library, for a 130x130 Nokia colour LCD 00002 * Copyright (c) 2007-2010, sford 00003 * 00004 * Permission is hereby granted, free of charge, to any person obtaining a copy 00005 * of this software and associated documentation files (the "Software"), to deal 00006 * in the Software without restriction, including without limitation the rights 00007 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00008 * copies of the Software, and to permit persons to whom the Software is 00009 * furnished to do so, subject to the following conditions: 00010 * 00011 * The above copyright notice and this permission notice shall be included in 00012 * all copies or substantial portions of the Software. 00013 * 00014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00015 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00016 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00017 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00018 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00019 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00020 * THE SOFTWARE. 00021 */ 00022 00023 #ifndef MBED_NOKIALCD_H 00024 #define MBED_NOKIALCD_H 00025 00026 #include "mbed.h" 00027 00028 /** An interface for the 130x130 Nokia Mobile phone screens 00029 * 00030 * @code 00031 * #include "mbed.h" 00032 * #include "NokiaLCD.h" 00033 * 00034 * NokiaLCD lcd(p5, p7, p8, p9); // mosi, sclk, cs, rst 00035 * 00036 * int main() { 00037 * lcd.printf("Hello World!"); 00038 * } 00039 */ 00040 class NokiaLCD : public Stream { 00041 00042 public: 00043 /** LCD panel format */ 00044 enum LCDType { 00045 LCD6100 /**< Nokia 6100, as found on sparkfun board (default) */ 00046 , LCD6610 /**< Nokia 6610, as found on olimex board */ 00047 , LCD3300 /**< Nokia 3300, as found on aitendo */ 00048 , PCF8833 00049 }; 00050 00051 /** Create and Nokia LCD interface, using a SPI and two DigitalOut interfaces 00052 * 00053 * @param mosi SPI data out 00054 * @param sclk SPI clock 00055 * @param cs Chip Select (DigitalOut) 00056 * @param rst Reset (DigitalOut) 00057 * @param type The LCDType to select driver chip variants 00058 */ 00059 NokiaLCD(PinName mosi, PinName sclk, PinName cs, PinName rst, LCDType type = LCD3300); 00060 00061 #if DOXYGEN_ONLY 00062 /** Write a character to the LCD 00063 * 00064 * @param c The character to write to the display 00065 */ 00066 int putc(int c); 00067 00068 /** Write a formated string to the LCD 00069 * 00070 * @param format A printf-style format string, followed by the 00071 * variables to use in formating the string. 00072 */ 00073 int printf(const char* format, ...); 00074 #endif 00075 00076 /** Locate to a screen column and row 00077 * 00078 * @param column The horizontal position from the left, indexed from 0 00079 * @param row The vertical position from the top, indexed from 0 00080 */ 00081 void locate(int column, int row); 00082 00083 /** Clear the screen and locate to 0,0 */ 00084 void cls(); 00085 00086 void pixel(int x, int y, int colour); 00087 void fill(int x, int y, int width, int height, int colour); 00088 00089 void blit(int x, int y, int width, int height, const int* colour); 00090 void bitblit(int x, int y, int width, int height, const char* bitstream); 00091 00092 int width(); 00093 int height(); 00094 int columns(); 00095 int rows(); 00096 00097 void reset(); 00098 00099 void foreground(int c); 00100 void background(int c); 00101 00102 00103 protected: 00104 virtual void _window(int x, int y, int width, int height); 00105 virtual void _putp(int colour); 00106 00107 void command(int value); 00108 void data(int value); 00109 00110 void newline(); 00111 virtual int _putc(int c); 00112 virtual int _getc() { 00113 return 0; 00114 } 00115 void putp(int v); 00116 void window(int x, int y, int width, int height); 00117 00118 SPI _spi; 00119 DigitalOut _rst; 00120 DigitalOut _cs; 00121 00122 LCDType _type; 00123 int _row, _column, _rows, _columns, _foreground, _background, _width, _height; 00124 }; 00125 00126 #endif 00127 00128
Generated on Thu Jul 21 2022 16:03:11 by
1.7.2