Improved version of Simon Ford's TextDisplay library, with addressing and timing fixes. Supports up to 20x4 text displays.
TextLCD.h@0:2c5bba968d7c, 2010-02-14 (annotated)
- Committer:
- bikeNomad
- Date:
- Sun Feb 14 00:28:08 2010 +0000
- Revision:
- 0:2c5bba968d7c
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bikeNomad | 0:2c5bba968d7c | 1 | /* mbed TextLCD Library Base Class |
bikeNomad | 0:2c5bba968d7c | 2 | * Copyright (c) 2007-2009 sford |
bikeNomad | 0:2c5bba968d7c | 3 | * Released under the MIT License: http://mbed.org/license/mit |
bikeNomad | 0:2c5bba968d7c | 4 | * Modified by Ned Konz to provide better support for 4-line LCDs and ones with other controller chips. |
bikeNomad | 0:2c5bba968d7c | 5 | */ |
bikeNomad | 0:2c5bba968d7c | 6 | #include "TextDisplay.h" |
bikeNomad | 0:2c5bba968d7c | 7 | |
bikeNomad | 0:2c5bba968d7c | 8 | #ifndef MBED_TEXTLCD_H |
bikeNomad | 0:2c5bba968d7c | 9 | #define MBED_TEXTLCD_H |
bikeNomad | 0:2c5bba968d7c | 10 | |
bikeNomad | 0:2c5bba968d7c | 11 | class TextLCD : public TextDisplay { |
bikeNomad | 0:2c5bba968d7c | 12 | public: |
bikeNomad | 0:2c5bba968d7c | 13 | TextLCD(PinName rs, PinName rw, PinName e, |
bikeNomad | 0:2c5bba968d7c | 14 | PinName d0, PinName d1, PinName d2, PinName d3, |
bikeNomad | 0:2c5bba968d7c | 15 | uint16_t rows = 2, uint16_t columns = 16); |
bikeNomad | 0:2c5bba968d7c | 16 | virtual void character(uint16_t column, uint16_t row, int c); |
bikeNomad | 0:2c5bba968d7c | 17 | virtual uint16_t rows() { return _rows; } |
bikeNomad | 0:2c5bba968d7c | 18 | virtual uint16_t columns() { return _columns; } |
bikeNomad | 0:2c5bba968d7c | 19 | virtual void reset(); |
bikeNomad | 0:2c5bba968d7c | 20 | virtual void cls(); |
bikeNomad | 0:2c5bba968d7c | 21 | |
bikeNomad | 0:2c5bba968d7c | 22 | // locate, putc, printf come from parent class |
bikeNomad | 0:2c5bba968d7c | 23 | |
bikeNomad | 0:2c5bba968d7c | 24 | protected: |
bikeNomad | 0:2c5bba968d7c | 25 | void writeByte(uint16_t value); |
bikeNomad | 0:2c5bba968d7c | 26 | void writeHalfByte(uint16_t value); |
bikeNomad | 0:2c5bba968d7c | 27 | void writeCommand(uint16_t command); |
bikeNomad | 0:2c5bba968d7c | 28 | void writeData(uint16_t data); |
bikeNomad | 0:2c5bba968d7c | 29 | uint16_t readAddressAndBusy(); |
bikeNomad | 0:2c5bba968d7c | 30 | void waitUntilDone(); |
bikeNomad | 0:2c5bba968d7c | 31 | |
bikeNomad | 0:2c5bba968d7c | 32 | DigitalOut _rw, _rs, _e; |
bikeNomad | 0:2c5bba968d7c | 33 | BusInOut _d; |
bikeNomad | 0:2c5bba968d7c | 34 | uint16_t _rows, _columns; |
bikeNomad | 0:2c5bba968d7c | 35 | }; |
bikeNomad | 0:2c5bba968d7c | 36 | |
bikeNomad | 0:2c5bba968d7c | 37 | #endif |