Forked from TFTLCD_8bit by Thiha Electronics
Dependents: GR-PEACH_TFTLCD_8bit
Fork of TFTLCD_8bit by
ssd.h@0:881ff0b71102, 2012-12-01 (annotated)
- Committer:
- ttodorov
- Date:
- Sat Dec 01 19:38:53 2012 +0000
- Revision:
- 0:881ff0b71102
- Child:
- 2:81ed304b7e9b
- first version of a standardized TFT library, which is to provide support for multiple LCD controllers and different data buses.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ttodorov | 0:881ff0b71102 | 1 | /** \file ssd.h |
ttodorov | 0:881ff0b71102 | 2 | * \brief mbed TFT LCD controller for displays with the SSD1289 IC. |
ttodorov | 0:881ff0b71102 | 3 | * \copyright GNU Public License, v2. or later |
ttodorov | 0:881ff0b71102 | 4 | * |
ttodorov | 0:881ff0b71102 | 5 | * A known display with this type of controller chip is the ITDB02-3.2S |
ttodorov | 0:881ff0b71102 | 6 | * from http://imall.iteadstudio.com |
ttodorov | 0:881ff0b71102 | 7 | * |
ttodorov | 0:881ff0b71102 | 8 | * This library is based on the Arduino/chipKIT UTFT library by Henning |
ttodorov | 0:881ff0b71102 | 9 | * Karlsen, http://henningkarlsen.com/electronics/library.php?id=52 |
ttodorov | 0:881ff0b71102 | 10 | * |
ttodorov | 0:881ff0b71102 | 11 | * Copyright (C)2010-2012 Henning Karlsen. All right reserved. |
ttodorov | 0:881ff0b71102 | 12 | * Copyright (C)2012 Todor Todorov. |
ttodorov | 0:881ff0b71102 | 13 | * |
ttodorov | 0:881ff0b71102 | 14 | * This library is free software; you can redistribute it and/or |
ttodorov | 0:881ff0b71102 | 15 | * modify it under the terms of the GNU Lesser General Public |
ttodorov | 0:881ff0b71102 | 16 | * License as published by the Free Software Foundation; either |
ttodorov | 0:881ff0b71102 | 17 | * version 2.1 of the License, or (at your option) any later version. |
ttodorov | 0:881ff0b71102 | 18 | * |
ttodorov | 0:881ff0b71102 | 19 | * This library is distributed in the hope that it will be useful, |
ttodorov | 0:881ff0b71102 | 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ttodorov | 0:881ff0b71102 | 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
ttodorov | 0:881ff0b71102 | 22 | * Lesser General Public License for more details. |
ttodorov | 0:881ff0b71102 | 23 | * |
ttodorov | 0:881ff0b71102 | 24 | * You should have received a copy of the GNU Lesser General Public |
ttodorov | 0:881ff0b71102 | 25 | * License along with this library; if not, write to: |
ttodorov | 0:881ff0b71102 | 26 | * |
ttodorov | 0:881ff0b71102 | 27 | * Free Software Foundation, Inc. |
ttodorov | 0:881ff0b71102 | 28 | * 51 Franklin St, 5th Floor, Boston, MA 02110-1301, USA |
ttodorov | 0:881ff0b71102 | 29 | * |
ttodorov | 0:881ff0b71102 | 30 | *********************************************************************/ |
ttodorov | 0:881ff0b71102 | 31 | #ifndef SSD_H |
ttodorov | 0:881ff0b71102 | 32 | #define SSD_H |
ttodorov | 0:881ff0b71102 | 33 | |
ttodorov | 0:881ff0b71102 | 34 | #include "lcd_base.h" |
ttodorov | 0:881ff0b71102 | 35 | |
ttodorov | 0:881ff0b71102 | 36 | class SSD1289LCD : public LCD |
ttodorov | 0:881ff0b71102 | 37 | { |
ttodorov | 0:881ff0b71102 | 38 | public: |
ttodorov | 0:881ff0b71102 | 39 | /** Creates a new instance of the class. |
ttodorov | 0:881ff0b71102 | 40 | * |
ttodorov | 0:881ff0b71102 | 41 | * \param CS Pin for the ChipSelect signal. |
ttodorov | 0:881ff0b71102 | 42 | * \param RESET Pin for the RESET line. |
ttodorov | 0:881ff0b71102 | 43 | * \param RS Pin for the RS signal. |
ttodorov | 0:881ff0b71102 | 44 | * \param WR Pin for the WR signal. |
ttodorov | 0:881ff0b71102 | 45 | * \param DATA_PORT Address of the data bus for transfer of commands and pixel data. |
ttodorov | 0:881ff0b71102 | 46 | * \param RD Pin for the RD signal. This line is not needed by the driver, so if you would like to |
ttodorov | 0:881ff0b71102 | 47 | * use the pin on the mbed for something else, just pull-up the respective pin on the LCD high, |
ttodorov | 0:881ff0b71102 | 48 | * and do not assign a value to this parameter when creating the controller instance. |
ttodorov | 0:881ff0b71102 | 49 | */ |
ttodorov | 0:881ff0b71102 | 50 | SSD1289LCD( PinName CS, PinName RESET, PinName RS, PinName WR, BusOut* DATA_PORT, PinName RD = NC ); |
ttodorov | 0:881ff0b71102 | 51 | |
ttodorov | 0:881ff0b71102 | 52 | /** Initialize display. |
ttodorov | 0:881ff0b71102 | 53 | * |
ttodorov | 0:881ff0b71102 | 54 | * Wakes up the display from sleep, initializes power parameters. |
ttodorov | 0:881ff0b71102 | 55 | * This function must be called first, befor any painting on the |
ttodorov | 0:881ff0b71102 | 56 | * display is done, otherwise the positioning of graphical elements |
ttodorov | 0:881ff0b71102 | 57 | * will not work properly and any paynt operation will not be visible |
ttodorov | 0:881ff0b71102 | 58 | * or produce garbage. |
ttodorov | 0:881ff0b71102 | 59 | * |
ttodorov | 0:881ff0b71102 | 60 | * \param oritentation The display orientation, landscape is default. |
ttodorov | 0:881ff0b71102 | 61 | */ |
ttodorov | 0:881ff0b71102 | 62 | virtual void Initialize( orientation_t orientation = LANDSCAPE ); |
ttodorov | 0:881ff0b71102 | 63 | |
ttodorov | 0:881ff0b71102 | 64 | protected: |
ttodorov | 0:881ff0b71102 | 65 | virtual void writeCmd( unsigned short cmd ); |
ttodorov | 0:881ff0b71102 | 66 | virtual void writeData( unsigned short data ); |
ttodorov | 0:881ff0b71102 | 67 | virtual void setXY( uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2 ); |
ttodorov | 0:881ff0b71102 | 68 | |
ttodorov | 0:881ff0b71102 | 69 | private: |
ttodorov | 0:881ff0b71102 | 70 | DigitalOut _lcd_pin_reset, _lcd_pin_wr; |
ttodorov | 0:881ff0b71102 | 71 | BusOut* _lcd_port; |
ttodorov | 0:881ff0b71102 | 72 | DigitalOut* _lcd_pin_rd; |
ttodorov | 0:881ff0b71102 | 73 | }; |
ttodorov | 0:881ff0b71102 | 74 | |
ttodorov | 0:881ff0b71102 | 75 | #endif /* SSD_H */ |