4 errors
Dependencies: KS0108_PCF8574 mbed
menbed/displays/include/menbedDisplayHD44780.h@0:936f1c020120, 2012-09-05 (annotated)
- Committer:
- GuiTwo
- Date:
- Wed Sep 05 07:21:59 2012 +0000
- Revision:
- 0:936f1c020120
With KS0108;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
GuiTwo | 0:936f1c020120 | 1 | /* This code based on mbed TextLCD Library, for a 4-bit LCD based on HD44780, |
GuiTwo | 0:936f1c020120 | 2 | * Copyright (c) 2007-2010, sford, http://mbed.org |
GuiTwo | 0:936f1c020120 | 3 | * |
GuiTwo | 0:936f1c020120 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
GuiTwo | 0:936f1c020120 | 5 | * of this software and associated documentation files (the "Software"), to deal |
GuiTwo | 0:936f1c020120 | 6 | * in the Software without restriction, including without limitation the rights |
GuiTwo | 0:936f1c020120 | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
GuiTwo | 0:936f1c020120 | 8 | * copies of the Software, and to permit persons to whom the Software is |
GuiTwo | 0:936f1c020120 | 9 | * furnished to do so, subject to the following conditions: |
GuiTwo | 0:936f1c020120 | 10 | * |
GuiTwo | 0:936f1c020120 | 11 | * The above copyright notice and this permission notice shall be included in |
GuiTwo | 0:936f1c020120 | 12 | * all copies or substantial portions of the Software. |
GuiTwo | 0:936f1c020120 | 13 | * |
GuiTwo | 0:936f1c020120 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
GuiTwo | 0:936f1c020120 | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
GuiTwo | 0:936f1c020120 | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
GuiTwo | 0:936f1c020120 | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
GuiTwo | 0:936f1c020120 | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
GuiTwo | 0:936f1c020120 | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
GuiTwo | 0:936f1c020120 | 20 | * THE SOFTWARE. |
GuiTwo | 0:936f1c020120 | 21 | */ |
GuiTwo | 0:936f1c020120 | 22 | |
GuiTwo | 0:936f1c020120 | 23 | #ifndef _MENBEDDISPLAYHD44780_H_ |
GuiTwo | 0:936f1c020120 | 24 | #define _MENBEDDISPLAYHD44780_H_ |
GuiTwo | 0:936f1c020120 | 25 | |
GuiTwo | 0:936f1c020120 | 26 | #include "mbed.h" |
GuiTwo | 0:936f1c020120 | 27 | #include "menbedDisplay.h" |
GuiTwo | 0:936f1c020120 | 28 | |
GuiTwo | 0:936f1c020120 | 29 | class MenbedDisplayHD44780 : public MenbedDisplay { |
GuiTwo | 0:936f1c020120 | 30 | public: |
GuiTwo | 0:936f1c020120 | 31 | |
GuiTwo | 0:936f1c020120 | 32 | /** LCD panel format */ |
GuiTwo | 0:936f1c020120 | 33 | enum LCDSize { |
GuiTwo | 0:936f1c020120 | 34 | LCD16x2, /**< 16x2 LCD panel */ |
GuiTwo | 0:936f1c020120 | 35 | LCD16x2B, /**< 16x2 LCD panel alternate addressing */ |
GuiTwo | 0:936f1c020120 | 36 | LCD20x2, /**< 20x2 LCD panel */ |
GuiTwo | 0:936f1c020120 | 37 | LCD20x4, /**< 20x4 LCD panel (default) */ |
GuiTwo | 0:936f1c020120 | 38 | }; |
GuiTwo | 0:936f1c020120 | 39 | |
GuiTwo | 0:936f1c020120 | 40 | MenbedDisplayHD44780 (PinName rs, PinName e, PinName d4, PinName d5, PinName d6, PinName d7, LCDSize size = LCD20x4); |
GuiTwo | 0:936f1c020120 | 41 | |
GuiTwo | 0:936f1c020120 | 42 | virtual bool writeLine (const char *line, uint8_t row); |
GuiTwo | 0:936f1c020120 | 43 | virtual void showUpArrow (bool show); |
GuiTwo | 0:936f1c020120 | 44 | virtual void showDownArrow (bool show); |
GuiTwo | 0:936f1c020120 | 45 | virtual uint8_t getLines (void); |
GuiTwo | 0:936f1c020120 | 46 | virtual uint8_t getLineLength (void); |
GuiTwo | 0:936f1c020120 | 47 | |
GuiTwo | 0:936f1c020120 | 48 | protected: |
GuiTwo | 0:936f1c020120 | 49 | enum ArrowSelectorChar { |
GuiTwo | 0:936f1c020120 | 50 | CharUP, |
GuiTwo | 0:936f1c020120 | 51 | CharUP_SELECT, |
GuiTwo | 0:936f1c020120 | 52 | CharSELECT, |
GuiTwo | 0:936f1c020120 | 53 | CharDOWN_SELECT, |
GuiTwo | 0:936f1c020120 | 54 | CharDOWN |
GuiTwo | 0:936f1c020120 | 55 | }; |
GuiTwo | 0:936f1c020120 | 56 | |
GuiTwo | 0:936f1c020120 | 57 | DigitalOut rs, e; |
GuiTwo | 0:936f1c020120 | 58 | BusOut d; |
GuiTwo | 0:936f1c020120 | 59 | LCDSize size; |
GuiTwo | 0:936f1c020120 | 60 | |
GuiTwo | 0:936f1c020120 | 61 | bool upArrowVisible, downArrowVisible; |
GuiTwo | 0:936f1c020120 | 62 | bool topLineSelected, bottomLineSelected; |
GuiTwo | 0:936f1c020120 | 63 | int cursorCol, cursorRow; |
GuiTwo | 0:936f1c020120 | 64 | |
GuiTwo | 0:936f1c020120 | 65 | bool gotoPosition(int row, int column); |
GuiTwo | 0:936f1c020120 | 66 | void clear(); |
GuiTwo | 0:936f1c020120 | 67 | void cursorOn(); |
GuiTwo | 0:936f1c020120 | 68 | void cursorOff(); |
GuiTwo | 0:936f1c020120 | 69 | |
GuiTwo | 0:936f1c020120 | 70 | int address(int column, int row); |
GuiTwo | 0:936f1c020120 | 71 | void writeByte(int value); |
GuiTwo | 0:936f1c020120 | 72 | void writeCommand(int command); |
GuiTwo | 0:936f1c020120 | 73 | void writeData(int data); |
GuiTwo | 0:936f1c020120 | 74 | void loadCustomChars(void); |
GuiTwo | 0:936f1c020120 | 75 | int rows(); |
GuiTwo | 0:936f1c020120 | 76 | int columns(); |
GuiTwo | 0:936f1c020120 | 77 | }; |
GuiTwo | 0:936f1c020120 | 78 | |
GuiTwo | 0:936f1c020120 | 79 | #endif /* _MENBEDDISPLAYHD44780_H_ */ |