Juan Loreto / Mbed 2 deprecated Nucleo-F411RE-LGDP4535_TFT_Demo

Dependencies:   mbed

Revision:
0:e67bf8f398ee
diff -r 000000000000 -r e67bf8f398ee Inits/LGDP4535.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Inits/LGDP4535.cpp	Sun Aug 23 15:50:19 2015 +0000
@@ -0,0 +1,98 @@
+ /* mbed library - custom TFT driver class, LGDP4535 specific 
+ * Based on Unigraphic library from Giuliano Dianda modified by Juan Loreto
+ * Released under the MIT License: http://mbed.org/license/mit
+ */
+ 
+#include "Protocols.h"
+#include "LGDP4535.h"
+
+//////////////////////////////////////////////////////////////////////////////////
+// display settings ///////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+
+
+LGDP4535::LGDP4535(proto_t displayproto, PortName port, PinName CS, PinName reset, PinName DC, PinName WR, PinName RD, const char *name , unsigned int LCDSIZE_X, unsigned  int LCDSIZE_Y)
+    : TFT4535(displayproto, port, CS, reset, DC, WR, RD, LCDSIZE_X, LCDSIZE_Y, name)
+{
+    hw_reset();
+    BusEnable(true);  //set CS low, will stay low untill manually set high with BusEnable(false);
+    identify(); // will collect tftID
+    init4535();
+    auto_gram_read_format();// try to get read gram pixel format, could be 16bit or 18bit, RGB or BGR. Will set flags accordingly
+    set_orientation(0);
+    FastWindow(true); // most but not all controllers support this, even if datasheet tells they should. 
+    cls();
+    locate(0,0); 
+}
+LGDP4535::LGDP4535(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)
+    : TFT4535(displayproto, buspins, CS, reset, DC, WR, RD, LCDSIZE_X, LCDSIZE_Y, name)
+{
+    hw_reset();
+    BusEnable(true);  //set CS low, will stay low untill manually set high with BusEnable(false);
+    identify(); // will collect tftID
+    init4535();
+    auto_gram_read_format();// try to get read gram pixel format, could be 16bit or 18bit, RGB or BGR. Will set flags accordingly
+    set_orientation(0);
+    FastWindow(true); // most but not all controllers support this, even if datasheet tells they should. 
+    cls();
+    locate(0,0); 
+}
+LGDP4535::LGDP4535(proto_t displayproto, int Hz, PinName mosi, PinName miso, PinName sclk, PinName CS, PinName reset, const char *name, unsigned int LCDSIZE_X, unsigned  int LCDSIZE_Y)
+    : TFT4535(displayproto, Hz, mosi, miso, sclk, CS, reset, LCDSIZE_X, LCDSIZE_Y, name)
+{
+    hw_reset(); //TFT class forwards to Protocol class
+    BusEnable(true); //set CS low, TFT932x class will toggle CS every transfer
+    identify(); // will collect tftID
+    init4535();
+    auto_gram_read_format();// try to get read gram pixel format, could be 16bit or 18bit, RGB or BGR. Will set flags accordingly
+    set_orientation(0); 
+    FastWindow(true); // most but not all controllers support this, even if datasheet tells they should. 
+    cls();
+    locate(0,0); 
+}
+// reset and init the lcd controller
+
+void LGDP4535::init4535()
+{
+ 
+    reg_write(0x0015,0x0030);
+    reg_write(0x009A,0x0010);
+    reg_write(0x0011,0x0020);
+    reg_write(0x0010,0x3428);
+    reg_write(0x0012,0x0002);
+    reg_write(0x0013,0x1038);
+    wait_ms(40);
+    reg_write(0x0012,0x0012);
+    wait_ms(40);    
+    reg_write(0x0010,0x3420);
+    reg_write(0x0013,0x3045);
+    wait_ms(70);
+    reg_write(0x0030,0x0000);
+    reg_write(0x0031,0x0402);
+    reg_write(0x0032,0x0307);
+    reg_write(0x0033,0x0304);
+    reg_write(0x0034,0x0004);
+    reg_write(0x0035,0x0401);
+    reg_write(0x0036,0x0707);
+    reg_write(0x0037,0x0305);
+    reg_write(0x0038,0x0610);
+    reg_write(0x0039,0x0610);
+    reg_write(0x0001,0x0100);
+    reg_write(0x0002,0x0300);
+    reg_write(0x0003,0x1030);
+    reg_write(0x0008,0x0808);
+    reg_write(0x000A,0x0008);
+    reg_write(0x0060,0x2700);
+    reg_write(0x0061,0x0001);
+    reg_write(0x0090,0x013E);
+    reg_write(0x0092,0x0100);
+    reg_write(0x0093,0x0100);
+    reg_write(0x00A0,0x3000);
+    reg_write(0x00A3,0x0010);
+    reg_write(0x0007,0x0001);
+    reg_write(0x0007,0x0021);
+    reg_write(0x0007,0x0023);
+    reg_write(0x0007,0x0033);
+    reg_write(0x0007,0x0133);
+    
+}
\ No newline at end of file