ソースの整理中ですが、利用はできます。

Dependencies:   EthernetInterface HttpServer TextLCD mbed-rpc mbed-rtos mbed Socket lwip-eth lwip-sys lwip

Committer:
yueee_yt
Date:
Wed Mar 12 04:39:15 2014 +0000
Revision:
2:14b689a85306
Parent:
0:7766f6712673
bug fix

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yueee_yt 0:7766f6712673 1 /* mbed TextLCD Library, for a 4-bit LCD based on HD44780
yueee_yt 0:7766f6712673 2 * Copyright (c) 2007-2010, sford, http://mbed.org
yueee_yt 0:7766f6712673 3 *
yueee_yt 0:7766f6712673 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
yueee_yt 0:7766f6712673 5 * of this software and associated documentation files (the "Software"), to deal
yueee_yt 0:7766f6712673 6 * in the Software without restriction, including without limitation the rights
yueee_yt 0:7766f6712673 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
yueee_yt 0:7766f6712673 8 * copies of the Software, and to permit persons to whom the Software is
yueee_yt 0:7766f6712673 9 * furnished to do so, subject to the following conditions:
yueee_yt 0:7766f6712673 10 *
yueee_yt 0:7766f6712673 11 * The above copyright notice and this permission notice shall be included in
yueee_yt 0:7766f6712673 12 * all copies or substantial portions of the Software.
yueee_yt 0:7766f6712673 13 *
yueee_yt 0:7766f6712673 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
yueee_yt 0:7766f6712673 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
yueee_yt 0:7766f6712673 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
yueee_yt 0:7766f6712673 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
yueee_yt 0:7766f6712673 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
yueee_yt 0:7766f6712673 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
yueee_yt 0:7766f6712673 20 * THE SOFTWARE.
yueee_yt 0:7766f6712673 21 */
yueee_yt 0:7766f6712673 22
yueee_yt 0:7766f6712673 23 #ifndef MBED_TEXTLCD_H
yueee_yt 0:7766f6712673 24 #define MBED_TEXTLCD_H
yueee_yt 0:7766f6712673 25
yueee_yt 0:7766f6712673 26 #include "mbed.h"
yueee_yt 0:7766f6712673 27 //#include "rtos.h"
yueee_yt 0:7766f6712673 28
yueee_yt 0:7766f6712673 29 /** A TextLCD interface for driving 4-bit HD44780-based LCDs
yueee_yt 0:7766f6712673 30 *
yueee_yt 0:7766f6712673 31 * Currently supports 16x2, 20x2 and 20x4 panels
yueee_yt 0:7766f6712673 32 *
yueee_yt 0:7766f6712673 33 * @code
yueee_yt 0:7766f6712673 34 * #include "mbed.h"
yueee_yt 0:7766f6712673 35 * #include "TextLCD.h"
yueee_yt 0:7766f6712673 36 *
yueee_yt 0:7766f6712673 37 * TextLCD lcd(p10, p12, p15, p16, p29, p30); // rs, e, d4-d7
yueee_yt 0:7766f6712673 38 *
yueee_yt 0:7766f6712673 39 * int main() {
yueee_yt 0:7766f6712673 40 * lcd.printf("Hello World!\n");
yueee_yt 0:7766f6712673 41 * }
yueee_yt 0:7766f6712673 42 * @endcode
yueee_yt 0:7766f6712673 43 */
yueee_yt 0:7766f6712673 44 class TextLCD : public Stream {
yueee_yt 0:7766f6712673 45 public:
yueee_yt 0:7766f6712673 46
yueee_yt 0:7766f6712673 47 /** LCD panel format */
yueee_yt 0:7766f6712673 48 enum LCDType {
yueee_yt 0:7766f6712673 49 LCD16x2 /**< 16x2 LCD panel (default) */
yueee_yt 0:7766f6712673 50 , LCD16x2B /**< 16x2 LCD panel alternate addressing */
yueee_yt 0:7766f6712673 51 , LCD20x2 /**< 20x2 LCD panel */
yueee_yt 0:7766f6712673 52 , LCD20x4 /**< 20x4 LCD panel */
yueee_yt 0:7766f6712673 53 };
yueee_yt 0:7766f6712673 54
yueee_yt 0:7766f6712673 55 /** Create a TextLCD interface
yueee_yt 0:7766f6712673 56 *
yueee_yt 0:7766f6712673 57 * @param rs Instruction/data control line
yueee_yt 0:7766f6712673 58 * @param e Enable line (clock)
yueee_yt 0:7766f6712673 59 * @param d4-d7 Data lines for using as a 4-bit interface
yueee_yt 0:7766f6712673 60 * @param type Sets the panel size/addressing mode (default = LCD16x2)
yueee_yt 0:7766f6712673 61 */
yueee_yt 0:7766f6712673 62 TextLCD(PinName rs, PinName e, PinName d4, PinName d5, PinName d6, PinName d7, LCDType type = LCD16x2);
yueee_yt 0:7766f6712673 63
yueee_yt 0:7766f6712673 64 #if DOXYGEN_ONLY
yueee_yt 0:7766f6712673 65 /** Write a character to the LCD
yueee_yt 0:7766f6712673 66 *
yueee_yt 0:7766f6712673 67 * @param c The character to write to the display
yueee_yt 0:7766f6712673 68 */
yueee_yt 0:7766f6712673 69 int putc(int c);
yueee_yt 0:7766f6712673 70
yueee_yt 0:7766f6712673 71 /** Write a formated string to the LCD
yueee_yt 0:7766f6712673 72 *
yueee_yt 0:7766f6712673 73 * @param format A printf-style format string, followed by the
yueee_yt 0:7766f6712673 74 * variables to use in formating the string.
yueee_yt 0:7766f6712673 75 */
yueee_yt 0:7766f6712673 76 int printf(const char* format, ...);
yueee_yt 0:7766f6712673 77 #endif
yueee_yt 0:7766f6712673 78
yueee_yt 0:7766f6712673 79 /** Locate to a screen column and row
yueee_yt 0:7766f6712673 80 *
yueee_yt 0:7766f6712673 81 * @param column The horizontal position from the left, indexed from 0
yueee_yt 0:7766f6712673 82 * @param row The vertical position from the top, indexed from 0
yueee_yt 0:7766f6712673 83 */
yueee_yt 0:7766f6712673 84 void locate(int column, int row);
yueee_yt 0:7766f6712673 85
yueee_yt 0:7766f6712673 86 /** Clear the screen and locate to 0,0 */
yueee_yt 0:7766f6712673 87 void cls();
yueee_yt 0:7766f6712673 88
yueee_yt 0:7766f6712673 89 int rows();
yueee_yt 0:7766f6712673 90 int columns();
yueee_yt 0:7766f6712673 91
yueee_yt 0:7766f6712673 92 protected:
yueee_yt 0:7766f6712673 93
yueee_yt 0:7766f6712673 94 // Stream implementation functions
yueee_yt 0:7766f6712673 95 virtual int _putc(int value);
yueee_yt 0:7766f6712673 96 virtual int _getc();
yueee_yt 0:7766f6712673 97
yueee_yt 0:7766f6712673 98 int address(int column, int row);
yueee_yt 0:7766f6712673 99 void character(int column, int row, int c);
yueee_yt 0:7766f6712673 100 void writeByte(int value);
yueee_yt 0:7766f6712673 101 void writeCommand(int command);
yueee_yt 0:7766f6712673 102 void writeData(int data);
yueee_yt 0:7766f6712673 103
yueee_yt 0:7766f6712673 104 DigitalOut _rs, _e;
yueee_yt 0:7766f6712673 105 BusOut _d;
yueee_yt 0:7766f6712673 106 LCDType _type;
yueee_yt 0:7766f6712673 107
yueee_yt 0:7766f6712673 108 int _column;
yueee_yt 0:7766f6712673 109 int _row;
yueee_yt 0:7766f6712673 110 };
yueee_yt 0:7766f6712673 111
yueee_yt 0:7766f6712673 112 #endif
yueee_yt 0:7766f6712673 113