A TextDisplay driver that supports graphical displays using on of the SED133x conrtrolers. Allows stdout and stderr output to be redirected to the display.
TextLCD.h
- Committer:
- llagendijk
- Date:
- 2011-01-29
- Revision:
- 9:68ad299df12b
- Parent:
- 8:66be6a696e4e
File content as of revision 9:68ad299df12b:
/* mbed TextLCD Library Base Class * Copyright (c) 2007-2009 sford * Released under the MIT License: http://mbed.org/license/mit * Modified by Ned Konz to provide better support for 4-line LCDs and ones with other controller chips. */ #include "TextDisplay.h" #ifndef MBED_TEXTLCD_H #define MBED_TEXTLCD_H /** TextLCD Textdisplay * * Example: * @code / simple test for TextDisplay class, untested #include "mbed.h" #include "TextLCD.h" TextLCD lcd(p5, p6, p7, p8, p9, p28, p27, 4, 20, "lcd"); int main() { lcd.printf("Hello TextDisplay world!\r\n"); lcd.claim(stdout); printf("hello stream world\r\n"); } * @endcode */ class TextLCD : public TextDisplay { public: /** Create the TextDisplay interface * * @param rs PinName for reset * @param rw PinName for read/write * @param e PinName for enable * @param d0-d3 PinName for D0 -D3 * @param rows number of rows on the display * @param columns number of colums on the display * @param name name to be used in pathname of the stream */ TextLCD(PinName rs, PinName rw, PinName e, PinName d0, PinName d1, PinName d2, PinName d3, uint16_t rows = 2, uint16_t columns = 16, const char *name = "textlcd"); virtual void character(uint16_t column, uint16_t row, int c); virtual uint16_t rows() { return _rows; } virtual uint16_t columns() { return _columns; } virtual void reset(); virtual void cls(); // locate, putc, printf come from parent class protected: void writeByte(uint16_t value); void writeHalfByte(uint16_t value); void writeCommand(uint16_t command); void writeData(uint16_t data); uint16_t readAddressAndBusy(); void waitUntilDone(); DigitalOut _rw, _rs, _e; BusInOut _d; uint16_t _rows, _columns; }; #endif