alterações para funcionar com o display

Files at this revision

API Documentation at this revision

Comitter:
mazgch
Date:
Mon Oct 21 19:38:10 2013 +0000
Parent:
4:f018e272220b
Child:
7:3ac45671dc77
Commit message:
make reset optional by constructing the DigitalOut only when needed and not NC.

Changed in this revision

SPI_TFT_ILI9341.cpp Show annotated file Show diff for this revision Revisions of this file
SPI_TFT_ILI9341.h Show annotated file Show diff for this revision Revisions of this file
--- a/SPI_TFT_ILI9341.cpp	Fri Oct 18 09:04:42 2013 +0000
+++ b/SPI_TFT_ILI9341.cpp	Mon Oct 21 19:38:10 2013 +0000
@@ -24,10 +24,11 @@
 //extern DigitalOut xx;     // debug !!
 
 SPI_TFT_ILI9341::SPI_TFT_ILI9341(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset, PinName dc, const char *name)
-    : _spi(mosi, miso, sclk), _cs(cs), _reset(reset), _dc(dc), GraphicsDisplay(name)
+    : _spi(mosi, miso, sclk), _cs(cs), _dc(dc), GraphicsDisplay(name)
 {
     orientation = 0;
     char_x = 0;
+    _reset = reset;
     tft_reset();
 }
 
@@ -109,10 +110,13 @@
     _spi.frequency(10000000);          // 10 Mhz SPI clock
     _cs = 1;                           // cs high
     _dc = 1;                           // dc high 
-    _reset = 0;                        // display reset
-
-    wait_us(50);
-    _reset = 1;                       // end hardware reset
+    if (_reset != NC)
+    {
+        DigitalOut rst(_reset);
+        rst = 0;                       // display reset
+        wait_us(50);
+        rst = 1;                       // end hardware reset
+    }
     wait_ms(5);
      
     wr_cmd(0x01);                     // SW reset  
--- a/SPI_TFT_ILI9341.h	Fri Oct 18 09:04:42 2013 +0000
+++ b/SPI_TFT_ILI9341.h	Mon Oct 21 19:38:10 2013 +0000
@@ -277,7 +277,7 @@
     
   SPI _spi;
   DigitalOut _cs; 
-  DigitalOut _reset;
+  PinName _reset;
   DigitalOut _dc;
   unsigned char* font;