test

Dependencies:   mbed-STM32F103C8T6 SHT21_ncleee

Committer:
bbw
Date:
Wed Apr 15 11:36:03 2020 +0000
Revision:
1:0fe432e5dfc4
Test_bob_0415

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bbw 1:0fe432e5dfc4 1 #include "main.h"
bbw 1:0fe432e5dfc4 2
bbw 1:0fe432e5dfc4 3 void ST7789V_CTRL_Write(unsigned char data)
bbw 1:0fe432e5dfc4 4 {
bbw 1:0fe432e5dfc4 5 lcdBus.write(data);
bbw 1:0fe432e5dfc4 6 }
bbw 1:0fe432e5dfc4 7
bbw 1:0fe432e5dfc4 8 void ST7789V_writeCommand(unsigned char command)
bbw 1:0fe432e5dfc4 9 {
bbw 1:0fe432e5dfc4 10 TFTCS=0;
bbw 1:0fe432e5dfc4 11 TFTDC = 0;
bbw 1:0fe432e5dfc4 12 ST7789V_CTRL_Write(command);
bbw 1:0fe432e5dfc4 13 TFTWR = 0;
bbw 1:0fe432e5dfc4 14 TFTWR = 1;
bbw 1:0fe432e5dfc4 15 TFTCS=1;
bbw 1:0fe432e5dfc4 16 }
bbw 1:0fe432e5dfc4 17
bbw 1:0fe432e5dfc4 18 void ST7789V_writeData(unsigned char data)
bbw 1:0fe432e5dfc4 19 {
bbw 1:0fe432e5dfc4 20 TFTCS=0;
bbw 1:0fe432e5dfc4 21 TFTDC = 1;
bbw 1:0fe432e5dfc4 22 ST7789V_CTRL_Write(data);
bbw 1:0fe432e5dfc4 23 TFTWR = 0;
bbw 1:0fe432e5dfc4 24 TFTWR = 1;
bbw 1:0fe432e5dfc4 25 TFTCS=1;
bbw 1:0fe432e5dfc4 26 }
bbw 1:0fe432e5dfc4 27
bbw 1:0fe432e5dfc4 28 void ST7789V_writeOneDot(unsigned int color)
bbw 1:0fe432e5dfc4 29 {
bbw 1:0fe432e5dfc4 30 TFTCS=0;
bbw 1:0fe432e5dfc4 31 TFTRD=1;
bbw 1:0fe432e5dfc4 32 TFTDC=1;
bbw 1:0fe432e5dfc4 33
bbw 1:0fe432e5dfc4 34 ST7789V_CTRL_Write(color>>8);
bbw 1:0fe432e5dfc4 35 TFTWR=0;
bbw 1:0fe432e5dfc4 36 TFTWR=1;
bbw 1:0fe432e5dfc4 37
bbw 1:0fe432e5dfc4 38 ST7789V_CTRL_Write(color);
bbw 1:0fe432e5dfc4 39 TFTWR=0;
bbw 1:0fe432e5dfc4 40 TFTWR=1;
bbw 1:0fe432e5dfc4 41
bbw 1:0fe432e5dfc4 42 TFTCS=1;
bbw 1:0fe432e5dfc4 43 }
bbw 1:0fe432e5dfc4 44
bbw 1:0fe432e5dfc4 45 void ST7789V_Init(void)
bbw 1:0fe432e5dfc4 46 {
bbw 1:0fe432e5dfc4 47 TFTDC = 0;
bbw 1:0fe432e5dfc4 48 TFTRD = 1;
bbw 1:0fe432e5dfc4 49 TFTWR = 0;
bbw 1:0fe432e5dfc4 50
bbw 1:0fe432e5dfc4 51 #if 0
bbw 1:0fe432e5dfc4 52 TFTRST = 0; // reset the chip[]
bbw 1:0fe432e5dfc4 53 wait_us(100);
bbw 1:0fe432e5dfc4 54 TFTRST = 1; // take it out of reset
bbw 1:0fe432e5dfc4 55 #endif
bbw 1:0fe432e5dfc4 56
bbw 1:0fe432e5dfc4 57 wait_us(100);
bbw 1:0fe432e5dfc4 58 ST7789V_writeCommand(0x11); /* exit SLEEP mode*/
bbw 1:0fe432e5dfc4 59 wait_us(300);
bbw 1:0fe432e5dfc4 60 ST7789V_writeCommand(0x36);
bbw 1:0fe432e5dfc4 61 ST7789V_writeData(0x00); /* MADCTL: memory data access control*/
bbw 1:0fe432e5dfc4 62 ST7789V_writeCommand(0x3A);
bbw 1:0fe432e5dfc4 63 ST7789V_writeData(0x05); /* COLMOD: Interface Pixel format*/
bbw 1:0fe432e5dfc4 64 ST7789V_writeCommand(0xB2);
bbw 1:0fe432e5dfc4 65 ST7789V_writeData(0x0C);
bbw 1:0fe432e5dfc4 66 ST7789V_writeData(0x0C);
bbw 1:0fe432e5dfc4 67 ST7789V_writeData(0x00);
bbw 1:0fe432e5dfc4 68 ST7789V_writeData(0x33);
bbw 1:0fe432e5dfc4 69 ST7789V_writeData(0x33); /*PORCTRK: Porch setting*/
bbw 1:0fe432e5dfc4 70 ST7789V_writeCommand(0xB7);
bbw 1:0fe432e5dfc4 71 ST7789V_writeData(0x75); /*GCTRL: Gate Control*/
bbw 1:0fe432e5dfc4 72 ST7789V_writeCommand(0xBB);
bbw 1:0fe432e5dfc4 73 ST7789V_writeData(0x3d); /*VCOMS: VCOM setting*/
bbw 1:0fe432e5dfc4 74 //ST7789V_writeCommand(0xC0);
bbw 1:0fe432e5dfc4 75 //ST7789V_writeData(0x2C); /*LCMCTRL: LCM Control*/
bbw 1:0fe432e5dfc4 76 ST7789V_writeCommand(0xC2);
bbw 1:0fe432e5dfc4 77 ST7789V_writeData(0x01);
bbw 1:0fe432e5dfc4 78 //ST7789V_writeData(0xFF); /*VDVVRHEN: VDV and VRH Command Enable*/
bbw 1:0fe432e5dfc4 79 ST7789V_writeCommand(0xC3);
bbw 1:0fe432e5dfc4 80 ST7789V_writeData(0x19); /*VRHS: VRH Set*/
bbw 1:0fe432e5dfc4 81 ST7789V_writeCommand(0xC4);
bbw 1:0fe432e5dfc4 82 ST7789V_writeData(0x20); /*VDVS: VDV Set*/
bbw 1:0fe432e5dfc4 83 ST7789V_writeCommand(0xC6);
bbw 1:0fe432e5dfc4 84 ST7789V_writeData(0x0F); /*FRCTRL2: Frame Rate control in normal mode*/
bbw 1:0fe432e5dfc4 85 ST7789V_writeCommand(0xD0);
bbw 1:0fe432e5dfc4 86 ST7789V_writeData(0xA4);
bbw 1:0fe432e5dfc4 87 ST7789V_writeData(0xA1); /*PWCTRL1: Power Control 1*/
bbw 1:0fe432e5dfc4 88 ST7789V_writeCommand(0xD6);
bbw 1:0fe432e5dfc4 89 ST7789V_writeData(0xA1);
bbw 1:0fe432e5dfc4 90 ST7789V_writeCommand(0xE0);
bbw 1:0fe432e5dfc4 91 ST7789V_writeData(0x70);
bbw 1:0fe432e5dfc4 92 ST7789V_writeData(0x04);
bbw 1:0fe432e5dfc4 93 ST7789V_writeData(0x08);
bbw 1:0fe432e5dfc4 94 ST7789V_writeData(0x09);
bbw 1:0fe432e5dfc4 95 ST7789V_writeData(0x09);
bbw 1:0fe432e5dfc4 96 ST7789V_writeData(0x05);
bbw 1:0fe432e5dfc4 97 ST7789V_writeData(0x2A);
bbw 1:0fe432e5dfc4 98 ST7789V_writeData(0x33);
bbw 1:0fe432e5dfc4 99 ST7789V_writeData(0x41);
bbw 1:0fe432e5dfc4 100 ST7789V_writeData(0x07);
bbw 1:0fe432e5dfc4 101 ST7789V_writeData(0x13);
bbw 1:0fe432e5dfc4 102 ST7789V_writeData(0x13);
bbw 1:0fe432e5dfc4 103 ST7789V_writeData(0x29);
bbw 1:0fe432e5dfc4 104 ST7789V_writeData(0x0F); /*PVGAMCTRL: Positive Voltage Gamma control*/
bbw 1:0fe432e5dfc4 105 ST7789V_writeCommand(0xE1);
bbw 1:0fe432e5dfc4 106 ST7789V_writeData(0x70);
bbw 1:0fe432e5dfc4 107 ST7789V_writeData(0x03);
bbw 1:0fe432e5dfc4 108 ST7789V_writeData(0x09);
bbw 1:0fe432e5dfc4 109 ST7789V_writeData(0x0A);
bbw 1:0fe432e5dfc4 110 ST7789V_writeData(0x09);
bbw 1:0fe432e5dfc4 111 ST7789V_writeData(0x06);
bbw 1:0fe432e5dfc4 112 ST7789V_writeData(0x2B);
bbw 1:0fe432e5dfc4 113 ST7789V_writeData(0x34);
bbw 1:0fe432e5dfc4 114 ST7789V_writeData(0x41);
bbw 1:0fe432e5dfc4 115 ST7789V_writeData(0x07);
bbw 1:0fe432e5dfc4 116 ST7789V_writeData(0x12);
bbw 1:0fe432e5dfc4 117 ST7789V_writeData(0x14);
bbw 1:0fe432e5dfc4 118 ST7789V_writeData(0x28);
bbw 1:0fe432e5dfc4 119 ST7789V_writeData(0x2E); /*NVGAMCTRL: Negative Voltage Gamma control*/
bbw 1:0fe432e5dfc4 120 ST7789V_writeCommand(0x21);
bbw 1:0fe432e5dfc4 121 ST7789V_writeCommand(0x29);
bbw 1:0fe432e5dfc4 122 ST7789V_writeCommand(0x2A);
bbw 1:0fe432e5dfc4 123 ST7789V_writeData(0x00);
bbw 1:0fe432e5dfc4 124 ST7789V_writeData(0x00);
bbw 1:0fe432e5dfc4 125 ST7789V_writeData(0x00);
bbw 1:0fe432e5dfc4 126 ST7789V_writeData(0xEF); /*X address set*/
bbw 1:0fe432e5dfc4 127 ST7789V_writeCommand(0x2B);
bbw 1:0fe432e5dfc4 128 ST7789V_writeData(0x00);
bbw 1:0fe432e5dfc4 129 ST7789V_writeData(0x00);
bbw 1:0fe432e5dfc4 130 ST7789V_writeData(0x00);
bbw 1:0fe432e5dfc4 131 ST7789V_writeData(0xEF); /*Y address set*/
bbw 1:0fe432e5dfc4 132 ST7789V_writeCommand(0x2C);
bbw 1:0fe432e5dfc4 133 //wait_us(10);
bbw 1:0fe432e5dfc4 134 //ST7789V_writeCommand(0x29); /*Enable Display*/
bbw 1:0fe432e5dfc4 135 }
bbw 1:0fe432e5dfc4 136
bbw 1:0fe432e5dfc4 137 void BlockWrite(unsigned int Xstart,unsigned int Xend,unsigned int Ystart,unsigned int Yend)
bbw 1:0fe432e5dfc4 138 {
bbw 1:0fe432e5dfc4 139 ST7789V_writeCommand(0x2a);
bbw 1:0fe432e5dfc4 140 ST7789V_writeData((Xstart)>>8);
bbw 1:0fe432e5dfc4 141 ST7789V_writeData((Xstart)&0xff);
bbw 1:0fe432e5dfc4 142
bbw 1:0fe432e5dfc4 143 ST7789V_writeData((Xend)>>8);
bbw 1:0fe432e5dfc4 144 ST7789V_writeData((Xend)&0xff);
bbw 1:0fe432e5dfc4 145
bbw 1:0fe432e5dfc4 146 ST7789V_writeCommand(0x2b);
bbw 1:0fe432e5dfc4 147 ST7789V_writeData((Ystart+40)>>8);
bbw 1:0fe432e5dfc4 148
bbw 1:0fe432e5dfc4 149 ST7789V_writeData((Ystart+40)&0xff);
bbw 1:0fe432e5dfc4 150 ST7789V_writeData((Yend+40)>>8);
bbw 1:0fe432e5dfc4 151
bbw 1:0fe432e5dfc4 152 ST7789V_writeData((Yend+40)&0xff);
bbw 1:0fe432e5dfc4 153 ST7789V_writeCommand(0x2c);
bbw 1:0fe432e5dfc4 154 }
bbw 1:0fe432e5dfc4 155
bbw 1:0fe432e5dfc4 156 unsigned char ToOrd(unsigned char ch)
bbw 1:0fe432e5dfc4 157 {
bbw 1:0fe432e5dfc4 158 if(ch<32)
bbw 1:0fe432e5dfc4 159 {
bbw 1:0fe432e5dfc4 160 ch=95;
bbw 1:0fe432e5dfc4 161 }
bbw 1:0fe432e5dfc4 162 else if((ch>=32)&&(ch<=47)) //(32~47)空格~/
bbw 1:0fe432e5dfc4 163 {
bbw 1:0fe432e5dfc4 164 ch=(ch-32)+10+62;
bbw 1:0fe432e5dfc4 165 }
bbw 1:0fe432e5dfc4 166 else if((ch>=48)&&(ch<=57))//(48~57)0~9
bbw 1:0fe432e5dfc4 167 {
bbw 1:0fe432e5dfc4 168 ch=ch-48;
bbw 1:0fe432e5dfc4 169 }
bbw 1:0fe432e5dfc4 170 else if((ch>=58)&&(ch<=64))//(58~64):~@
bbw 1:0fe432e5dfc4 171 {
bbw 1:0fe432e5dfc4 172 ch=(ch-58)+10+62+16;
bbw 1:0fe432e5dfc4 173 }
bbw 1:0fe432e5dfc4 174 else if((ch>=65)&&(ch<=126))//(65~126)A~~
bbw 1:0fe432e5dfc4 175 {
bbw 1:0fe432e5dfc4 176 ch=(ch-65)+10;
bbw 1:0fe432e5dfc4 177 }
bbw 1:0fe432e5dfc4 178 else if(ch>126)
bbw 1:0fe432e5dfc4 179 {
bbw 1:0fe432e5dfc4 180 ch=95;
bbw 1:0fe432e5dfc4 181 }
bbw 1:0fe432e5dfc4 182
bbw 1:0fe432e5dfc4 183 return ch;
bbw 1:0fe432e5dfc4 184 }
bbw 1:0fe432e5dfc4 185
bbw 1:0fe432e5dfc4 186 void WriteOneDot(unsigned int color)
bbw 1:0fe432e5dfc4 187 {
bbw 1:0fe432e5dfc4 188 ST7789V_writeOneDot(color);
bbw 1:0fe432e5dfc4 189 }
bbw 1:0fe432e5dfc4 190
bbw 1:0fe432e5dfc4 191 void DispOneChar(unsigned char ord,unsigned int Xstart,unsigned int Ystart,unsigned int TextColor,unsigned int BackColor) // ord:0~95
bbw 1:0fe432e5dfc4 192 {
bbw 1:0fe432e5dfc4 193 unsigned char i,j;
bbw 1:0fe432e5dfc4 194 unsigned char *p;
bbw 1:0fe432e5dfc4 195 unsigned char dat;
bbw 1:0fe432e5dfc4 196 unsigned int index;
bbw 1:0fe432e5dfc4 197
bbw 1:0fe432e5dfc4 198 BlockWrite(Xstart,Xstart+(FONT_W-1),Ystart,Ystart+(FONT_H-1));
bbw 1:0fe432e5dfc4 199
bbw 1:0fe432e5dfc4 200 index = ord;
bbw 1:0fe432e5dfc4 201
bbw 1:0fe432e5dfc4 202 if(index>95) //95:ASCII CHAR NUM
bbw 1:0fe432e5dfc4 203 index=95;
bbw 1:0fe432e5dfc4 204
bbw 1:0fe432e5dfc4 205 index = index*((FONT_W/8)*FONT_H);
bbw 1:0fe432e5dfc4 206
bbw 1:0fe432e5dfc4 207 p = ascii;
bbw 1:0fe432e5dfc4 208 p = p+index;
bbw 1:0fe432e5dfc4 209
bbw 1:0fe432e5dfc4 210 for(i=0;i<(FONT_W/8*FONT_H);i++)
bbw 1:0fe432e5dfc4 211 {
bbw 1:0fe432e5dfc4 212 dat=*p++;
bbw 1:0fe432e5dfc4 213 for(j=0;j<8;j++)
bbw 1:0fe432e5dfc4 214 {
bbw 1:0fe432e5dfc4 215 if((dat<<j)&0x80)
bbw 1:0fe432e5dfc4 216 {
bbw 1:0fe432e5dfc4 217 WriteOneDot(TextColor);
bbw 1:0fe432e5dfc4 218 }
bbw 1:0fe432e5dfc4 219 else
bbw 1:0fe432e5dfc4 220 {
bbw 1:0fe432e5dfc4 221 WriteOneDot(BackColor);
bbw 1:0fe432e5dfc4 222 }
bbw 1:0fe432e5dfc4 223 }
bbw 1:0fe432e5dfc4 224 }
bbw 1:0fe432e5dfc4 225 }
bbw 1:0fe432e5dfc4 226
bbw 1:0fe432e5dfc4 227 void DispStr(unsigned char *str,unsigned int Xstart,unsigned int Ystart,unsigned int TextColor,unsigned int BackColor)
bbw 1:0fe432e5dfc4 228 {
bbw 1:0fe432e5dfc4 229
bbw 1:0fe432e5dfc4 230 while(!(*str=='\0'))
bbw 1:0fe432e5dfc4 231 {
bbw 1:0fe432e5dfc4 232 DispOneChar(ToOrd(*str++),Xstart,Ystart,TextColor,BackColor);
bbw 1:0fe432e5dfc4 233
bbw 1:0fe432e5dfc4 234 if(Xstart>((COL-1)-FONT_W))
bbw 1:0fe432e5dfc4 235 {
bbw 1:0fe432e5dfc4 236 Xstart=0;
bbw 1:0fe432e5dfc4 237 Ystart=Ystart+FONT_H;
bbw 1:0fe432e5dfc4 238 }
bbw 1:0fe432e5dfc4 239 else
bbw 1:0fe432e5dfc4 240 {
bbw 1:0fe432e5dfc4 241 Xstart=Xstart+FONT_W;
bbw 1:0fe432e5dfc4 242 }
bbw 1:0fe432e5dfc4 243
bbw 1:0fe432e5dfc4 244 if(Ystart>((ROW-1)-FONT_H))
bbw 1:0fe432e5dfc4 245 {
bbw 1:0fe432e5dfc4 246 Ystart=0;
bbw 1:0fe432e5dfc4 247 }
bbw 1:0fe432e5dfc4 248 }
bbw 1:0fe432e5dfc4 249 BlockWrite(0,COL-1,0,ROW-1);
bbw 1:0fe432e5dfc4 250 }
bbw 1:0fe432e5dfc4 251
bbw 1:0fe432e5dfc4 252 void DispInt(unsigned int i,unsigned int Xstart,unsigned int Ystart,unsigned int TextColor,unsigned int BackColor)
bbw 1:0fe432e5dfc4 253 {
bbw 1:0fe432e5dfc4 254 if(Xstart>((COL-1)-FONT_W*4))
bbw 1:0fe432e5dfc4 255 {
bbw 1:0fe432e5dfc4 256 Xstart=(COL-1)-FONT_W*4;
bbw 1:0fe432e5dfc4 257 }
bbw 1:0fe432e5dfc4 258 if(Ystart>((ROW-1)-FONT_H))
bbw 1:0fe432e5dfc4 259 {
bbw 1:0fe432e5dfc4 260 Ystart=(Ystart-1)-FONT_H;
bbw 1:0fe432e5dfc4 261 }
bbw 1:0fe432e5dfc4 262
bbw 1:0fe432e5dfc4 263 DispOneChar((i>>12)%16,Xstart,Ystart,TextColor,BackColor); //ID value
bbw 1:0fe432e5dfc4 264 DispOneChar((i>>8)%16,Xstart+FONT_W,Ystart,TextColor,BackColor);
bbw 1:0fe432e5dfc4 265 DispOneChar((i>>4)%16,Xstart+FONT_W*2,Ystart,TextColor,BackColor);
bbw 1:0fe432e5dfc4 266 DispOneChar(i%16,Xstart+FONT_W*3,Ystart,TextColor,BackColor);
bbw 1:0fe432e5dfc4 267
bbw 1:0fe432e5dfc4 268 BlockWrite(0,COL-1,0,ROW-1);
bbw 1:0fe432e5dfc4 269 }
bbw 1:0fe432e5dfc4 270
bbw 1:0fe432e5dfc4 271 void DispColor(unsigned int color)
bbw 1:0fe432e5dfc4 272 {
bbw 1:0fe432e5dfc4 273 unsigned int i,j;
bbw 1:0fe432e5dfc4 274
bbw 1:0fe432e5dfc4 275 BlockWrite(0,COL-1,0,ROW-1);
bbw 1:0fe432e5dfc4 276
bbw 1:0fe432e5dfc4 277 TFTCS=0;
bbw 1:0fe432e5dfc4 278 TFTDC=1;
bbw 1:0fe432e5dfc4 279 TFTRD=1;
bbw 1:0fe432e5dfc4 280
bbw 1:0fe432e5dfc4 281 for(i=0;i<ROW;i++)
bbw 1:0fe432e5dfc4 282 {
bbw 1:0fe432e5dfc4 283 for(j=0;j<COL;j++)
bbw 1:0fe432e5dfc4 284 {
bbw 1:0fe432e5dfc4 285 WriteOneDot(color);
bbw 1:0fe432e5dfc4 286 }
bbw 1:0fe432e5dfc4 287 }
bbw 1:0fe432e5dfc4 288
bbw 1:0fe432e5dfc4 289 TFTCS=1;
bbw 1:0fe432e5dfc4 290 }
bbw 1:0fe432e5dfc4 291
bbw 1:0fe432e5dfc4 292 void DispBand(void)
bbw 1:0fe432e5dfc4 293 {
bbw 1:0fe432e5dfc4 294 unsigned int i,j,k;
bbw 1:0fe432e5dfc4 295 //unsigned int color[8]={0x001f,0x07e0,0xf800,0x07ff,0xf81f,0xffe0,0x0000,0xffff};
bbw 1:0fe432e5dfc4 296 unsigned int color[8]={0xf800,0xf800,0x07e0,0x07e0,0x001f,0x001f,0xffff,0xffff};//0x94B2
bbw 1:0fe432e5dfc4 297 //unsigned int gray16[]={0x0000,0x1082,0x2104,0x3186,0x42,0x08,0x528a,0x630c,0x738e,0x7bcf,0x9492,0xa514,0xb596,0xc618,0xd69a,0xe71c,0xffff};
bbw 1:0fe432e5dfc4 298
bbw 1:0fe432e5dfc4 299 BlockWrite(0,COL-1,0,ROW-1);
bbw 1:0fe432e5dfc4 300
bbw 1:0fe432e5dfc4 301 TFTCS=0;
bbw 1:0fe432e5dfc4 302 TFTRD=1;
bbw 1:0fe432e5dfc4 303 TFTDC=1;
bbw 1:0fe432e5dfc4 304
bbw 1:0fe432e5dfc4 305 for(i=0;i<8;i++)
bbw 1:0fe432e5dfc4 306 {
bbw 1:0fe432e5dfc4 307 for(j=0;j<ROW/8;j++)
bbw 1:0fe432e5dfc4 308 {
bbw 1:0fe432e5dfc4 309 for(k=0;k<COL;k++)
bbw 1:0fe432e5dfc4 310 {
bbw 1:0fe432e5dfc4 311 WriteOneDot(color[i]);
bbw 1:0fe432e5dfc4 312 }
bbw 1:0fe432e5dfc4 313 }
bbw 1:0fe432e5dfc4 314 }
bbw 1:0fe432e5dfc4 315 for(j=0;j<ROW%8;j++)
bbw 1:0fe432e5dfc4 316 {
bbw 1:0fe432e5dfc4 317 for(k=0;k<COL;k++)
bbw 1:0fe432e5dfc4 318 {
bbw 1:0fe432e5dfc4 319 WriteOneDot(color[7]);
bbw 1:0fe432e5dfc4 320 }
bbw 1:0fe432e5dfc4 321 }
bbw 1:0fe432e5dfc4 322
bbw 1:0fe432e5dfc4 323 TFTCS=1;
bbw 1:0fe432e5dfc4 324 }
bbw 1:0fe432e5dfc4 325
bbw 1:0fe432e5dfc4 326 void DispPic(unsigned int *picture)
bbw 1:0fe432e5dfc4 327 {
bbw 1:0fe432e5dfc4 328 unsigned int *p;
bbw 1:0fe432e5dfc4 329 unsigned int i,j; //i-row,j-col
bbw 1:0fe432e5dfc4 330 unsigned char n,k; //n-row repeat count,k-col repeat count
bbw 1:0fe432e5dfc4 331
bbw 1:0fe432e5dfc4 332 BlockWrite(0,COL-1,0,ROW-1);
bbw 1:0fe432e5dfc4 333
bbw 1:0fe432e5dfc4 334 TFTCS =0;
bbw 1:0fe432e5dfc4 335 TFTDC =1;
bbw 1:0fe432e5dfc4 336 TFTRD =1;
bbw 1:0fe432e5dfc4 337
bbw 1:0fe432e5dfc4 338 for(n=0;n<ROW/PIC_HEIGHT;n++) //n-row repeat count
bbw 1:0fe432e5dfc4 339 {
bbw 1:0fe432e5dfc4 340 for(i=0;i<PIC_HEIGHT;i++)
bbw 1:0fe432e5dfc4 341 {
bbw 1:0fe432e5dfc4 342 p=picture;
bbw 1:0fe432e5dfc4 343 for(k=0;k<COL/PIC_WIDTH;k++) //k-col repeat count
bbw 1:0fe432e5dfc4 344 {
bbw 1:0fe432e5dfc4 345 for(j=0;j<PIC_WIDTH;j++)
bbw 1:0fe432e5dfc4 346 {
bbw 1:0fe432e5dfc4 347 WriteOneDot(*(p+i*PIC_HEIGHT+j));
bbw 1:0fe432e5dfc4 348 }
bbw 1:0fe432e5dfc4 349 }
bbw 1:0fe432e5dfc4 350
bbw 1:0fe432e5dfc4 351 p=picture;
bbw 1:0fe432e5dfc4 352 for(j=0;j<COL%PIC_WIDTH;j++)
bbw 1:0fe432e5dfc4 353 {
bbw 1:0fe432e5dfc4 354 WriteOneDot(*(p+i*PIC_HEIGHT+j));
bbw 1:0fe432e5dfc4 355 }
bbw 1:0fe432e5dfc4 356 }
bbw 1:0fe432e5dfc4 357 }
bbw 1:0fe432e5dfc4 358
bbw 1:0fe432e5dfc4 359 for(i=0;i<ROW%PIC_HEIGHT;i++)
bbw 1:0fe432e5dfc4 360 {
bbw 1:0fe432e5dfc4 361 p=picture;
bbw 1:0fe432e5dfc4 362 for(k=0;k<COL/PIC_WIDTH;k++) //k-col repeat count
bbw 1:0fe432e5dfc4 363 {
bbw 1:0fe432e5dfc4 364 for(j=0;j<PIC_WIDTH;j++)
bbw 1:0fe432e5dfc4 365 {
bbw 1:0fe432e5dfc4 366 WriteOneDot(*(p+i*PIC_HEIGHT+j));
bbw 1:0fe432e5dfc4 367 }
bbw 1:0fe432e5dfc4 368 }
bbw 1:0fe432e5dfc4 369
bbw 1:0fe432e5dfc4 370 p=picture;
bbw 1:0fe432e5dfc4 371 for(j=0;j<COL%PIC_WIDTH;j++)
bbw 1:0fe432e5dfc4 372 {
bbw 1:0fe432e5dfc4 373 WriteOneDot(*(p+i*PIC_HEIGHT+j));
bbw 1:0fe432e5dfc4 374 }
bbw 1:0fe432e5dfc4 375 }
bbw 1:0fe432e5dfc4 376 TFTCS=1;
bbw 1:0fe432e5dfc4 377 }
bbw 1:0fe432e5dfc4 378
bbw 1:0fe432e5dfc4 379 void LCD_block_test(){
bbw 1:0fe432e5dfc4 380 BlockWrite(0,COL-1,0,ROW-1);
bbw 1:0fe432e5dfc4 381 DispColor(GREEN);
bbw 1:0fe432e5dfc4 382 wait(2);
bbw 1:0fe432e5dfc4 383 DispColor(BLUE);
bbw 1:0fe432e5dfc4 384 wait(2);
bbw 1:0fe432e5dfc4 385 DispColor(RED);
bbw 1:0fe432e5dfc4 386 wait(2);
bbw 1:0fe432e5dfc4 387 }
bbw 1:0fe432e5dfc4 388
bbw 1:0fe432e5dfc4 389
bbw 1:0fe432e5dfc4 390