modify
Dependents: ThingPlug_Ethernet_Example_temp_V2
Fork of Adafruit_ST7735 by
Revision 7:5ca1a1692044, committed 2015-08-15
- Comitter:
- irinakim
- Date:
- Sat Aug 15 23:30:09 2015 +0000
- Parent:
- 6:7d45da201480
- Commit message:
- hhhh
Changed in this revision
Adafruit_ST7735.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 7d45da201480 -r 5ca1a1692044 Adafruit_ST7735.cpp --- a/Adafruit_ST7735.cpp Thu Jul 30 22:55:47 2015 +0000 +++ b/Adafruit_ST7735.cpp Sat Aug 15 23:30:09 2015 +0000 @@ -25,7 +25,7 @@ : lcdPort(mosi, miso, sck), _cs(cs), _rs(rs), _rst(rst), Adafruit_GFX(ST7735_TFTWIDTH, ST7735_TFTHEIGHT) { } -Serial pc(USBTX, USBRX); + void Adafruit_ST7735::writecommand(uint8_t c) { @@ -460,7 +460,7 @@ #define OffsetFileSize 34 #define OffsetPixData 10 #define OffsetBPP 28 - pc.printf("TEST START\r\n"); + printf("TEST START\r\n"); char filename[50]; unsigned char BMP_Header[54]; unsigned short BPP_t; @@ -469,34 +469,34 @@ int padd,j; unsigned short *line; - pc.printf("TEST START1\r\n"); + printf("TEST START1\r\n"); // get the filename i=0; while (*Name_BMP!='\0') { filename[i++]=*Name_BMP++; } - pc.printf("TEST START2\r\n"); + printf("TEST START2\r\n"); filename[i] = 0; - pc.printf("TEST START3\r\n"); + printf("TEST START3\r\n"); FILE *Image = fopen((const char *)&filename[0], "rb"); // open the bmp file - pc.printf("TEST FILEOPEN\r\n"); + printf("TEST FILEOPEN\r\n"); if (!Image) { - pc.printf("TEST error file not found"); + printf("TEST error file not found"); return(0); // error file not found ! } fread(&BMP_Header[0],1,54,Image); // get the BMP Header if (BMP_Header[0] != 0x42 || BMP_Header[1] != 0x4D) { // check magic byte - pc.printf("TEST error no BMP file"); + printf("TEST error no BMP file"); fclose(Image); return(-1); // error no BMP file } BPP_t = BMP_Header[OffsetBPP] + (BMP_Header[OffsetBPP + 1] << 8); if (BPP_t != 0x0010) { - pc.printf("TEST error no 16 bit BMP\r\n"); + printf("TEST error no 16 bit BMP\r\n"); fclose(Image); return(-2); // error no 16 bit BMP } @@ -504,7 +504,7 @@ PixelHeigh = BMP_Header[OffsetPixelHeigh] + (BMP_Header[OffsetPixelHeigh + 1] << 8) + (BMP_Header[OffsetPixelHeigh + 2] << 16) + (BMP_Header[OffsetPixelHeigh + 3] << 24); PixelWidth = BMP_Header[OffsetPixelWidth] + (BMP_Header[OffsetPixelWidth + 1] << 8) + (BMP_Header[OffsetPixelWidth + 2] << 16) + (BMP_Header[OffsetPixelWidth + 3] << 24); if (PixelHeigh > _height + y || PixelWidth > _width + x) { - pc.printf("TEST to big\r\n"); + printf("TEST to big\r\n"); fclose(Image); return(-3); // to big } @@ -513,20 +513,20 @@ line = (unsigned short *) malloc (2 * PixelHeigh); // we need a buffer for a line if (line == NULL) { - pc.printf("TEST error no memory\r\n"); + printf("TEST error no memory\r\n"); return(-4); // error no memory } - pc.printf("TEST 506"); + printf("TEST 506"); // the bmp lines are padded to multiple of 4 bytes padd = -1; - do {pc.printf("TEST padd : %d\r\n",padd); + do {printf("TEST padd : %d\r\n",padd); padd ++; } while ((PixelHeigh * 2 + padd)%4 != 0); setAddrWindow(x, y,PixelWidth ,PixelHeigh); writecommand(0x2C); // send pixel - pc.printf("TEST 518"); + printf("TEST 518"); for (j = PixelWidth - 1; j >= 0; j--) { //Lines bottom up off = j * (PixelHeigh * 2 + padd) + start_data; // start of line fseek(Image, off ,SEEK_SET); @@ -542,7 +542,7 @@ free (line); fclose(Image); setAddrWindow(0,0,_width,_height); - pc.printf("TEST END"); + printf("TEST END"); return(1); } @@ -565,18 +565,18 @@ char filename[50]; - pc.printf("TEST START1\r\n"); + printf("TEST START1\r\n"); // get the filename i=0; while (*Name_BMP!='\0') { filename[i++]=*Name_BMP++; } - pc.printf("TEST START2\r\n"); + printf("TEST START2\r\n"); filename[i] = 0; - pc.printf("TEST START3\r\n"); + printf("TEST START3\r\n"); FILE *Image = fopen((const char *)&filename[0], "rb"); // open the bmp file - pc.printf("TEST FILEOPEN\r\n"); + printf("TEST FILEOPEN\r\n"); if(Image == NULL) return -1; if(fgetc(Image) != 0x42) return -2; @@ -587,7 +587,7 @@ imgsize += (((uint32_t)fgetc(Image)) << i*8); } #ifdef TFT_DEBUG - pc.printf("BMP SIZE:%d\r\n",imgsize); + printf("BMP SIZE:%d\r\n",imgsize); #endif fseek(Image,4,SEEK_CUR); for(i = 0; i < 4; i++) @@ -595,7 +595,7 @@ offset += (((uint32_t)fgetc(Image)) << i*8); } #ifdef TFT_DEBUG - pc.printf("BMP OFFSET:%d\r\n",offset); + printf("BMP OFFSET:%d\r\n",offset); #endif fseek(Image,4,SEEK_CUR); for(i = 0; i < 4; i++) @@ -617,14 +617,14 @@ if((compress=fgetc(Image)) != 0) { #ifdef TFT_DEBUG - pc.printf("Not supported compress : %d\r\n",compress); + printf("Not supported compress : %d\r\n",compress); #endif return -4; } #ifdef TFT_DEBUG - pc.printf("RESOL : %d col, %d X %d",colbits,imgw,imgh); + printf("RESOL : %d col, %d X %d",colbits,imgw,imgh); #endif fseek(Image, offset, SEEK_SET); @@ -653,13 +653,13 @@ #ifdef TFT_DEBUG /* - pc.printf("RGB(%d): ",i); - pc.printf("(%d,",img[3*i+2]); - pc.printf("%d,", img[3*i+1]); - pc.printf("%d),->", img[3*i]); - pc.printf("%04x\r\n",col); + printf("RGB(%d): ",i); + printf("(%d,",img[3*i+2]); + printf("%d,", img[3*i+1]); + printf("%d),->", img[3*i]); + printf("%04x\r\n",col); */ - //pc.printf("RGB(%d): (%d,%d,%d) -> %04X\r\n ",i,img[3*i+2],img[3*i+1],img[3*i],col); + //printf("RGB(%d): (%d,%d,%d) -> %04X\r\n ",i,img[3*i+2],img[3*i+1],img[3*i],col); #endif _rs = 1; _cs = 0;