Display text on LCD displays (even on multiple ones). Allow to create windows (frames) on display, and to combine them (split, add, duplicate, scroll). See http://mbed.org/users/hlipka/notebook/lcdwindow/ for more information.
hd44780_8bit.h@2:5ac5bab7daaf, 2010-11-27 (annotated)
- Committer:
- hlipka
- Date:
- Sat Nov 27 22:54:13 2010 +0000
- Revision:
- 2:5ac5bab7daaf
- Parent:
- 1:65f72ed914fa
Moved to \"Stream\"-based API (like TextLCD) which allows the usage of printf
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hlipka | 0:ae5037e3d6e0 | 1 | /* |
hlipka | 0:ae5037e3d6e0 | 2 | * mbed LCDWindow library |
hlipka | 0:ae5037e3d6e0 | 3 | * Copyright (c) 2010 Hendrik Lipka |
hlipka | 0:ae5037e3d6e0 | 4 | * |
hlipka | 0:ae5037e3d6e0 | 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
hlipka | 0:ae5037e3d6e0 | 6 | * of this software and associated documentation files (the "Software"), to deal |
hlipka | 0:ae5037e3d6e0 | 7 | * in the Software without restriction, including without limitation the rights |
hlipka | 0:ae5037e3d6e0 | 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
hlipka | 0:ae5037e3d6e0 | 9 | * copies of the Software, and to permit persons to whom the Software is |
hlipka | 0:ae5037e3d6e0 | 10 | * furnished to do so, subject to the following conditions: |
hlipka | 0:ae5037e3d6e0 | 11 | * |
hlipka | 0:ae5037e3d6e0 | 12 | * The above copyright notice and this permission notice shall be included in |
hlipka | 0:ae5037e3d6e0 | 13 | * all copies or substantial portions of the Software. |
hlipka | 0:ae5037e3d6e0 | 14 | * |
hlipka | 0:ae5037e3d6e0 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
hlipka | 0:ae5037e3d6e0 | 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
hlipka | 0:ae5037e3d6e0 | 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
hlipka | 0:ae5037e3d6e0 | 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
hlipka | 0:ae5037e3d6e0 | 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
hlipka | 0:ae5037e3d6e0 | 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
hlipka | 0:ae5037e3d6e0 | 21 | * THE SOFTWARE. |
hlipka | 0:ae5037e3d6e0 | 22 | */ |
hlipka | 0:ae5037e3d6e0 | 23 | |
hlipka | 0:ae5037e3d6e0 | 24 | #ifndef HD44780_8BIT_H_ |
hlipka | 0:ae5037e3d6e0 | 25 | #define HD44780_8BIT_H_ |
hlipka | 0:ae5037e3d6e0 | 26 | |
hlipka | 0:ae5037e3d6e0 | 27 | #include "lcd.h" |
hlipka | 0:ae5037e3d6e0 | 28 | |
hlipka | 0:ae5037e3d6e0 | 29 | #include "BusOut.h" |
hlipka | 0:ae5037e3d6e0 | 30 | #include "DigitalOut.h" |
hlipka | 0:ae5037e3d6e0 | 31 | |
hlipka | 0:ae5037e3d6e0 | 32 | using namespace mbed; |
hlipka | 0:ae5037e3d6e0 | 33 | |
hlipka | 0:ae5037e3d6e0 | 34 | /** |
hlipka | 0:ae5037e3d6e0 | 35 | * class for connecting HD44780-based LCD-Display (or using similiar controllers) |
hlipka | 0:ae5037e3d6e0 | 36 | * displays are connected in 8bit-mode |
hlipka | 0:ae5037e3d6e0 | 37 | * currently only 1 or 2 lines are supported |
hlipka | 0:ae5037e3d6e0 | 38 | */ |
hlipka | 0:ae5037e3d6e0 | 39 | class HD44780LCD8bit: public TextLCDBase |
hlipka | 0:ae5037e3d6e0 | 40 | { |
hlipka | 0:ae5037e3d6e0 | 41 | public: |
hlipka | 0:ae5037e3d6e0 | 42 | /** |
hlipka | 0:ae5037e3d6e0 | 43 | * @param width number of chars per line |
hlipka | 0:ae5037e3d6e0 | 44 | * @param height number of lines (currently only 1 and 2 work) |
hlipka | 0:ae5037e3d6e0 | 45 | * @param data the bus object used for sending data (must be 8bit) |
hlipka | 0:ae5037e3d6e0 | 46 | * @param enable the pin name for the enable line (1=active) |
hlipka | 0:ae5037e3d6e0 | 47 | * @param rs the pin name for the register select line (0=cmd, 1=data) |
hlipka | 0:ae5037e3d6e0 | 48 | */ |
hlipka | 2:5ac5bab7daaf | 49 | HD44780LCD8bit(unsigned int columns, unsigned int rows, BusOut *data, PinName enable, PinName rs); |
hlipka | 0:ae5037e3d6e0 | 50 | virtual void init(); |
hlipka | 2:5ac5bab7daaf | 51 | virtual void writeText(const unsigned int column, const unsigned int row, const char text[]); |
hlipka | 0:ae5037e3d6e0 | 52 | virtual void clear(); |
hlipka | 2:5ac5bab7daaf | 53 | virtual void character(int column, int row, int c); |
hlipka | 0:ae5037e3d6e0 | 54 | |
hlipka | 0:ae5037e3d6e0 | 55 | protected: |
hlipka | 1:65f72ed914fa | 56 | void sendCmd(const unsigned char byte); |
hlipka | 1:65f72ed914fa | 57 | void sendData(const unsigned char byte); |
hlipka | 0:ae5037e3d6e0 | 58 | |
hlipka | 1:65f72ed914fa | 59 | void sendByte(const unsigned char byte); |
hlipka | 0:ae5037e3d6e0 | 60 | |
hlipka | 0:ae5037e3d6e0 | 61 | BusOut* _data; |
hlipka | 0:ae5037e3d6e0 | 62 | DigitalOut *_enable, *_rs; |
hlipka | 0:ae5037e3d6e0 | 63 | }; |
hlipka | 0:ae5037e3d6e0 | 64 | #endif |