It is a door opener with mbed and Felica(RFID).

Dependencies:   mbed Servo SDFileSystem

Committer:
ryought
Date:
Tue May 15 07:47:19 2012 +0000
Revision:
6:9fe8caff6142
FINAL

Who changed what in which revision?

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