mcufriend 2.4 TFT LCD Shield Lib
Dependents: Nucleo_LCD_mcufriend_test
Fork of 24_TFT_STMNUCLEO by
mcufriend 2.4" TFT LCD Shield
Import program
00001 #include "mbed.h" 00002 #include "ili9328.h" 00003 00004 // prepare the data bus for writing commands and pixel data 00005 BusOut dataBus( D8, D9, D2, D3, D4, D5, D6, D7 ); // 8 pins 00006 // create the lcd instance 00007 ILI9328_LCD lcd( A3, A4, A2,A1, &dataBus, NC, A0); // control pins and data bus 00008 //ILI9328_LCD( CS, RESET, RS, WR, BusOut* DATA_PORT, PinName BL = NC, RD ); 00009 00010 int main() 00011 { 00012 int ii,height,width; 00013 00014 height = lcd.GetHeight(); 00015 width = lcd.GetWidth(); 00016 // initialize display - place it in standard portrait mode and set background to black and 00017 // foreground to white color. 00018 lcd.Initialize(); 00019 00020 // print something on the screen 00021 lcd.Print( "Hello, World!", CENTER, 50); // align text to center horizontally and use starndard colors 00022 00023 wait(2); 00024 00025 lcd.ClearScreen(); 00026 00027 for(ii=0;ii<width;ii++) 00028 { 00029 lcd.DrawLine(0, 0, height, ii,COLOR_GREEN); 00030 ii = ii+10; 00031 } 00032 wait(2); 00033 00034 lcd.DrawCircle(height/4, width/4, 20, COLOR_GREEN); 00035 wait(2); 00036 00037 lcd.FillCircle(height/2, width/2, 50, COLOR_GREEN); 00038 wait(2); 00039 00040 lcd.FillTriangle(height/4, width/4,(height/4)+20, (width/4)+40,(height/4)-20, (width/4)+40, COLOR_RED); 00041 00042 while ( 1 ) { } 00043 }
HW information about the mcufriend LCD Shield
ili9328.h@23:eca4414196ca, 2013-06-13 (annotated)
- Committer:
- ttodorov
- Date:
- Thu Jun 13 03:47:51 2013 +0000
- Revision:
- 23:eca4414196ca
- Child:
- 24:ac6e35658037
- ILI9328 driver not working yet
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ttodorov | 23:eca4414196ca | 1 | /** \file ili9328.h |
ttodorov | 23:eca4414196ca | 2 | * \brief mbed LCD driver for displays with the ILI9328 controller. |
ttodorov | 23:eca4414196ca | 3 | * \copyright GNU Public License, v2. or later |
ttodorov | 23:eca4414196ca | 4 | * |
ttodorov | 23:eca4414196ca | 5 | * This library is based on the Arduino/chipKIT UTFT library by Henning |
ttodorov | 23:eca4414196ca | 6 | * Karlsen, http://henningkarlsen.com/electronics/library.php?id=52 |
ttodorov | 23:eca4414196ca | 7 | * |
ttodorov | 23:eca4414196ca | 8 | * Copyright (C)2010-2012 Henning Karlsen. All right reserved. |
ttodorov | 23:eca4414196ca | 9 | * |
ttodorov | 23:eca4414196ca | 10 | * Copyright (C)2012-2013 Todor Todorov. |
ttodorov | 23:eca4414196ca | 11 | * |
ttodorov | 23:eca4414196ca | 12 | * This library is free software; you can redistribute it and/or |
ttodorov | 23:eca4414196ca | 13 | * modify it under the terms of the GNU Lesser General Public |
ttodorov | 23:eca4414196ca | 14 | * License as published by the Free Software Foundation; either |
ttodorov | 23:eca4414196ca | 15 | * version 2.1 of the License, or (at your option) any later version. |
ttodorov | 23:eca4414196ca | 16 | * |
ttodorov | 23:eca4414196ca | 17 | * This library is distributed in the hope that it will be useful, |
ttodorov | 23:eca4414196ca | 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ttodorov | 23:eca4414196ca | 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
ttodorov | 23:eca4414196ca | 20 | * Lesser General Public License for more details. |
ttodorov | 23:eca4414196ca | 21 | * |
ttodorov | 23:eca4414196ca | 22 | * You should have received a copy of the GNU Lesser General Public |
ttodorov | 23:eca4414196ca | 23 | * License along with this library; if not, write to: |
ttodorov | 23:eca4414196ca | 24 | * |
ttodorov | 23:eca4414196ca | 25 | * Free Software Foundation, Inc. |
ttodorov | 23:eca4414196ca | 26 | * 51 Franklin St, 5th Floor, Boston, MA 02110-1301, USA |
ttodorov | 23:eca4414196ca | 27 | * |
ttodorov | 23:eca4414196ca | 28 | *********************************************************************/ |
ttodorov | 23:eca4414196ca | 29 | #ifndef TFTLCD_ILI9328_H |
ttodorov | 23:eca4414196ca | 30 | #define TFTLCD_ILI9328_H |
ttodorov | 23:eca4414196ca | 31 | |
ttodorov | 23:eca4414196ca | 32 | #include "lcd_base.h" |
ttodorov | 23:eca4414196ca | 33 | |
ttodorov | 23:eca4414196ca | 34 | #ifdef __cplusplus |
ttodorov | 23:eca4414196ca | 35 | extern "C" { |
ttodorov | 23:eca4414196ca | 36 | #endif |
ttodorov | 23:eca4414196ca | 37 | |
ttodorov | 23:eca4414196ca | 38 | class ILI9328_LCD : public LCD |
ttodorov | 23:eca4414196ca | 39 | { |
ttodorov | 23:eca4414196ca | 40 | public: |
ttodorov | 23:eca4414196ca | 41 | ILI9328_LCD( PinName CS, PinName RESET, PinName RS, PinName WR, BusOut* DATA_PORT, PinName BL = NC, PinName RD = NC, backlight_t blType = Constant, float defaultBackLightLevel = 1.0 ); |
ttodorov | 23:eca4414196ca | 42 | virtual void Initialize( orientation_t orientation = LANDSCAPE, colordepth_t colors = RGB16 ); |
ttodorov | 23:eca4414196ca | 43 | virtual void Sleep( void ); |
ttodorov | 23:eca4414196ca | 44 | virtual void WakeUp( void ); |
ttodorov | 23:eca4414196ca | 45 | |
ttodorov | 23:eca4414196ca | 46 | protected: |
ttodorov | 23:eca4414196ca | 47 | virtual void WriteCmd( unsigned short cmd ); |
ttodorov | 23:eca4414196ca | 48 | virtual void WriteData( unsigned short data ); |
ttodorov | 23:eca4414196ca | 49 | virtual void SetXY( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2 ); |
ttodorov | 23:eca4414196ca | 50 | virtual void SetPixelColor( unsigned int color, colordepth_t mode = RGB24 ); |
ttodorov | 23:eca4414196ca | 51 | |
ttodorov | 23:eca4414196ca | 52 | private: |
ttodorov | 23:eca4414196ca | 53 | DigitalOut _lcd_pin_wr; |
ttodorov | 23:eca4414196ca | 54 | BusOut* _lcd_port; |
ttodorov | 23:eca4414196ca | 55 | DigitalOut* _lcd_pin_bl; |
ttodorov | 23:eca4414196ca | 56 | DigitalOut* _lcd_pin_rd; |
ttodorov | 23:eca4414196ca | 57 | }; |
ttodorov | 23:eca4414196ca | 58 | |
ttodorov | 23:eca4414196ca | 59 | #ifdef __cplusplus |
ttodorov | 23:eca4414196ca | 60 | } |
ttodorov | 23:eca4414196ca | 61 | #endif |
ttodorov | 23:eca4414196ca | 62 | |
ttodorov | 23:eca4414196ca | 63 | #endif /* TFTLCD_ILI9328_H */ |