Gitakichi Tokyo / Mbed 2 deprecated ATM0177B3A

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
gitakichi
Date:
Tue Jan 05 07:10:40 2021 +0000
Parent:
8:761e71533bff
Commit message:
SMPTE colorbar modoki and 16bit charactor

Changed in this revision

ili9163lcd.cpp Show annotated file Show diff for this revision Revisions of this file
ili9163lcd.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/ili9163lcd.cpp	Sat Jan 02 10:36:18 2021 +0000
+++ b/ili9163lcd.cpp	Tue Jan 05 07:10:40 2021 +0000
@@ -359,13 +359,11 @@
     for(uint16_t page = 0;page < 160;page++){
         lcdWriteData_burst(line_buf,128);
     }
-    lcdWriteData_burst(line_buf,128);
-    
 }
 
 void colorbar(void)
 {
-    uint16_t colour;
+    uint16_t colour_a,colour_b;
   
     // Set the column address to 0-127
     lcdWriteCommand(SET_COLUMN_ADDRESS);
@@ -384,18 +382,38 @@
   
     // Plot the pixels
     lcdWriteCommand(WRITE_MEMORY_START);
-    CS_ = 0;
-    A0_ = 1;
     for(uint16_t page = 0;page < 160;page++){
-        if(page < 28)       colour = decodeRgbValue(31, 31, 31);
-        else if(page < 50)  colour = decodeRgbValue(31, 31, 0);
-        else if(page < 72)  colour = decodeRgbValue(0, 31, 31);
-        else if(page < 94)  colour = decodeRgbValue(0, 31, 0);
-        else if(page < 116) colour = decodeRgbValue(31, 0, 31);
-        else if(page < 138) colour = decodeRgbValue(31, 0, 0);
-        else                colour = decodeRgbValue(0, 0, 31);
+        if(page < 28){
+            colour_a = COLORBAR_W;//W
+            colour_b = COLORBAR_B;//B
+        }
+        else if(page < 50){
+            colour_a = COLORBAR_Y;//Y
+            colour_b = COLORBAR_BK;//BK
+        }
+        else if(page < 72){
+            colour_a = COLORBAR_CY;//CY
+            colour_b = COLORBAR_MG;//MG
+        }
+        else if(page < 94){
+            colour_a = COLORBAR_G;//G
+            colour_b = COLORBAR_BK;//BK
+        }
+        else if(page < 116){
+            colour_a = COLORBAR_MG;//MG
+            colour_b = COLORBAR_CY;//CY
+        }
+        else if(page < 138){
+            colour_a = COLORBAR_R;//R
+            colour_b = COLORBAR_BK;//BK
+        }
+        else{
+            colour_a = COLORBAR_B;//B
+            colour_b = COLORBAR_W;//W
+        }
         
-        lcdWriteData_sameburst(colour,128);
+        lcdWriteData_sameburst(colour_b,48);
+        lcdWriteData_sameburst(colour_a,80);
     }
 }
 
@@ -585,6 +603,47 @@
     }
 }
 
