StarBoard Orange - Example application No.1 GoogleChartLogger with StarBoard Orange
Dependencies: EthernetNetIf mbed
TextLCD.h
00001 /* mbed TextLCD Library, for a 4-bit LCD based on HD44780 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 /* 00024 * Modified for star board orange by Shinichiro Nakamura. (CuBeatSystems) 00025 * 00026 * ID : shintamainjp 00027 * Added : RW- 00028 */ 00029 00030 #ifndef MBED_TEXTLCD_H 00031 #define MBED_TEXTLCD_H 00032 00033 #include "mbed.h" 00034 00035 /** A TextLCD interface for driving 4-bit HD44780-based LCDs 00036 * 00037 * Currently supports 16x2, 20x2 and 20x4 panels 00038 * 00039 * @code 00040 * #include "mbed.h" 00041 * #include "TextLCD.h" 00042 * 00043 * TextLCD lcd(p10, p12, p15, p16, p29, p30); // rs, e, d0-d3 00044 * 00045 * int main() { 00046 * lcd.printf("Hello World!\n"); 00047 * } 00048 * @endcode 00049 */ 00050 class TextLCD : public Stream { 00051 public: 00052 00053 /** LCD panel format */ 00054 enum LCDType { 00055 LCD16x2 /**< 16x2 LCD panel (default) */ 00056 , LCD16x2B /**< 16x2 LCD panel alternate addressing */ 00057 , LCD20x2 /**< 20x2 LCD panel */ 00058 , LCD20x4 /**< 20x4 LCD panel */ 00059 }; 00060 00061 /** Create a TextLCD interface 00062 * 00063 * @param rs Instruction/data control line. 00064 * @param rw Read/Write- control line. 00065 * @param e Enable line (clock) 00066 * @param d0-d3 Data lines 00067 * @param type Sets the panel size/addressing mode (default = LCD16x2) 00068 */ 00069 TextLCD(PinName rs, PinName rw, PinName e, PinName d0, PinName d1, PinName d2, PinName d3, LCDType type = LCD16x2); 00070 00071 #if DOXYGEN_ONLY 00072 /** Write a character to the LCD 00073 * 00074 * @param c The character to write to the display 00075 */ 00076 int putc(int c); 00077 00078 /** Write a formated string to the LCD 00079 * 00080 * @param format A printf-style format string, followed by the 00081 * variables to use in formating the string. 00082 */ 00083 int printf(const char* format, ...); 00084 #endif 00085 00086 /** Locate to a screen column and row 00087 * 00088 * @param column The horizontal position from the left, indexed from 0 00089 * @param row The vertical position from the top, indexed from 0 00090 */ 00091 void locate(int column, int row); 00092 00093 /** Clear the screen and locate to 0,0 */ 00094 void cls(); 00095 00096 int rows(); 00097 int columns(); 00098 00099 protected: 00100 00101 // Stream implementation functions 00102 virtual int _putc(int value); 00103 virtual int _getc(); 00104 00105 int address(int column, int row); 00106 void character(int column, int row, int c); 00107 void writeByte(int value); 00108 void writeCommand(int command); 00109 void writeData(int data); 00110 00111 DigitalOut _rs, _rw, _e; 00112 BusOut _d; 00113 LCDType _type; 00114 00115 int _column; 00116 int _row; 00117 }; 00118 00119 #endif
Generated on Fri Jul 15 2022 13:35:45 by 1.7.2