Dependencies:   ChaNFSSD mbed BMP085 SHT2x

Committer:
tosihisa
Date:
Mon Feb 27 16:20:15 2012 +0000
Revision:
9:9ca3db7ed7cb
Parent:
0:6089ae824f06
V0.89.2. GPS recv data is OK.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tosihisa 0:6089ae824f06 1 /* mbed TextLCD Library
tosihisa 0:6089ae824f06 2 * Copyright (c) 2007-2009 sford
tosihisa 0:6089ae824f06 3 * Released under the MIT License: http://mbed.org/license/mit
tosihisa 0:6089ae824f06 4 *
tosihisa 0:6089ae824f06 5 * TODO: Needs serious rework/neatening up!
tosihisa 0:6089ae824f06 6 */
tosihisa 0:6089ae824f06 7
tosihisa 0:6089ae824f06 8 /*
tosihisa 0:6089ae824f06 9 * 2010/05/14 modified for 20X4 LCD by ym1784
tosihisa 0:6089ae824f06 10 */
tosihisa 0:6089ae824f06 11
tosihisa 0:6089ae824f06 12 #ifndef MBED_TEXTLCD_20X4_H
tosihisa 0:6089ae824f06 13 #define MBED_TEXTLCD_20X4_H
tosihisa 0:6089ae824f06 14
tosihisa 0:6089ae824f06 15 #include "Stream.h"
tosihisa 0:6089ae824f06 16 #include "DigitalOut.h"
tosihisa 0:6089ae824f06 17 #include "BusOut.h"
tosihisa 0:6089ae824f06 18
tosihisa 0:6089ae824f06 19 namespace mbed {
tosihisa 0:6089ae824f06 20
tosihisa 0:6089ae824f06 21 /* Class: TextLCD_20X4
tosihisa 0:6089ae824f06 22 * A 20x4 Text LCD controller ... ym1784
tosihisa 0:6089ae824f06 23 *
tosihisa 0:6089ae824f06 24 * Allows you to print to a Text LCD screen, and locate/cls. Could be
tosihisa 0:6089ae824f06 25 * turned in to a more generic libray.
tosihisa 0:6089ae824f06 26 *
tosihisa 0:6089ae824f06 27 * If you are connecting multiple displays, you can connect them all in
tosihisa 0:6089ae824f06 28 * parallel except for the enable (e) pin, which must be unique for each
tosihisa 0:6089ae824f06 29 * display.
tosihisa 0:6089ae824f06 30 *
tosihisa 0:6089ae824f06 31 * Example:
tosihisa 0:6089ae824f06 32 * > #include "mbed.h"
tosihisa 0:6089ae824f06 33 * > #include "TextLCD_20X4.h"
tosihisa 0:6089ae824f06 34 * >
tosihisa 0:6089ae824f06 35 * > TextLCD_20X4 lcd(p21, p22, p23, p24, p25, p26); // rs, e, d0, d1, d2, d3
tosihisa 0:6089ae824f06 36 * >
tosihisa 0:6089ae824f06 37 * > int main() {
tosihisa 0:6089ae824f06 38 * > lcd.printf("Hello World!");
tosihisa 0:6089ae824f06 39 * > }
tosihisa 0:6089ae824f06 40 */
tosihisa 0:6089ae824f06 41 class TextLCD_20X4 : public Stream {
tosihisa 0:6089ae824f06 42
tosihisa 0:6089ae824f06 43 public:
tosihisa 0:6089ae824f06 44 /* Constructor: TextLCD_20X4
tosihisa 0:6089ae824f06 45 * Create a TextLCD_20X4 object, connected to the specified pins
tosihisa 0:6089ae824f06 46 *
tosihisa 0:6089ae824f06 47 * All signals must be connected to DigitalIn compatible pins.
tosihisa 0:6089ae824f06 48 *
tosihisa 0:6089ae824f06 49 * Variables:
tosihisa 0:6089ae824f06 50 * rs - Used to specify data or command
tosihisa 0:6089ae824f06 51 * e - enable
tosihisa 0:6089ae824f06 52 * d0..d3 - The data lines
tosihisa 0:6089ae824f06 53 */
tosihisa 0:6089ae824f06 54 TextLCD_20X4(PinName rs, PinName e, PinName d0, PinName d1,
tosihisa 0:6089ae824f06 55 PinName d2, PinName d3, int columns = 20, int rows = 4);
tosihisa 0:6089ae824f06 56
tosihisa 0:6089ae824f06 57 #if 0 // Inhereted from Stream, for documentation only
tosihisa 0:6089ae824f06 58 /* Function: putc
tosihisa 0:6089ae824f06 59 * Write a character
tosihisa 0:6089ae824f06 60 *
tosihisa 0:6089ae824f06 61 * Variables:
tosihisa 0:6089ae824f06 62 * c - The character to write to the serial port
tosihisa 0:6089ae824f06 63 */
tosihisa 0:6089ae824f06 64 int putc(int c);
tosihisa 0:6089ae824f06 65
tosihisa 0:6089ae824f06 66 /* Function: printf
tosihisa 0:6089ae824f06 67 * Write a formated string
tosihisa 0:6089ae824f06 68 *
tosihisa 0:6089ae824f06 69 * Variables:
tosihisa 0:6089ae824f06 70 * format - A printf-style format string, followed by the
tosihisa 0:6089ae824f06 71 * variables to use in formating the string.
tosihisa 0:6089ae824f06 72 */
tosihisa 0:6089ae824f06 73 int printf(const char* format, ...);
tosihisa 0:6089ae824f06 74 #endif
tosihisa 0:6089ae824f06 75
tosihisa 0:6089ae824f06 76 /* Function: locate
tosihisa 0:6089ae824f06 77 * Locate to a certian position
tosihisa 0:6089ae824f06 78 *
tosihisa 0:6089ae824f06 79 * Variables:
tosihisa 0:6089ae824f06 80 * column - the column to locate to, from 0..19
tosihisa 0:6089ae824f06 81 * row - the row to locate to, from 0..3
tosihisa 0:6089ae824f06 82 */
tosihisa 0:6089ae824f06 83 virtual void locate(int column, int row);
tosihisa 0:6089ae824f06 84
tosihisa 0:6089ae824f06 85 /* Function: cls
tosihisa 0:6089ae824f06 86 * Clear the screen
tosihisa 0:6089ae824f06 87 */
tosihisa 0:6089ae824f06 88 virtual void cls();
tosihisa 0:6089ae824f06 89
tosihisa 0:6089ae824f06 90 virtual void reset();
tosihisa 0:6089ae824f06 91
tosihisa 0:6089ae824f06 92 //protected:
tosihisa 0:6089ae824f06 93
tosihisa 0:6089ae824f06 94 void clock();
tosihisa 0:6089ae824f06 95 void writeData(int data);
tosihisa 0:6089ae824f06 96 void writeCommand(int command);
tosihisa 0:6089ae824f06 97 void writeByte(int value);
tosihisa 0:6089ae824f06 98 void writeNibble(int value);
tosihisa 0:6089ae824f06 99 virtual int _putc(int c);
tosihisa 0:6089ae824f06 100 virtual int _getc();
tosihisa 0:6089ae824f06 101 virtual void newline();
tosihisa 0:6089ae824f06 102
tosihisa 0:6089ae824f06 103 int _row;
tosihisa 0:6089ae824f06 104 int _column;
tosihisa 0:6089ae824f06 105 DigitalOut _rs, _e;
tosihisa 0:6089ae824f06 106 BusOut _d;
tosihisa 0:6089ae824f06 107 int _columns;
tosihisa 0:6089ae824f06 108 int _rows;
tosihisa 0:6089ae824f06 109 int address;
tosihisa 0:6089ae824f06 110 };
tosihisa 0:6089ae824f06 111
tosihisa 0:6089ae824f06 112 }
tosihisa 0:6089ae824f06 113
tosihisa 0:6089ae824f06 114 #endif