+void lcdPutCh_16(uint16_t *font16x16_hex,uint8_t x, uint8_t y, uint16_t fgColour, uint16_t bgColour)
+{
+    uint8_t row, column;
+    uint8_t size = 2;
+    
+    //uint16_t font16x16_hex[]={
+    //    0x0000,0x7CF8,0x0488,0x0488,0x04F8,0x3C20,0x21FC,0x2124,
+    //    0x3D24,0x0524,0x05FC,0x0524,0x0422,0x043E,0x0BC1,0x3001
+    //};
+    
+    
+    lcdWriteCommand(SET_COLUMN_ADDRESS); // Horizontal Address Start Position
+    lcdWriteParameter(0x00);
+    lcdWriteParameter(x);
+    lcdWriteParameter(0x00);
+    lcdWriteParameter(x+(size*16)-1);
+  
+    lcdWriteCommand(SET_PAGE_ADDRESS); // Vertical Address end Position
+    lcdWriteParameter(0x00);
+    lcdWriteParameter(y);
+    lcdWriteParameter(0x00);
+    lcdWriteParameter(PAGE_MAX);
+        
+    lcdWriteCommand(WRITE_MEMORY_START);
+    
+    // Plot the font data
+    for (row = 0; row < 16; row++)
+    {
+        for(int j=0;j<size;j++){
+        for (column = 0; column < 16; column++)
+        {
+            for(int i=0;i<size;i++){
+            if ((font16x16_hex[row]) & (0b1000000000000000 >> column))
+                lcdWriteData(fgColour >> 8, fgColour);
+            else lcdWriteData(bgColour >> 8, bgColour);
+            }
+        }
+        }
+    }
+}
+
 // Plot a string of characters to the LCD
 void lcdPutS(const char *string, uint8_t x, uint8_t y, uint16_t fgColour, uint16_t bgColour)
 {
--- a/ili9163lcd.h	Sat Jan 02 10:36:18 2021 +0000
+++ b/ili9163lcd.h	Tue Jan 05 07:10:40 2021 +0000
@@ -115,6 +115,16 @@
 #define COL_MAX                 0x7f
 #define PAGE_MAX                0x9f
 
+//31*0.75=23.25
+#define COLORBAR_W      decodeRgbValue(23, 23, 23)//W
+#define COLORBAR_Y      decodeRgbValue(23, 23, 0)//Y
+#define COLORBAR_CY     decodeRgbValue(0, 23, 23)//CY
+#define COLORBAR_G      decodeRgbValue(0, 23, 0)//G
+#define COLORBAR_MG     decodeRgbValue(23, 0, 23)//MG
+#define COLORBAR_R      decodeRgbValue(23, 0, 0)//R
+#define COLORBAR_B      decodeRgbValue(0, 0, 23)//B
+#define COLORBAR_BK     decodeRgbValue(0, 0, 0)//BK
+
 // Macros and in-lines:
 
 // Translates a 3 byte RGB value into a 2 byte value for the LCD (values should be 0-31)
@@ -154,5 +164,6 @@
 
 void lcdPutCh(unsigned char character, uint8_t x, uint8_t y, uint16_t fgColour, uint16_t bgColour);
 void lcdPutS(const char *string, uint8_t x, uint8_t y, uint16_t fgColour, uint16_t bgColour);
+void lcdPutCh_16(uint16_t *font16x16_hex,uint8_t x, uint8_t y, uint16_t fgColour, uint16_t bgColour);
 
 #endif /* ILI9163LCD_H_ */
--- a/main.cpp	Sat Jan 02 10:36:18 2021 +0000
+++ b/main.cpp	Tue Jan 05 07:10:40 2021 +0000
@@ -42,11 +42,42 @@
     //lcdWriteData_monoburst((bool*)shehuizhuyi,20480);
     //wait(5);
     
+    lcdClearDisplay(decodeRgbValue(31, 31, 10));
+    
+    uint16_t chr_fu[]={
+        0x0100,0x0100,0x7ffe,0x4002,0x5ffa,0x0000,0x0ff0,0x0810,0x0ff0,0x0000,0x1ff8,0x1108,0x1ff8,0x1108,0x1ff8,0x0000};
+    uint16_t chr_qiang[]={
+        0x0000,0x7CF8,0x0488,0x0488,0x04F8,0x3C20,0x21FC,0x2124,0x3D24,0x0524,0x05FC,0x0520,0x0422,0x043E,0x0BC1,0x3001};
+    uint16_t chr_min[]={
+        0x0000,0x1ffc,0x1004,0x1004,0x1004,0x1ffc,0x1080,0x1080,0x1fff,0x1040,0x1040,0x1020,0x1020,0x1312,0x1c0a,0x6006};
+    uint16_t chr_zhu[]={
+        0x0100,0x0080,0x0080,0x3ffe,0x0080,0x0080,0x0080,0x0080,0x1ffc,0x0080,0x0080,0x0080,0x0080,0x0080,0x7fff,0x0000};
+    uint16_t chr_wen[]={
+        0x0100,0x0600,0x3c7e,0x0442,0x0442,0x0442,0x7fc2,0x0c42,0x0e42,0x1542,0x14c2,0x2442,0x447e,0x0400,0x0400,0x0400};
+    uint16_t chr_ming[]={
+        0x0108,0x2109,0x11EA,0x090C,0x0109,0x7169,0x1187,0x1010,0x1020,0x11FE,0x1102,0x11FE,0x1502,0x1902,0x31FE,0x0102};
+    uint16_t chr_he[]={
+        0x0080,0x0080,0x0080,0x7fff,0x0410,0x0410,0x0410,0x0220,0x0220,0x0140,0x0080,0x0080,0x0140,0x0220,0x0c18,0x7007};
+    uint16_t chr_xie[]={
+        0x0000,0x3e7e,0x2242,0x2242,0x2242,0x227e,0x3e42,0x2242,0x2242,0x227e,0x2242,0x3e42,0x0082,0x0082,0x0102,0x0206};
+
+    
+    lcdPutCh_16(chr_fu,0, 0, decodeRgbValue(31, 0, 0), decodeRgbValue(31, 31, 10));
+    lcdPutCh_16(chr_qiang,32, 0, decodeRgbValue(31, 0, 0), decodeRgbValue(31, 31, 10));
+    lcdPutCh_16(chr_min,64, 0, decodeRgbValue(31, 0, 0), decodeRgbValue(31, 31, 10));
+    lcdPutCh_16(chr_zhu,96, 0, decodeRgbValue(31, 0, 0), decodeRgbValue(31, 31, 10));
+    
+    lcdPutCh_16(chr_wen,0, 32, decodeRgbValue(31, 0, 0), decodeRgbValue(31, 31, 10));
+    lcdPutCh_16(chr_ming,32, 32, decodeRgbValue(31, 0, 0), decodeRgbValue(31, 31, 10));
+    lcdPutCh_16(chr_he,64, 32, decodeRgbValue(31, 0, 0), decodeRgbValue(31, 31, 10));
+    lcdPutCh_16(chr_xie,96, 32, decodeRgbValue(31, 0, 0), decodeRgbValue(31, 31, 10));
+    wait(2);
+    
     grade();
-    wait(5);
+    wait(2);
     
     colorbar();
-    wait(5);
+    wait(10);
     
     lcdClearDisplay(decodeRgbValue(0, 0, 0));