Gitakichi Tokyo / Mbed 2 deprecated ATM0177B3A

Dependencies:   mbed

Revision:
2:4d5b94a92f19
Parent:
1:cd2949e87b17
Child:
3:9caa79f40909
--- a/ili9163lcd.cpp	Fri Jan 01 11:08:23 2021 +0000
+++ b/ili9163lcd.cpp	Fri Jan 01 13:57:57 2021 +0000
@@ -1,6 +1,6 @@
 /**
  * @file ili9163lcd.c
- * @brief ILI9163 128x128 LCD Driver
+ * @brief ILI9163 128x160 LCD Driver
  *
  * This code has been ported from the ili9163lcd library for mbed
  * made by Jun Morita.
@@ -22,6 +22,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
+ * @author Gitakichi
  * @author Jun Morita (iccraft)
  * @author Simon Inns <simon.inns@gmail.com>
  * @author Christopher Vagnetoft (NoccyLabs)
@@ -123,13 +124,14 @@
     
     lcdWriteCommand(SET_PIXEL_FORMAT);
     lcdWriteParameter(0x05); // 16 bits per pixel
-   
+    /*
     lcdWriteCommand(SET_GAMMA_CURVE);
     lcdWriteParameter(0x04); // Select gamma curve 3
     
     lcdWriteCommand(GAM_R_SEL);
     lcdWriteParameter(0x01); // Gamma adjustment enabled
     
+    
     lcdWriteCommand(POSITIVE_GAMMA_CORRECT);
     lcdWriteParameter(0x3f); // 1st Parameter
     lcdWriteParameter(0x25); // 2nd Parameter
@@ -163,6 +165,7 @@
     lcdWriteParameter(0x2b); // 13th Parameter
     lcdWriteParameter(0x2b); // 14th Parameter
     lcdWriteParameter(0x3a); // 15th Parameter
+    */
     
     lcdWriteCommand(FRAME_RATE_CONTROL1);
     lcdWriteParameter(0x08); // DIVA = 8
@@ -185,17 +188,18 @@
     lcdWriteCommand(VCOM_OFFSET_CONTROL);
     lcdWriteParameter(0x40); // nVM = 0, VMF = 64: VCOMH output = VMH, VCOML output = VML   
     
-    lcdWriteCommand(SET_COLUMN_ADDRESS);
-    lcdWriteParameter(0x00); // XSH
-    lcdWriteParameter(0x00); // XSL
-    lcdWriteParameter(0x00); // XEH
-    lcdWriteParameter(0x7f); // XEL (128 pixels x)
+    //lcdWriteCommand(SET_COLUMN_ADDRESS);
+    //lcdWriteParameter(0x00); // XSH
+    //lcdWriteParameter(0x00); // XSL
+    //lcdWriteParameter(0x00); // XEH
+    //lcdWriteParameter(0x7f); // XEL (128 pixels x)
    
-    lcdWriteCommand(SET_PAGE_ADDRESS);
-    lcdWriteParameter(0x00);
-    lcdWriteParameter(0x00);
-    lcdWriteParameter(0x00);
-    lcdWriteParameter(0x7f); // 128 pixels y
+    //lcdWriteCommand(SET_PAGE_ADDRESS);
+    //lcdWriteParameter(0x00);
+    //lcdWriteParameter(0x00);
+    //lcdWriteParameter(0x00);
+    //lcdWriteParameter(0x7f); // 128 pixels y
+    //lcdWriteParameter(PAGE_MAX); // 160 pixels y
     
     // Select display orientation
     lcdWriteCommand(SET_ADDRESS_MODE);
@@ -217,18 +221,22 @@
     lcdWriteParameter(0x00);
     lcdWriteParameter(0x00);
     lcdWriteParameter(0x00);
-    lcdWriteParameter(0x7f);
+    lcdWriteParameter(COL_MAX);
 
     // Set the page address to 0-127
     lcdWriteCommand(SET_PAGE_ADDRESS);
     lcdWriteParameter(0x00);
     lcdWriteParameter(0x00);
     lcdWriteParameter(0x00);
-    lcdWriteParameter(0x7f);
+    //lcdWriteParameter(0x7f);
+    lcdWriteParameter(PAGE_MAX);
   
     // Plot the pixels
     lcdWriteCommand(WRITE_MEMORY_START);
-    for(pixel = 0; pixel < 16385; pixel++) lcdWriteData(colour >> 8, colour);
+    //for(pixel = 0; pixel < 16385; pixel++) lcdWriteData(colour >> 8, colour);
+    for(pixel = 0; pixel < 20481; pixel++) lcdWriteData(colour >> 8, colour);
+    //128x128=16,384
+    //128x160=20,480
 }
 
 void lcdPlot(uint8_t x, uint8_t y, uint16_t colour)
@@ -238,14 +246,14 @@
     lcdWriteParameter(0x00);
     lcdWriteParameter(x);
     lcdWriteParameter(0x00);
-    lcdWriteParameter(0x7f);
+    lcdWriteParameter(COL_MAX);
   
     // Vertical Address end Position
     lcdWriteCommand(SET_PAGE_ADDRESS);
     lcdWriteParameter(0x00);
     lcdWriteParameter(y);
     lcdWriteParameter(0x00);
-    lcdWriteParameter(0x7f);
+    lcdWriteParameter(PAGE_MAX);
 
     // Plot the point
     lcdWriteCommand(WRITE_MEMORY_START);
@@ -341,7 +349,7 @@
     lcdWriteParameter(0x00);
     lcdWriteParameter(y0);
     lcdWriteParameter(0x00);
-    lcdWriteParameter(0x7f);
+    lcdWriteParameter(PAGE_MAX);
         
     lcdWriteCommand(WRITE_MEMORY_START);
     
@@ -401,7 +409,7 @@
     lcdWriteParameter(0x00);
     lcdWriteParameter(y);
     lcdWriteParameter(0x00);
-    lcdWriteParameter(0x7f);
+    lcdWriteParameter(PAGE_MAX);
         
     lcdWriteCommand(WRITE_MEMORY_START);