Digital_Project / UniGraphic

Dependencies:   SDFileSystem

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TFT_MIPI.cpp Source File

TFT_MIPI.cpp

00001  /* mbed UniGraphic library - Device specific class
00002  * Copyright (c) 2015 Giuliano Dianda
00003  * Released under the MIT License: http://mbed.org/license/mit
00004  */
00005 #include "Protocols.h "
00006 #include "TFT_MIPI.h"
00007 
00008 //////////////////////////////////////////////////////////////////////////////////
00009 // display settings ///////////////////////////////////////////////////////
00010 /////////////////////////////////////////////////////////////////////////
00011 
00012 // put in constructor
00013 //#define LCDSIZE_X       320 // display X pixels, TFTs are usually portrait view
00014 //#define LCDSIZE_Y       480  // display Y pixels
00015 
00016 
00017 
00018 TFT_MIPI::TFT_MIPI(proto_t displayproto, PinName* buspins, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const char *name, unsigned int LCDSIZE_X, unsigned  int LCDSIZE_Y)
00019     : TFT(displayproto, buspins, CS, reset, DC, WR, RD, LCDSIZE_X, LCDSIZE_Y, name)
00020 {
00021     hw_reset();
00022     BusEnable(true);
00023     identify(); // will collect tftID and set mipistd flag
00024     init();
00025     auto_gram_read_format();
00026     set_orientation(0);
00027     cls();
00028     locate(0,0); 
00029 }
00030 
00031 void TFT_MIPI::init()
00032 {
00033     /* Start Initial Sequence ----------------------------------------------------*/
00034     
00035     /* Start Initial Sequence ----------------------------------------------------*/
00036     wr_cmd8(0xD0);  // POWER SETTING             
00037     wr_data8(0x07);
00038     wr_data8(0x42);
00039     wr_data8(0x18);
00040     
00041     wr_cmd8(0xD1);  //  VCOM control          
00042     wr_data8(0x00);
00043     wr_data8(0x07);  
00044     wr_data8(0x10);
00045     
00046     wr_cmd8(0xD2);  //   Power_Setting for Normal Mode 
00047     wr_data8(0x01);   // LCD power supply current
00048     wr_data8(0x02);  // charge pumps
00049     
00050     wr_cmd8(0xC0);  // Panel Driving Setting             
00051     wr_data8(0x10);    // 10 orig
00052     wr_data8(0x3B);   //number of lines+1 *8
00053     wr_data8(0x00);
00054     wr_data8(0x02);
00055     wr_data8(0x11);
00056     
00057      // C1 missing? Display_Timing_Setting for Normal Mode
00058     
00059     //renesas does not have this
00060    // wr_cmd8(0xC5); // Frame Rate and Inversion Control                     
00061    // wr_data8(0x03); // 72hz, datashet tells default 02=85hz
00062     
00063     wr_cmd8(0xC8);  // Gamma settings        
00064     wr_data8(0x00);
00065     wr_data8(0x32);
00066     wr_data8(0x36);
00067     wr_data8(0x45);
00068     wr_data8(0x06);
00069     wr_data8(0x16);
00070     wr_data8(0x37);
00071     wr_data8(0x75);
00072     wr_data8(0x77);
00073     wr_data8(0x54);
00074     wr_data8(0x0C);
00075     wr_data8(0x00);
00076      
00077     
00078 
00079     wr_cmd8(0x36);   // MEMORY_ACCESS_CONTROL (orientation stuff)
00080     wr_data8(0x0A);     // 0A as per chinese example (vertical flipped)
00081    
00082     wr_cmd8(0x3A);                     // COLMOD_PIXEL_FORMAT_SET, not present in AN
00083     wr_data8(0x55);                 // 16 bit pixel 
00084     
00085     wr_cmd8(0x13); // Nomal Displaymode
00086     
00087     wr_cmd8(0x11);                     // sleep out
00088     wait_ms(150);
00089      
00090     wr_cmd8(0x29);                     // display on
00091     wait_ms(150);
00092 
00093 }