├── .gitattributes ├── .gitignore ├── README.txt ├── examples ├── Birduino │ ├── Birduino.ino │ ├── bird01.c_ │ ├── bird01.jpg │ ├── bird05.h │ ├── bottom_deco.h │ ├── flappy_title.h │ ├── pillar01.h │ ├── pillar_end.h │ └── pillar_end.h_ ├── FolderBrowser │ └── FolderBrowser.ino ├── bitmaps │ ├── miniwoof.bmp │ ├── test.bmp │ └── woof.bmp ├── graphicstest │ └── graphicstest.ino ├── graphicstest_pio │ ├── .cproject │ ├── .gitignore │ ├── .project │ ├── .settings │ │ ├── language.settings.xml │ │ └── org.eclipse.cdt.core.prefs │ ├── .travis.yml │ ├── graphicstest.ino │ ├── lib │ │ └── readme.txt │ ├── platformio.ini │ └── src │ │ └── graphicstest.cpp ├── rotationtest │ └── rotationtest.ino ├── tftbmp │ └── tftbmp.ino └── tftpaint │ ├── tftpaint.in_ │ └── tftpaint.ino ├── library.properties └── src ├── Adafruit_TFTLCD_16bit_STM32.cpp ├── Adafruit_TFTLCD_16bit_STM32.h ├── Adafruit_common.h ├── hx8347g.cpp ├── hx8347g.h ├── hx8357x.cpp ├── hx8357x.h ├── ili932x.cpp ├── ili932x.h ├── ili9341.cpp └── ili9341.h /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear in the root of a volume 35 | .DocumentRevisions-V100 36 | .fseventsd 37 | .Spotlight-V100 38 | .TemporaryItems 39 | .Trashes 40 | .VolumeIcon.icns 41 | 42 | # Directories potentially created on remote AFP share 43 | .AppleDB 44 | .AppleDesktop 45 | Network Trash Folder 46 | Temporary Items 47 | .apdisk 48 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | This is a library for 16bit parallel driven TFT displays, ported from the Adafruit library. https://github.com/adafruit/TFTLCD-Library 2 | 3 | - Place this library folder your /libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE. 4 | 5 | - Also requires the Adafruit_GFX library for Arduino. https://github.com/adafruit/Adafruit-GFX-Library 6 | -------------------------------------------------------------------------------- /examples/Birduino/Birduino.ino: -------------------------------------------------------------------------------- 1 | /* Arduino Game Proejct 2 | * Program made by Dejan Nedelkovski, 3 | * www.HowToMechatronics.com 4 | */ 5 | 6 | /* This program uses the UTFT and UTouch libraries 7 | * made by Henning Karlsen. 8 | * You can find and download them at: 9 | * www.RinkyDinkElectronics.com 10 | */ 11 | /* 12 | #include 13 | #include 14 | #include 15 | */ 16 | 17 | #include // Core graphics library 18 | #include // Hardware-specific library 19 | #include 20 | 21 | #include "flappy_title.h" // the latest version 22 | #include "bird05.h" // the latest version 23 | #include "pillar01.h" // first version 24 | #include "pillar_end.h" 25 | #include "bottom_deco.h" 26 | 27 | #define BIRD_BG 0x7639 // first value from the bird header file 28 | // Assign human-readable names to some common 16-bit color values: 29 | 30 | #define LED_PIN PC13 31 | 32 | // overlaping: 33 | #define XM TFT_RS // 330 Ohm // must be an analog pin !!! 34 | #define YP TFT_CS // 500 Ohm // must be an analog pin !!! 35 | #define XP PB0 //TFT_D0 // 330 Ohm // can be a digital pin 36 | #define YM PB1 //TFT_D1 // 500 Ohm // can be a digital pin 37 | 38 | TouchScreen ts = TouchScreen(XP, YP, XM, YM); 39 | TSPoint p; // a point object holds x, y and z coordinates 40 | int x, y; // Variables for the coordinates where the display has been pressed 41 | 42 | //==== Creating Objects 43 | Adafruit_TFTLCD_8bit_STM32 myGLCD; 44 | 45 | //==== Defining Fonts 46 | extern uint8_t SmallFont[]; 47 | extern uint8_t BigFont[]; 48 | extern uint8_t SevenSegNumFont[]; 49 | 50 | #define TEXT_POSITION_LEFT 50 51 | #define TEXT_POSITION_CENTER 110 52 | #define BOTTOM_AREA_Y 205 53 | #define BOTTOM_AREA_BG_COLOR 0x// 221,216,150 54 | #define BOTTOM_LINE_1_COLOR 55 | // Floppy Bird 56 | #define PILLAR_GAP 60 // pixels 57 | #define BIRD_X PILLAR_BMP_X // from the pillar header file 58 | #define MOV_RATE_X0 3 // starting moving rate 59 | #define FALL_RATE_Y 3 // starting falling rate 60 | 61 | static int xP, yP = 100, yB; 62 | static int movingRate, fallRateInt, steps; 63 | static uint32_t fallRate; 64 | static int score, level; 65 | static int lastSpeedUpScore, highscore; 66 | //static int screenPressed; 67 | static boolean screenPressed, gameStarted, paused; 68 | static uint32_t crt_millis, prev_millis; 69 | 70 | static char s[250]; // for sprintf 71 | static void drawTitle(void); 72 | /*****************************************************************************/ 73 | void setup() 74 | { 75 | /* 76 | // Initiate display 77 | myGLCD.InitLCD(); 78 | myGLCD.clrScr(); 79 | myTouch.InitTouch(); 80 | myTouch.setPrecision(PREC_MEDIUM); 81 | */ 82 | Serial.begin(115200); 83 | 84 | //delay(6000); // allow time for OS to enumerate USB as COM port 85 | 86 | Serial.print("\n*** Paint demo with easy touch calibration process ***\n"); 87 | 88 | myGLCD.begin(0x9328); 89 | 90 | /**/ 91 | // Touch screen range setting 92 | // set display X and Y range of the display screen 93 | // the returned coordinates will be automatically mapped to these values. 94 | // If this is not used, the default values form the header file are used. 95 | ts.rangeSet(TFTWIDTH, TFTHEIGHT); 96 | /* 97 | // Calibration 98 | // needs sequentially touching two, diagonally opposite corners (check serial output!) 99 | // the touching can include small circular movements around the corners 100 | // it will keep calibrating the corner as long as pressure is applied 101 | myGLCD.setRotation(0); 102 | myGLCD.fillScreen(WHITE); 103 | myGLCD.setCursor(0, 30); 104 | myGLCD.setTextColor(BLACK); 105 | myGLCD.setTextSize(2); 106 | myGLCD.println("Calibration\n"); 107 | myGLCD.println("Press top corner...\n"); 108 | Serial.println("Calibrating the touch surface"); 109 | Serial.print("> please press one corner..."); 110 | //myGLCD.fillRect(20, 0, 239, 19, GREEN); 111 | myGLCD.fillRect(TFTWIDTH-10, 0, 10, 10, GREEN); 112 | ts.calibratePoint(); 113 | myGLCD.fillRect(TFTWIDTH-10, 0, 10, 10, BLUE); 114 | delay(1000); 115 | myGLCD.println("Now press the bottom corner..."); 116 | Serial.print("ok.\n> and now press the diagonally opposite corner..."); 117 | myGLCD.fillRect(0, TFTHEIGHT-10, 10, 10, GREEN); 118 | ts.calibratePoint(); 119 | //myGLCD.setTextSize(2); 120 | myGLCD.setCursor(0, 200); 121 | myGLCD.println("Calibration done."); 122 | Serial.println("ok.\nCalibration done."); 123 | myGLCD.fillRect(0, TFTHEIGHT-10, 10, 10, BLUE); 124 | 125 | delay(1000); 126 | */ 127 | uint32_t crt_millis = millis(); 128 | uint32_t prev_millis = crt_millis; 129 | highscore = 0; //EEPROM.read(0); // Read the highest score from the EEPROM 130 | 131 | myGLCD.setRotation(1); 132 | myGLCD.fillScreen(BIRD_BG); 133 | drawTitle(); 134 | 135 | initiateGame(); // Initiate the game 136 | } 137 | void drawScore(void); 138 | /*****************************************************************************/ 139 | static int tick; 140 | /*****************************************************************************/ 141 | void loop() 142 | { 143 | //==== Controlling the bird 144 | if ( ts.getPoint(&p) && !screenPressed ) { 145 | // adapt coordinates to rotation(1) 146 | x = p.y; 147 | y = TFTWIDTH - p.x; 148 | //myGLCD.fillCircle(x, y, 3, BLACK); // test only, remove it 149 | if ( y>BOTTOM_AREA_Y ) { // pause the game 150 | while ( ts.getPoint(&p) ); // wait to release touch 151 | while ( !ts.getPoint(&p) ); // wait for next touch 152 | } else { 153 | tick = 0; 154 | fallRate = 0; // Setting the fallRate negative will make the bird jump 155 | fallRateInt = -10; // Setting the fallRate negative will make the bird jump 156 | screenPressed = true; 157 | } 158 | } 159 | 160 | // only do the rest when the time has come... 161 | crt_millis = millis(); 162 | #define TIME_UNIT 50 // game ticker, in millis 163 | if ( (crt_millis-prev_millis)0 ) { 168 | fallRate = tick*tick; // Setting the fallRate negative will make the bird jump 169 | fallRateInt = int(fallRate/15); 170 | } 171 | 172 | drawPilars(xP, yP); // Draws the pillars 173 | 174 | // yB - y coordinate of the bird which depends on value of the fallingRate variable 175 | yB+=fallRateInt; 176 | // clip bird coordinates 177 | if ( yB>(BOTTOM_AREA_Y-BIRD_BMP_Y) ) yB=(BOTTOM_AREA_Y-BIRD_BMP_Y); 178 | if ( yB<0 ) yB=0; 179 | 180 | // Draws the bird 181 | drawBird(yB); 182 | 183 | // Checks for collision 184 | // top and bottom 185 | //if ( yB>(BOTTOM_AREA_Y-BIRD_BMP_Y) || yB<0 ) gameOver(); 186 | // upper or lower pillar 187 | if ( xP<(BIRD_X+BIRD_BMP_X-5) && xP>(BIRD_X-PILLAR_BMP_X+5) && ( yB<(yP) || yB>(yP+PILLAR_GAP-BIRD_BMP_Y) ) ) gameOver(); 188 | 189 | 190 | // After the pillar has passed through the screen 191 | if (xP<=-PILLAR_END_BMP_X){ 192 | xP += TFTHEIGHT+PILLAR_END_BMP_X; // Restart xP 193 | yP = map(rand() % 100, 0, 100, PILLAR_END_BMP_Y, (BOTTOM_AREA_Y-PILLAR_END_BMP_Y-PILLAR_GAP)); // Random number for the pillars height 194 | score++; // Increase score by one 195 | } 196 | xP -= movingRate; // xP - x coordinate of the pillars; range: 319 - (-51) 197 | // After each five points, increases the moving rate of the pillars 198 | if ((score - lastSpeedUpScore) == 5) { 199 | lastSpeedUpScore = score; 200 | level ++; 201 | movingRate++; 202 | } 203 | drawScore(); 204 | // Doesn't allow holding the screen / you must tap it 205 | if ( !ts.getPoint(&p) && screenPressed ) screenPressed = false; 206 | } 207 | void drawTitle(void); 208 | /*****************************************************************************/ 209 | void initiateGame(void) 210 | { 211 | while ( ts.getPoint(&p) ); // wait to release touch 212 | myGLCD.fillScreen(BIRD_BG); 213 | // Ground 214 | drawGround(); 215 | // Text 216 | myGLCD.setTextColor(BLACK, color565(221, 216, 148)); 217 | myGLCD.setTextSize(2); 218 | myGLCD.setCursor(5,220); 219 | myGLCD.print("Score:"); 220 | //myGLCD.setTextSize(1);//SmallFont); 221 | myGLCD.setCursor(170,220); 222 | myGLCD.print("Level:");//, 140, 220); 223 | //myGLCD.setColor(0, 0, 0); 224 | //myGLCD.setBackColor(114, 198, 206); 225 | myGLCD.setTextColor(BLACK, BIRD_BG); 226 | myGLCD.setCursor(5,5); 227 | myGLCD.print("Highscore:");//,5,5); 228 | myGLCD.setCursor(130,5); 229 | myGLCD.print(highscore);//, 120, 6); 230 | // myGLCD.setCursor(255,5); 231 | // myGLCD.print("| RESET |");//,255,5); 232 | 233 | // Resets the variables to start position values 234 | xP = TFTHEIGHT; 235 | yB = 50; 236 | fallRate = 0; 237 | fallRateInt = 0; 238 | score = 0; 239 | level = 0; 240 | lastSpeedUpScore = 0; 241 | movingRate = MOV_RATE_X0; 242 | //screenPressed = -1; 243 | screenPressed = false; 244 | gameStarted = false; 245 | paused = false; 246 | steps = 0; 247 | tick = 0; 248 | 249 | drawBird(yB); // Draws the bird 250 | drawScore(); 251 | // write tap to start 252 | myGLCD.drawFastHLine(0,23,TFTHEIGHT, BLACK); 253 | myGLCD.setTextSize(1); 254 | myGLCD.setTextColor(BLACK, BIRD_BG); 255 | while (!gameStarted) { 256 | uint32_t tim = millis(); 257 | myGLCD.setCursor(TEXT_POSITION_CENTER,100); 258 | myGLCD.print("TAP TO START");//,CENTER,100); 259 | while ( (millis()-tim)<500 ) { 260 | if ( ts.getPoint(&p) ) { gameStarted = true; break; } 261 | } 262 | myGLCD.fillRect(TEXT_POSITION_CENTER, 100, 100, 10, BIRD_BG); // clear text 263 | tim = millis(); 264 | while ( (millis()-tim)<500 ) { 265 | if ( ts.getPoint(&p) ) { gameStarted = true; break; } 266 | } 267 | } 268 | myGLCD.fillRect(TEXT_POSITION_CENTER, 100, 100, 10, BIRD_BG); // clear text 269 | myGLCD.fillRect(0, 0, TFTHEIGHT, 32, BIRD_BG); // delete top status row, leave room for the game 270 | delay(100); // wait touch end 271 | } 272 | /*****************************************************************************/ 273 | void drawTitle(void) 274 | { 275 | myGLCD.drawBitmap((TFTHEIGHT-FLAPPY_TITLE_X)/2, (TFTWIDTH-FLAPPY_TITLE_Y)/3, FLAPPY_TITLE_X, FLAPPY_TITLE_Y, flappy_title); 276 | // write info 277 | myGLCD.setTextColor(BLACK);//, color565(221, 216, 148)); 278 | myGLCD.setTextSize(2); 279 | myGLCD.setCursor(20,150); 280 | myGLCD.print("STM32F103C8T6 & ILI9328"); 281 | while (1) { 282 | uint32_t tim = millis(); 283 | myGLCD.setTextSize(1); 284 | myGLCD.setCursor(100,210); 285 | myGLCD.print("TAP TO CONTINUE"); 286 | //delay(1000); 287 | while ( (millis()-tim)<500 ) { 288 | if ( ts.getPoint(&p) ) goto dT_end; 289 | } 290 | myGLCD.fillRect(100, 210, 100, 10, BIRD_BG); 291 | //delay(1000); 292 | tim = millis(); 293 | while ( (millis()-tim)<500 ) { 294 | if ( ts.getPoint(&p) ) goto dT_end; 295 | } 296 | } 297 | dT_end: 298 | //delay(3000); 299 | myGLCD.fillScreen(BIRD_BG); 300 | } 301 | /*****************************************************************************/ 302 | void drawGroundDeco(void) 303 | { 304 | //int offs = xP<0 ? (-xP)%12 : xP%12; // template repetition length = 12 305 | int offs = (steps+=movingRate)%12; // template repetition length = 12 306 | // draw 6 lines of deco 307 | myGLCD.drawBitmap(0, BOTTOM_AREA_Y+2, TFTHEIGHT, 1, bottom_deco+((offs++)%12)); 308 | myGLCD.drawBitmap(0, BOTTOM_AREA_Y+3, TFTHEIGHT, 1, bottom_deco+((offs++)%12)); 309 | myGLCD.drawBitmap(0, BOTTOM_AREA_Y+4, TFTHEIGHT, 1, bottom_deco+((offs++)%12)); 310 | myGLCD.drawBitmap(0, BOTTOM_AREA_Y+5, TFTHEIGHT, 1, bottom_deco+((offs++)%12)); 311 | myGLCD.drawBitmap(0, BOTTOM_AREA_Y+6, TFTHEIGHT, 1, bottom_deco+((offs++)%12)); 312 | myGLCD.drawBitmap(0, BOTTOM_AREA_Y+7, TFTHEIGHT, 1, bottom_deco+((offs++)%12)); 313 | } 314 | /*****************************************************************************/ 315 | void drawGround(void) 316 | { 317 | //myGLCD.fillRect(0, BOTTOM_AREA_Y, TFTHEIGHT, 10, color565(47,175,68)); 318 | myGLCD.drawFastHLine(0, BOTTOM_AREA_Y, TFTHEIGHT, BLACK); 319 | myGLCD.drawFastHLine(0, BOTTOM_AREA_Y+1, TFTHEIGHT, (int)bottom_deco[0]); // the light green 320 | drawGroundDeco(); 321 | myGLCD.drawFastHLine(0, BOTTOM_AREA_Y+8, TFTHEIGHT, (int)bottom_deco[6]); // the dark green 322 | myGLCD.drawFastHLine(0, BOTTOM_AREA_Y+9, TFTHEIGHT, (int)bottom_deco[0]); 323 | // text area 324 | myGLCD.fillRect(0, BOTTOM_AREA_Y+10, TFTHEIGHT, TFTWIDTH-(BOTTOM_AREA_Y+10), color565(221,216,148)); 325 | } 326 | /*****************************************************************************/ 327 | // ===== drawPlillars - Custom Function 328 | /*****************************************************************************/ 329 | void drawPilars(int x, int y) 330 | { 331 | //x = 250; // test 332 | //sprintf(s, "drawPillars x: %3i, y: %3i\n", x, y); Serial.print(s); 333 | 334 | // clip y coordinates: 335 | if ( y(BOTTOM_AREA_Y-PILLAR_GAP-PILLAR_END_BMP_Y) ) y = (BOTTOM_AREA_Y-PILLAR_GAP-PILLAR_END_BMP_Y); 337 | 338 | // draw pillar body till (y-PILLAR_END_BMP_Y) 339 | for (int i=0; i0) { 382 | myGLCD.fillRect(BIRD_X, y-fallRateInt, BIRD_BMP_X, fallRateInt, BIRD_BG); 383 | } else if (fallRateInt<0) { 384 | //Serial.println("bird up"); 385 | myGLCD.fillRect(BIRD_X, y+BIRD_BMP_Y, BIRD_BMP_X, 0-fallRateInt, BIRD_BG); 386 | } 387 | 388 | } 389 | /*****************************************************************************/ 390 | //======== gameOver() - Custom Function 391 | /*****************************************************************************/ 392 | void gameOver(void) 393 | { 394 | // blink display 395 | for (int i = 0; i<10; i++) { 396 | myGLCD.invertDisplay(i&1); 397 | delay(100); 398 | } 399 | /**/ 400 | Serial.println("*** GAME OVER ***"); 401 | sprintf(s, "xP: %i, yP: %i, yB: %i\n", xP, yP, yB ); Serial.print(s); 402 | 403 | delay(500); // 1 second 404 | myGLCD.setCursor(150,50); 405 | myGLCD.setTextSize(3); 406 | myGLCD.setTextColor(BLACK);//, BIRD_BG); 407 | myGLCD.print("GAME"); 408 | myGLCD.setCursor(180,80); 409 | myGLCD.print("OVER!"); 410 | myGLCD.setTextSize(1); 411 | myGLCD.setTextColor(BLACK);//, BIRD_BG); 412 | 413 | boolean t = false; 414 | while ( !t ) { 415 | uint32_t tim = millis(); 416 | myGLCD.setCursor(180,150); 417 | myGLCD.print("TAP TO CONTINUE"); 418 | while ( (millis()-tim)<500 && !t ) { //delay(1000); 419 | if ( ts.getPoint(&p) ) t = true; 420 | } 421 | myGLCD.fillRect(150, 150, 150, 10, BIRD_BG); 422 | tim = millis(); 423 | while ( (millis()-tim)<500 && !t ) { //delay(1000); 424 | if ( ts.getPoint(&p) ) t = true; 425 | } 426 | } 427 | delay(100); 428 | while( ts.getPoint(&p) ); // wait for touch release 429 | // Writes the highest score in the EEPROM 430 | if (score > highscore) { 431 | highscore = score; 432 | //EEPROM.write(0,highscore); 433 | } 434 | // Restart game 435 | initiateGame(); 436 | } 437 | -------------------------------------------------------------------------------- /examples/Birduino/bird01.c_: -------------------------------------------------------------------------------- 1 | // Generated by : ImageConverter 565 v2.3 2 | // Generated from: bird01-01.png 3 | // Time generated: 02.12.2015 17:10:58 4 | // Dimensions : 35x30 pixels 5 | // Size : 2.100 Bytes 6 | 7 | //#include 8 | 9 | const unsigned short bird01[0x41A] = { 10 | 0x6E39, 0x6E39, 0x7659, 0x6E39, 0x6E39, 0x6E39, 0x6E39, 0x6E39, 0x6E39, 0x6E39, 0x6E39, 0x6E39, 0x6E39, 0x6E39, 0x6E39, 0x7639, // 0x0010 (16) 11 | 0x6E3A, 0x6E5A, 0x6E3A, 0x7639, 0x6E39, 0x6E39, 0x6E5A, 0x6E5A, 0x6E39, 0x6E39, 0x6E39, 0x6E39, 0x6E39, 0x6E39, 0x6E39, 0x6E39, // 0x0020 (32) 12 | 0x7659, 0x6E5A, 0x6E5A, 0x6E39, 0x6E39, 0x6E5A, 0x6E39, 0x6E39, 0x6E39, 0x6E39, 0x6E39, 0x6E39, 0x6E39, 0x6E39, 0x6E39, 0x6E5A, // 0x0030 (48) 13 | 0x6E5A, 0x6E5A, 0x6E5A, 0x6E3A, 0x6E19, 0x6E3A, 0x6E5A, 0x6E5A, 0x6E5A, 0x6E19, 0x6E39, 0x6E5A, 0x6E5A, 0x6E5A, 0x6E39, 0x6E39, // 0x0040 (64) 14 | 0x6E39, 0x6E39, 0x6E39, 0x6E5A, 0x6E39, 0x763A, 0x6E59, 0x763A, 0x767A, 0x765A, 0x765A, 0x765A, 0x765A, 0x765A, 0x765A, 0x765A, // 0x0050 (80) 15 | 0x765A, 0x767A, 0x765A, 0x6E19, 0x6DF9, 0x6E19, 0x75D7, 0x7D75, 0x7DD7, 0x7618, 0x6DD8, 0x6DF8, 0x7D97, 0x7D97, 0x75F8, 0x6DF8, // 0x0060 (96) 16 | 0x765A, 0x767A, 0x765A, 0x765A, 0x765A, 0x765A, 0x767A, 0x765A, 0x763A, 0x6E39, 0x6E39, 0x765A, 0x7639, 0x7639, 0x7639, 0x7639, // 0x0070 (112) 17 | 0x7639, 0x7639, 0x765A, 0x765A, 0x6DD8, 0x7555, 0x8CCF, 0x8C8C, 0x94AC, 0xAD4B, 0xB58B, 0x9CCB, 0x7BED, 0x7BEF, 0x94B3, 0xB5B7, // 0x0080 (128) 18 | 0xAD76, 0x94D3, 0x8C92, 0x7535, 0x6E39, 0x765A, 0x7639, 0x7639, 0x7639, 0x765A, 0x6E39, 0x763A, 0x6E39, 0x6E39, 0x765A, 0x7639, // 0x0090 (144) 19 | 0x7639, 0x7639, 0x7639, 0x7639, 0x765A, 0x6E3A, 0x6D35, 0x844D, 0xA4EA, 0xE6C8, 0xFF85, 0xF766, 0xFF85, 0xEF27, 0xA4EC, 0xA515, // 0x00A0 (160) 20 | 0xF77E, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xEF5D, 0x9CF4, 0x7515, 0x7639, 0x6E5A, 0x7639, 0x7639, 0x765A, 0x6E39, 0x763A, 0x6E39, // 0x00B0 (176) 21 | 0x6E39, 0x765A, 0x7639, 0x7639, 0x7639, 0x7639, 0x765A, 0x75F9, 0x6C92, 0x948A, 0xE6A8, 0xFF85, 0xF766, 0xF786, 0xF785, 0xFF86, // 0x00C0 (192) 22 | 0xAD2A, 0xB597, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFDF, 0xA514, 0x7535, 0x6E39, 0x765A, 0x7639, 0x765A, // 0x00D0 (208) 23 | 0x6E39, 0x763A, 0x6E39, 0x6E39, 0x765A, 0x7639, 0x7639, 0x7639, 0x765A, 0x75F9, 0x6C31, 0x9CA9, 0xF767, 0xFF85, 0xF766, 0xF766, // 0x00E0 (224) 24 | 0xF766, 0xFFA5, 0xCE29, 0xAD74, 0xEF7E, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xEF5D, 0xF7BE, 0xFFFF, 0xEF5D, 0x8CB3, 0x6DB7, // 0x00F0 (240) 25 | 0x6E5A, 0x7639, 0x765A, 0x6E39, 0x763A, 0x6E39, 0x6E39, 0x765A, 0x7639, 0x7639, 0x6E5A, 0x6E39, 0x7492, 0x9CA8, 0xF767, 0xF786, // 0x0100 (256) 26 | 0xF766, 0xF766, 0xF766, 0xF766, 0xFFA5, 0xB589, 0xB5B8, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xD6BA, 0x7C10, 0xD69A, 0xFFFF, // 0x0110 (272) 27 | 0xFFFF, 0x9CF4, 0x6D97, 0x6E5A, 0x7639, 0x765A, 0x6E39, 0x763A, 0x6E39, 0x6E39, 0x765A, 0x7639, 0x763A, 0x765A, 0x7575, 0x9CCB, // 0x0120 (288) 28 | 0xF766, 0xF786, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xFFA5, 0xBDEA, 0xC61A, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xC639, // 0x0130 (304) 29 | 0x94B3, 0xE71C, 0xFFFF, 0xFFFF, 0xBDD7, 0x7D76, 0x6E39, 0x763A, 0x765A, 0x6E39, 0x763A, 0x6E39, 0x6E39, 0x765A, 0x7639, 0x6E5A, // 0x0140 (320) 30 | 0x6DD8, 0x8CAE, 0xE6C8, 0xFF85, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xFFA5, 0xC5EB, 0xC61A, 0xFFFF, 0xFFFF, 0xFFFF, // 0x0150 (336) 31 | 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xCE59, 0x7D76, 0x6E19, 0x765A, 0x765A, 0x6E39, 0x763A, 0x6E39, 0x6E39, // 0x0160 (352) 32 | 0x765A, 0x765A, 0x765A, 0x7576, 0x9CCA, 0xFF85, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xFFA5, 0xBDA9, 0xBDF9, // 0x0170 (368) 33 | 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xA514, 0x7555, 0x7659, 0x7639, 0x765A, 0x6E39, // 0x0180 (384) 34 | 0x763A, 0x6E39, 0x6E39, 0x765A, 0x6E5A, 0x6DF8, 0x84CF, 0xDE88, 0xF785, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, // 0x0190 (400) 35 | 0xFFA5, 0xBDA8, 0xAD97, 0xFFDF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFDF, 0x9CB2, 0x740F, 0x75F8, // 0x01A0 (416) 36 | 0x6E5A, 0x765A, 0x6E39, 0x763A, 0x6E39, 0x6E39, 0x765A, 0x765A, 0x6DB8, 0x8C6B, 0xFF85, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, // 0x01B0 (432) 37 | 0xF766, 0xF766, 0xF766, 0xFF85, 0xE707, 0xA52F, 0xCE5B, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xBDF8, // 0x01C0 (448) 38 | 0xAD4D, 0x842C, 0x6DB7, 0x765A, 0x765A, 0x6E39, 0x763A, 0x6E7A, 0x6E7A, 0x767A, 0x6E7B, 0x6DD8, 0x94AB, 0xFFA5, 0xFFA5, 0xFFA5, // 0x01D0 (464) 39 | 0xFFA5, 0xFFA5, 0xFFA5, 0xFFA5, 0xFFA5, 0xF765, 0xF766, 0xFFC5, 0xCE26, 0x94B0, 0xCE5B, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0x01E0 (480) 40 | 0xF7BF, 0xC619, 0xA4EE, 0xE6E6, 0x9D0B, 0x6DB8, 0x6E5A, 0x765A, 0x6E39, 0x763A, 0x7DF8, 0x64F4, 0x6D35, 0x6D35, 0x6CD3, 0x7C0B, // 0x01F0 (496) 41 | 0xC5C9, 0xBDC9, 0xBDC9, 0xBDC9, 0xBDC9, 0xC5E9, 0xB588, 0xC608, 0xF767, 0xF766, 0xF766, 0xFFA6, 0xCE26, 0x9CEE, 0xAD77, 0xBDD9, // 0x0200 (512) 42 | 0xC65B, 0xC63B, 0xBDF9, 0xAD75, 0xAD4B, 0xEF27, 0xFFC5, 0x9CEB, 0x6DD8, 0x6E7B, 0x6E7A, 0x6E39, 0x763A, 0x530C, 0x8451, 0xC618, // 0x0210 (528) 43 | 0xC618, 0xC618, 0xBDF7, 0xC618, 0xC618, 0xC618, 0xC618, 0xC618, 0xC618, 0xA556, 0x7BCE, 0xC5E8, 0xFFA5, 0xF766, 0xF766, 0xFFC5, // 0x0220 (544) 44 | 0xE6E7, 0xAD48, 0xB569, 0xBDCB, 0xBDCB, 0xB58A, 0xA4EB, 0xD649, 0xE6C7, 0xDE88, 0x9CAB, 0x7D55, 0x7DB7, 0x7DB7, 0x6E5A, 0x6E5A, // 0x0230 (560) 45 | 0x5AEC, 0xDEFB, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xAD56, 0x9CE9, 0xFFC5, // 0x0240 (576) 46 | 0xF766, 0xF766, 0xF766, 0xFF85, 0xFFC5, 0xFFA5, 0xFFA5, 0xFFC5, 0xCE08, 0xBC69, 0xBC09, 0xBC0A, 0xBC0A, 0xA389, 0xA3CB, 0xABEC, // 0x0250 (592) 47 | 0xA3EC, 0x7CB2, 0x6E39, 0x94B2, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0x0260 (608) 48 | 0xD6BC, 0xB56B, 0xFFA5, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xFF85, 0xDE89, 0x93CA, 0xC287, 0xEAC5, 0xE2C6, 0xE2C6, // 0x0270 (624) 49 | 0xE2E6, 0xEAC5, 0xEAC5, 0xE2C5, 0x82E9, 0x7514, 0x738E, 0xFFDF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0x0280 (640) 50 | 0xFFFF, 0xFFFF, 0xFFFF, 0xBDF9, 0xA50A, 0xFFA5, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF786, 0xEF07, 0xA46A, 0x9AE8, // 0x0290 (656) 51 | 0xAAE7, 0xAAE8, 0xAAE8, 0xAAE8, 0xAAE8, 0xAAE8, 0xA2E8, 0x840F, 0x7D96, 0x52EB, 0x8C51, 0xBDB7, 0xBDD7, 0xBDD7, 0xBDD7, 0xBDF8, // 0x02A0 (672) 52 | 0xB5B8, 0xB5B8, 0xB5B8, 0xB5B8, 0xBDD9, 0x9D16, 0x73AF, 0xBD89, 0xFFA5, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF785, // 0x02B0 (688) 53 | 0xE6C8, 0xA44A, 0xB2E8, 0xCAC6, 0xC2E7, 0xC2E7, 0xC2E7, 0xC2E7, 0xC2E7, 0xBAC7, 0x83AD, 0x7D55, 0x6D35, 0x5CB3, 0x7576, 0x7576, // 0x02C0 (704) 54 | 0x7597, 0x6CF5, 0x842C, 0xD669, 0xCE49, 0xCE29, 0xCE29, 0xCE49, 0xBDC8, 0xC5C6, 0xEF27, 0xF786, 0xF766, 0xF766, 0xF766, 0xF766, // 0x02D0 (720) 55 | 0xF766, 0xF766, 0xF785, 0xE6E8, 0x93EA, 0xBAA7, 0xDAE6, 0xDAE6, 0xDAE6, 0xDAE6, 0xDAE6, 0xDAE6, 0xD2E6, 0x82E9, 0x7555, 0x769B, // 0x02E0 (736) 56 | 0x6E7A, 0x6E7A, 0x6E5A, 0x6E7A, 0x6DF9, 0x84CF, 0xD648, 0xFFC4, 0xFFA5, 0xFFA5, 0xFFA5, 0xFFA5, 0xFFC5, 0xFF85, 0xF766, 0xF766, // 0x02F0 (752) 57 | 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xFF86, 0xD668, 0xBCCA, 0xBC8A, 0xA3EA, 0x9BCC, 0x9C2E, 0x9C4E, 0x9C4E, 0x9C4F, // 0x0300 (768) 58 | 0x7555, 0x6E3A, 0x6E39, 0x6E39, 0x765A, 0x7639, 0x7639, 0x765A, 0x7597, 0x94AD, 0xEF08, 0xFF85, 0xF766, 0xF766, 0xF766, 0xF766, // 0x0310 (784) 59 | 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xFF86, 0xF747, 0xDE89, 0x948C, 0x7555, 0x75F8, // 0x0320 (800) 60 | 0x75F8, 0x75F8, 0x7618, 0x6E5A, 0x765A, 0x6E39, 0x6E39, 0x765A, 0x7639, 0x7639, 0x765A, 0x763A, 0x6CF3, 0x8C4A, 0xEF08, 0xFF85, // 0x0330 (816) 61 | 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xFF85, 0xEF28, 0x9469, // 0x0340 (832) 62 | 0x6CF3, 0x6E5A, 0x6E5A, 0x6E5A, 0x6E5A, 0x6E7A, 0x6E39, 0x763A, 0x6E39, 0x6E39, 0x765A, 0x7639, 0x7639, 0x7639, 0x765A, 0x6E19, // 0x0350 (848) 63 | 0x6493, 0x8C4A, 0xEF08, 0xFF85, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xF766, 0xFF85, // 0x0360 (864) 64 | 0xEF08, 0x944A, 0x6472, 0x6E19, 0x765A, 0x7639, 0x7639, 0x7639, 0x765A, 0x6E39, 0x763A, 0x6E39, 0x6E39, 0x765A, 0x7639, 0x7639, // 0x0370 (880) 65 | 0x7639, 0x7639, 0x765A, 0x6E3A, 0x6D14, 0x8C4C, 0xBDA9, 0xF766, 0xF765, 0xF766, 0xF766, 0xF766, 0xF786, 0xF766, 0xF766, 0xF766, // 0x0380 (896) 66 | 0xF765, 0xF766, 0xBDC9, 0x8C4C, 0x6CF4, 0x6E3A, 0x765A, 0x7639, 0x7639, 0x7639, 0x7639, 0x765A, 0x6E39, 0x763A, 0x6E39, 0x6E39, // 0x0390 (912) 67 | 0x765A, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x765A, 0x6E5A, 0x7597, 0x7C90, 0x842B, 0xBDAA, 0xEF27, 0xF765, 0xF766, 0xF765, // 0x03A0 (928) 68 | 0xF766, 0xF765, 0xEF27, 0xBDAA, 0x842B, 0x7C90, 0x7597, 0x6E5A, 0x765A, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x765A, 0x6E39, // 0x03B0 (944) 69 | 0x763A, 0x6E39, 0x6E39, 0x765A, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x765A, 0x765A, 0x6DF9, 0x6D97, 0x7D34, 0x8CAE, // 0x03C0 (960) 70 | 0x94AC, 0x94AC, 0x842B, 0x94AC, 0x94AC, 0x8CAE, 0x7D33, 0x6D97, 0x6DF9, 0x765A, 0x765A, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, // 0x03D0 (976) 71 | 0x7639, 0x765A, 0x6E39, 0x763A, 0x6E39, 0x765A, 0x767A, 0x767A, 0x767A, 0x767A, 0x767A, 0x767A, 0x767A, 0x767A, 0x767A, 0x767A, // 0x03E0 (992) 72 | 0x767B, 0x765A, 0x6E19, 0x75F9, 0x75F9, 0x6DF9, 0x75F9, 0x75F9, 0x6E19, 0x765A, 0x767B, 0x767A, 0x767A, 0x767A, 0x767A, 0x767A, // 0x03F0 (1008) 73 | 0x767A, 0x767A, 0x767A, 0x767A, 0x767A, 0x765A, 0x6E3A, 0x6E39, 0x6E39, 0x765A, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, // 0x0400 (1024) 74 | 0x7639, 0x7639, 0x7639, 0x7639, 0x6E3A, 0x6E5A, 0x6E5A, 0x6E5A, 0x765A, 0x6E5A, 0x6E5A, 0x6E5A, 0x6E3A, 0x7639, 0x7639, 0x7639, // 0x0410 (1040) 75 | 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x765A, 0x7639, 0x763A, }; 76 | -------------------------------------------------------------------------------- /examples/Birduino/bird01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stevstrong/Adafruit_TFTLCD_16bit_STM32/39a76c6589ac3e5fff8441e3aa77a9d80dfb06f6/examples/Birduino/bird01.jpg -------------------------------------------------------------------------------- /examples/Birduino/bird05.h: -------------------------------------------------------------------------------- 1 | // Generated by : ImageConverter 565 v2.3 2 | // Generated from: bird05.bmp 3 | // Time generated: 08-Sep-16 21:56:54 4 | // Dimensions : 34x24 pixels 5 | // Size : 1,632 Bytes 6 | #define BIRD_BMP_X 34 7 | #define BIRD_BMP_Y 24 8 | const unsigned short bird[0x330] ={ 9 | 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0010 (16) 10 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, // 0x0020 (32) 11 | 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0030 (48) 12 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7639, 0x7639, 0x7639, 0x7639, // 0x0040 (64) 13 | 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0050 (80) 14 | 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0x7639, // 0x0060 (96) 15 | 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x0000, 0x0000, 0x0000, // 0x0070 (112) 16 | 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, // 0x0080 (128) 17 | 0x0000, 0x0000, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x0000, 0x0000, // 0x0090 (144) 18 | 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0x0000, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0x00A0 (160) 19 | 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x0000, // 0x00B0 (176) 20 | 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0x00C0 (192) 21 | 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, // 0x00D0 (208) 22 | 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0x0000, 0x0000, 0xE73C, 0xE73C, // 0x00E0 (224) 23 | 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, // 0x00F0 (240) 24 | 0x7639, 0x0000, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0x0000, 0x0000, // 0x0100 (256) 25 | 0xE73C, 0xE73C, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x7639, 0x7639, 0x7639, 0x7639, // 0x0110 (272) 26 | 0x7639, 0x7639, 0x0000, 0x0000, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, // 0x0120 (288) 27 | 0x0000, 0x0000, 0xE73C, 0xE73C, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x7639, // 0x0130 (304) 28 | 0x7639, 0x7639, 0x7639, 0x7639, 0x0000, 0x0000, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, // 0x0140 (320) 29 | 0xFF80, 0xFF80, 0x0000, 0x0000, 0x0000, 0xE73C, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, // 0x0150 (336) 30 | 0x0000, 0x7639, 0x7639, 0x7639, 0x7639, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0160 (352) 31 | 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0x0000, 0x0000, 0x0000, 0xE73C, 0xE73C, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0x0170 (368) 32 | 0xFFFF, 0x0000, 0x0000, 0x7639, 0x7639, 0x7639, 0x7639, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0180 (384) 33 | 0x0000, 0x0000, 0x0000, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0x0000, 0x0000, 0x0000, 0xE73C, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0x0190 (400) 34 | 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x7639, 0x7639, 0x7639, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0x01A0 (416) 35 | 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x01B0 (432) 36 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7639, 0x7639, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, // 0x01C0 (448) 37 | 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0x0000, 0x0000, 0x0000, // 0x01D0 (464) 38 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7639, 0x0000, 0x0000, 0xFF80, 0xFF80, // 0x01E0 (480) 39 | 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFF80, 0xFF80, 0x0000, 0x0000, 0xFF80, 0xFF80, 0xFF80, 0xFF80, 0x0000, 0x0000, // 0x01F0 (496) 40 | 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0200 (512) 41 | 0xFF80, 0xFF80, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFF80, 0xFF80, 0x0000, 0x0000, 0xFF80, 0xFF80, 0xFF80, 0x0000, // 0x0210 (528) 42 | 0x0000, 0x0000, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0x0000, 0x0000, // 0x0220 (544) 43 | 0x7639, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, 0xFC00, // 0x0230 (560) 44 | 0x0000, 0x0000, 0xE8E4, 0xE8E4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0240 (576) 45 | 0x0000, 0x7639, 0x7639, 0x7639, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, // 0x0250 (592) 46 | 0xFC00, 0xFC00, 0x0000, 0x0000, 0xE8E4, 0xE8E4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0260 (608) 47 | 0x0000, 0x0000, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, // 0x0270 (624) 48 | 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, // 0x0280 (640) 49 | 0xE8E4, 0xE8E4, 0x0000, 0x0000, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x0000, 0x0000, 0xFC00, 0xFC00, 0xFC00, 0xFC00, // 0x0290 (656) 50 | 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0x0000, 0x0000, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, // 0x02A0 (672) 51 | 0xE8E4, 0xE8E4, 0xE8E4, 0xE8E4, 0x0000, 0x0000, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x0000, 0x0000, 0x0000, // 0x02B0 (688) 52 | 0x0000, 0x0000, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x02C0 (704) 53 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, // 0x02D0 (720) 54 | 0x0000, 0x0000, 0x0000, 0x0000, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0xFC00, 0x0000, 0x0000, // 0x02E0 (736) 55 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, // 0x02F0 (752) 56 | 0x7639, 0x7639, 0x7639, 0x7639, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0300 (768) 57 | 0x0000, 0x0000, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, // 0x0310 (784) 58 | 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0320 (800) 59 | 0x0000, 0x0000, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, // 0x0330 (816) 60 | }; 61 | -------------------------------------------------------------------------------- /examples/Birduino/bottom_deco.h: -------------------------------------------------------------------------------- 1 | // Generated by : ImageConverter 565 v2.3 2 | // Generated from: bottom_deco.bmp 3 | // Time generated: 08-Sep-16 21:20:50 4 | // Dimensions : 338x1 pixels 5 | // Size : 676 Bytes 6 | #define BOTTOM_DECO_X 338 7 | const unsigned short bottom_deco[0x152] ={ 8 | 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, // 0x0010 (16) 9 | 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, // 0x0020 (32) 10 | 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, // 0x0030 (48) 11 | 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, // 0x0040 (64) 12 | 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, // 0x0050 (80) 13 | 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, // 0x0060 (96) 14 | 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, // 0x0070 (112) 15 | 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, // 0x0080 (128) 16 | 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, // 0x0090 (144) 17 | 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, // 0x00A0 (160) 18 | 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, // 0x00B0 (176) 19 | 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, // 0x00C0 (192) 20 | 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, // 0x00D0 (208) 21 | 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, // 0x00E0 (224) 22 | 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, // 0x00F0 (240) 23 | 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, // 0x0100 (256) 24 | 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, // 0x0110 (272) 25 | 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, // 0x0120 (288) 26 | 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, // 0x0130 (304) 27 | 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, // 0x0140 (320) 28 | 0x53E4, 0x53E4, 0x53E4, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x9F2B, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x9F2B, // 0x0150 (336) 29 | 0x9F2B, 0x9F2B}; 30 | -------------------------------------------------------------------------------- /examples/Birduino/pillar01.h: -------------------------------------------------------------------------------- 1 | // Generated by : ImageConverter 565 v2.3 2 | // Generated from: pillar01.bmp 3 | // Time generated: 07-Sep-16 18:43:31 4 | // Dimensions : 55x1 pixels 5 | // Size : 110 Bytes 6 | #define PILLAR_BMP_X 55 7 | #define PILLAR_BMP_Y 1 8 | const unsigned short pillar[0x37] ={ 9 | 0x7639, 0x7639, 0x7639, 0x0863, 0x7C48, 0x9569, 0x8D28, 0x95AA, 0x9E0A, 0xA64B, 0xA64B, 0xB68E, 0xBECE, 0xCF2E, 0xCF2E, 0xC70D, // 0x0010 (16) 10 | 0xCF6E, 0xD7AF, 0xDFD0, 0xDFB0, 0xE7F1, 0xE7D1, 0xE7D1, 0xDF90, 0xD770, 0xD74F, 0xCF0E, 0xC6EE, 0xBEAD, 0xAE4C, 0xA62B, 0x9DEB, // 0x0020 (32) 11 | 0x95CA, 0x8D89, 0x8549, 0x7D08, 0x74E7, 0x74C7, 0x6C86, 0x6445, 0x5C24, 0x5C24, 0x5404, 0x5404, 0x5404, 0x53E4, 0x5404, 0x53E4, // 0x0030 (48) 12 | 0x5404, 0x53E4, 0x5C26, 0x18A1, 0x7639, 0x7639, 0x7639, }; 13 | -------------------------------------------------------------------------------- /examples/Birduino/pillar_end.h: -------------------------------------------------------------------------------- 1 | // Generated by : ImageConverter 565 v2.3 2 | // Generated from: pillar_end_1.bmp 3 | // Time generated: 07-Sep-16 21:26:37 4 | // Dimensions : 55x20 pixels 5 | // Size : 2,200 Bytes 6 | #define PILLAR_END_BMP_X 55 7 | #define PILLAR_END_BMP_Y 20 8 | const unsigned short pillar_end[0x44C] ={ 9 | 0x7639, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, // 0x0010 (16) 10 | 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, // 0x0020 (32) 11 | 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, // 0x0030 (48) 12 | 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0x0001, 0x1881, 0x10A1, 0x10A1, 0x10A1, 0x0880, // 0x0040 (64) 13 | 0x1081, 0x1081, 0x1081, 0x1081, 0x1081, 0x1081, 0x1081, 0x1081, 0x1081, 0x1061, 0x1061, 0x1061, 0x1061, 0x1061, 0x1061, 0x1061, // 0x0050 (80) 14 | 0x1061, 0x1881, 0x1881, 0x1861, 0x1061, 0x1061, 0x1861, 0x1881, 0x1881, 0x1861, 0x1881, 0x1081, 0x1081, 0x0000, 0x0000, 0x0000, // 0x0060 (96) 15 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x10C0, 0x0000, 0x0882, 0x08E4, 0x7BEF, 0x7639, 0x7639, 0x7BEF, // 0x0070 (112) 16 | 0x0000, 0xE7D2, 0xD78F, 0xDFAF, 0xDFAF, 0xE7F0, 0xE7F0, 0xE7F0, 0xE7F0, 0xDFF0, 0xDFD0, 0xDFAF, 0xDFAF, 0xDFAF, 0xDF8F, 0xD74E, // 0x0080 (128) 17 | 0xCF4E, 0xCF2E, 0xC72E, 0xBEED, 0xB6CC, 0xB68C, 0xAE8C, 0xA64B, 0x9E2A, 0x9E0A, 0x95E9, 0x8DC9, 0x8DA8, 0x8588, 0x8567, 0x7D47, // 0x0090 (144) 18 | 0x7526, 0x6CE5, 0x6CE5, 0x6CA5, 0x64A5, 0x5C84, 0x5C64, 0x5C64, 0x5444, 0x5444, 0x5444, 0x4C23, 0x4C03, 0x4C23, 0x4C05, 0x4C05, // 0x00A0 (160) 19 | 0x5C05, 0x4B26, 0x1082, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0xE7D2, 0xD78F, 0xDFAF, 0xDFAF, 0xE7F0, 0xE7F0, 0xE7F0, 0xE7F0, // 0x00B0 (176) 20 | 0xDFF0, 0xDFD0, 0xDFAF, 0xDFAF, 0xDFAF, 0xDF8F, 0xD74E, 0xCF4E, 0xCF2E, 0xC72E, 0xBEED, 0xB6CC, 0xB68C, 0xAE8C, 0xA64B, 0x9E2A, // 0x00C0 (192) 21 | 0x9E0A, 0x95E9, 0x8DC9, 0x8DA8, 0x8588, 0x8567, 0x7D47, 0x7526, 0x6CE5, 0x6CE5, 0x6CA5, 0x64A5, 0x5C84, 0x5C64, 0x5C64, 0x5444, // 0x00D0 (208) 22 | 0x5444, 0x5444, 0x4C23, 0x4C03, 0x4C23, 0x4C05, 0x4C05, 0x5C05, 0x4B26, 0x1082, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0xE7D2, // 0x00E0 (224) 23 | 0xD78F, 0xDFAF, 0xDFAF, 0xE7F0, 0xE7F0, 0xE7F0, 0xE7F0, 0xDFF0, 0xDFD0, 0xDFAF, 0xDFAF, 0xDFAF, 0xDF8F, 0xD74E, 0xCF4E, 0xCF2E, // 0x00F0 (240) 24 | 0xC72E, 0xBEED, 0xB6CC, 0xB68C, 0xAE8C, 0xA64B, 0x9E2A, 0x9E0A, 0x95E9, 0x8DC9, 0x8DA8, 0x8588, 0x8567, 0x7D47, 0x7526, 0x6CE5, // 0x0100 (256) 25 | 0x6CE5, 0x6CA5, 0x64A5, 0x5C84, 0x5C64, 0x5C64, 0x5444, 0x5444, 0x5444, 0x4C23, 0x4C03, 0x4C23, 0x4C05, 0x4C05, 0x5C05, 0x4B26, // 0x0110 (272) 26 | 0x1082, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0xE7D2, 0xD78F, 0xDFAF, 0xDFAF, 0xE7F0, 0xE7F0, 0xE7F0, 0xE7F0, 0xDFF0, 0xDFD0, // 0x0120 (288) 27 | 0xDFAF, 0xDFAF, 0xDFAF, 0xDF8F, 0xD74E, 0xCF4E, 0xCF2E, 0xC72E, 0xBEED, 0xB6CC, 0xB68C, 0xAE8C, 0xA64B, 0x9E2A, 0x9E0A, 0x95E9, // 0x0130 (304) 28 | 0x8DC9, 0x8DA8, 0x8588, 0x8567, 0x7D47, 0x7526, 0x6CE5, 0x6CE5, 0x6CA5, 0x64A5, 0x5C84, 0x5C64, 0x5C64, 0x5444, 0x5444, 0x5444, // 0x0140 (320) 29 | 0x4C23, 0x4C03, 0x4C23, 0x4C05, 0x4C05, 0x5C05, 0x4B26, 0x1082, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0xE7D2, 0xD78F, 0xDFAF, // 0x0150 (336) 30 | 0xDFAF, 0xE7F0, 0xE7F0, 0xE7F0, 0xE7F0, 0xDFF0, 0xDFD0, 0xDFAF, 0xDFAF, 0xDFAF, 0xDF8F, 0xD74E, 0xCF4E, 0xCF2E, 0xC72E, 0xBEED, // 0x0160 (352) 31 | 0xB6CC, 0xB68C, 0xAE8C, 0xA64B, 0x9E2A, 0x9E0A, 0x95E9, 0x8DC9, 0x8DA8, 0x8588, 0x8567, 0x7D47, 0x7526, 0x6CE5, 0x6CE5, 0x6CA5, // 0x0170 (368) 32 | 0x64A5, 0x5C84, 0x5C64, 0x5C64, 0x5444, 0x5444, 0x5444, 0x4C23, 0x4C03, 0x4C23, 0x4C05, 0x4C05, 0x5C05, 0x4B26, 0x1082, 0x7BEF, // 0x0180 (384) 33 | 0x7639, 0x7639, 0x7BEF, 0x0000, 0xE7D2, 0xD78F, 0xDFAF, 0xDFAF, 0xE7F0, 0xE7F0, 0xE7F0, 0xE7F0, 0xDFF0, 0xDFD0, 0xDFAF, 0xDFAF, // 0x0190 (400) 34 | 0xDFAF, 0xDF8F, 0xD74E, 0xCF4E, 0xCF2E, 0xC72E, 0xBEED, 0xB6CC, 0xB68C, 0xAE8C, 0xA64B, 0x9E2A, 0x9E0A, 0x95E9, 0x8DC9, 0x8DA8, // 0x01A0 (416) 35 | 0x8588, 0x8567, 0x7D47, 0x7526, 0x6CE5, 0x6CE5, 0x6CA5, 0x64A5, 0x5C84, 0x5C64, 0x5C64, 0x5444, 0x5444, 0x5444, 0x4C23, 0x4C03, // 0x01B0 (432) 36 | 0x4C23, 0x4C05, 0x4C05, 0x5C05, 0x4B26, 0x1082, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0xE7D2, 0xD78F, 0xDFAF, 0xDFAF, 0xE7F0, // 0x01C0 (448) 37 | 0xE7F0, 0xE7F0, 0xE7F0, 0xDFF0, 0xDFD0, 0xDFAF, 0xDFAF, 0xDFAF, 0xDF8F, 0xD74E, 0xCF4E, 0xCF2E, 0xC72E, 0xBEED, 0xB6CC, 0xB68C, // 0x01D0 (464) 38 | 0xAE8C, 0xA64B, 0x9E2A, 0x9E0A, 0x95E9, 0x8DC9, 0x8DA8, 0x8588, 0x8567, 0x7D47, 0x7526, 0x6CE5, 0x6CE5, 0x6CA5, 0x64A5, 0x5C84, // 0x01E0 (480) 39 | 0x5C64, 0x5C64, 0x5444, 0x5444, 0x5444, 0x4C23, 0x4C03, 0x4C23, 0x4C05, 0x4C05, 0x5C05, 0x4B26, 0x1082, 0x7BEF, 0x7639, 0x7639, // 0x01F0 (496) 40 | 0x7BEF, 0x0000, 0xE7D2, 0xD78F, 0xDFAF, 0xDFAF, 0xE7F0, 0xE7F0, 0xE7F0, 0xE7F0, 0xDFF0, 0xDFD0, 0xDFAF, 0xDFAF, 0xDFAF, 0xDF8F, // 0x0200 (512) 41 | 0xD74E, 0xCF4E, 0xCF2E, 0xC72E, 0xBEED, 0xB6CC, 0xB68C, 0xAE8C, 0xA64B, 0x9E2A, 0x9E0A, 0x95E9, 0x8DC9, 0x8DA8, 0x8588, 0x8567, // 0x0210 (528) 42 | 0x7D47, 0x7526, 0x6CE5, 0x6CE5, 0x6CA5, 0x64A5, 0x5C84, 0x5C64, 0x5C64, 0x5444, 0x5444, 0x5444, 0x4C23, 0x4C03, 0x4C23, 0x4C05, // 0x0220 (544) 43 | 0x4C05, 0x5C05, 0x4B26, 0x1082, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0xE7D2, 0xD78F, 0xDFAF, 0xDFAF, 0xE7F0, 0xE7F0, 0xE7F0, // 0x0230 (560) 44 | 0xE7F0, 0xDFF0, 0xDFD0, 0xDFAF, 0xDFAF, 0xDFAF, 0xDF8F, 0xD74E, 0xCF4E, 0xCF2E, 0xC72E, 0xBEED, 0xB6CC, 0xB68C, 0xAE8C, 0xA64B, // 0x0240 (576) 45 | 0x9E2A, 0x9E0A, 0x95E9, 0x8DC9, 0x8DA8, 0x8588, 0x8567, 0x7D47, 0x7526, 0x6CE5, 0x6CE5, 0x6CA5, 0x64A5, 0x5C84, 0x5C64, 0x5C64, // 0x0250 (592) 46 | 0x5444, 0x5444, 0x5444, 0x4C23, 0x4C03, 0x4C23, 0x4C05, 0x4C05, 0x5C05, 0x4B26, 0x1082, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, // 0x0260 (608) 47 | 0xE7D2, 0xD78F, 0xDFAF, 0xDFAF, 0xE7F0, 0xE7F0, 0xE7F0, 0xE7F0, 0xDFF0, 0xDFD0, 0xDFAF, 0xDFAF, 0xDFAF, 0xDF8F, 0xD74E, 0xCF4E, // 0x0270 (624) 48 | 0xCF2E, 0xC72E, 0xBEED, 0xB6CC, 0xB68C, 0xAE8C, 0xA64B, 0x9E2A, 0x9E0A, 0x95E9, 0x8DC9, 0x8DA8, 0x8588, 0x8567, 0x7D47, 0x7526, // 0x0280 (640) 49 | 0x6CE5, 0x6CE5, 0x6CA5, 0x64A5, 0x5C84, 0x5C64, 0x5C64, 0x5444, 0x5444, 0x5444, 0x4C23, 0x4C03, 0x4C23, 0x4C05, 0x4C05, 0x5C05, // 0x0290 (656) 50 | 0x4B26, 0x1082, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0xE7D2, 0xD78F, 0xDFAF, 0xDFAF, 0xE7F0, 0xE7F0, 0xE7F0, 0xE7F0, 0xDFF0, // 0x02A0 (672) 51 | 0xDFD0, 0xDFAF, 0xDFAF, 0xDFAF, 0xDF8F, 0xD74E, 0xCF4E, 0xCF2E, 0xC72E, 0xBEED, 0xB6CC, 0xB68C, 0xAE8C, 0xA64B, 0x9E2A, 0x9E0A, // 0x02B0 (688) 52 | 0x95E9, 0x8DC9, 0x8DA8, 0x8588, 0x8567, 0x7D47, 0x7526, 0x6CE5, 0x6CE5, 0x6CA5, 0x64A5, 0x5C84, 0x5C64, 0x5C64, 0x5444, 0x5444, // 0x02C0 (704) 53 | 0x5444, 0x4C23, 0x4C03, 0x4C23, 0x4C05, 0x4C05, 0x5C05, 0x4B26, 0x1082, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0xE7D2, 0xD78F, // 0x02D0 (720) 54 | 0xDFAF, 0xDFAF, 0xE7F0, 0xE7F0, 0xE7F0, 0xE7F0, 0xDFF0, 0xDFD0, 0xDFAF, 0xDFAF, 0xDFAF, 0xDF8F, 0xD74E, 0xCF4E, 0xCF2E, 0xC72E, // 0x02E0 (736) 55 | 0xBEED, 0xB6CC, 0xB68C, 0xAE8C, 0xA64B, 0x9E2A, 0x9E0A, 0x95E9, 0x8DC9, 0x8DA8, 0x8588, 0x8567, 0x7D47, 0x7526, 0x6CE5, 0x6CE5, // 0x02F0 (752) 56 | 0x6CA5, 0x64A5, 0x5C84, 0x5C64, 0x5C64, 0x5444, 0x5444, 0x5444, 0x4C23, 0x4C03, 0x4C23, 0x4C05, 0x4C05, 0x5C05, 0x4B26, 0x1082, // 0x0300 (768) 57 | 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0xE7D2, 0xD78F, 0xDFAF, 0xDFAF, 0xE7F0, 0xE7F0, 0xE7F0, 0xE7F0, 0xDFF0, 0xDFD0, 0xDFAF, // 0x0310 (784) 58 | 0xDFAF, 0xDFAF, 0xDF8F, 0xD74E, 0xCF4E, 0xCF2E, 0xC72E, 0xBEED, 0xB6CC, 0xB68C, 0xAE8C, 0xA64B, 0x9E2A, 0x9E0A, 0x95E9, 0x8DC9, // 0x0320 (800) 59 | 0x8DA8, 0x8588, 0x8567, 0x7D47, 0x7526, 0x6CE5, 0x6CE5, 0x6CA5, 0x64A5, 0x5C84, 0x5C64, 0x5C64, 0x5444, 0x5444, 0x5444, 0x4C23, // 0x0330 (816) 60 | 0x4C03, 0x4C23, 0x4C05, 0x4C05, 0x5C05, 0x4B26, 0x1082, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0xE7D2, 0xD78F, 0xDFAF, 0xDFAF, // 0x0340 (832) 61 | 0xE7F0, 0xE7F0, 0xE7F0, 0xE7F0, 0xDFF0, 0xDFD0, 0xDFAF, 0xDFAF, 0xDFAF, 0xDF8F, 0xD74E, 0xCF4E, 0xCF2E, 0xC72E, 0xBEED, 0xB6CC, // 0x0350 (848) 62 | 0xB68C, 0xAE8C, 0xA64B, 0x9E2A, 0x9E0A, 0x95E9, 0x8DC9, 0x8DA8, 0x8588, 0x8567, 0x7D47, 0x7526, 0x6CE5, 0x6CE5, 0x6CA5, 0x64A5, // 0x0360 (864) 63 | 0x5C84, 0x5C64, 0x5C64, 0x5444, 0x5444, 0x5444, 0x4C23, 0x4C03, 0x4C23, 0x4C05, 0x4C05, 0x5C05, 0x4B26, 0x1082, 0x7BEF, 0x7639, // 0x0370 (880) 64 | 0x7639, 0x7BEF, 0x0000, 0xE7D2, 0xD78F, 0xDFAF, 0xDFAF, 0xE7F0, 0xE7F0, 0xE7F0, 0xE7F0, 0xDFF0, 0xDFD0, 0xDFAF, 0xDFAF, 0xDFAF, // 0x0380 (896) 65 | 0xDF8F, 0xD74E, 0xCF4E, 0xCF2E, 0xC72E, 0xBEED, 0xB6CC, 0xB68C, 0xAE8C, 0xA64B, 0x9E2A, 0x9E0A, 0x95E9, 0x8DC9, 0x8DA8, 0x8588, // 0x0390 (912) 66 | 0x8567, 0x7D47, 0x7526, 0x6CE5, 0x6CE5, 0x6CA5, 0x64A5, 0x5C84, 0x5C64, 0x5C64, 0x5444, 0x5444, 0x5444, 0x4C23, 0x4C03, 0x4C23, // 0x03A0 (928) 67 | 0x4C05, 0x4C05, 0x5C05, 0x4B26, 0x1082, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0xE7D2, 0xD78F, 0xDFAF, 0xDFAF, 0xE7F0, 0xE7F0, // 0x03B0 (944) 68 | 0xE7F0, 0xE7F0, 0xDFF0, 0xDFD0, 0xDFAF, 0xDFAF, 0xDFAF, 0xDF8F, 0xD74E, 0xCF4E, 0xCF2E, 0xC72E, 0xBEED, 0xB6CC, 0xB68C, 0xAE8C, // 0x03C0 (960) 69 | 0xA64B, 0x9E2A, 0x9E0A, 0x95E9, 0x8DC9, 0x8DA8, 0x8588, 0x8567, 0x7D47, 0x7526, 0x6CE5, 0x6CE5, 0x6CA5, 0x64A5, 0x5C84, 0x5C64, // 0x03D0 (976) 70 | 0x5C64, 0x5444, 0x5444, 0x5444, 0x4C23, 0x4C03, 0x4C23, 0x4C05, 0x4C05, 0x5C05, 0x4B26, 0x1082, 0x7BEF, 0x7639, 0x7639, 0x7BEF, // 0x03E0 (992) 71 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x03F0 (1008) 72 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0400 (1024) 73 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0410 (1040) 74 | 0x0000, 0x0000, 0x0000, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, // 0x0420 (1056) 75 | 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, // 0x0430 (1072) 76 | 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, // 0x0440 (1088) 77 | 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7639, }; 78 | -------------------------------------------------------------------------------- /examples/Birduino/pillar_end.h_: -------------------------------------------------------------------------------- 1 | // Generated by : ImageConverter 565 v2.3 2 | // Generated from: pillar_end.bmp 3 | // Time generated: 07-Sep-16 18:44:29 4 | // Dimensions : 55x20 pixels 5 | // Size : 2,200 Bytes 6 | #define PILLAR_END_BMP_X 55 7 | #define PILLAR_END_BMP_Y 20 8 | const unsigned short pillar_end[0x44C] ={ 9 | 0x7639, 0x7639, 0x7639, 0x0062, 0x63A4, 0x6C64, 0x6443, 0x6465, 0x6484, 0x6CA5, 0x6CA5, 0x74A6, 0x7CC6, 0x7D05, 0x7D05, 0x7D05, // 0x0010 (16) 10 | 0x7D05, 0x7D06, 0x7D26, 0x7D26, 0x7D26, 0x7D26, 0x7D26, 0x7D06, 0x7D06, 0x7506, 0x6D05, 0x6505, 0x6505, 0x64E4, 0x64C4, 0x5CA4, // 0x0020 (32) 11 | 0x5CA4, 0x5484, 0x5483, 0x5483, 0x5463, 0x5C43, 0x5C23, 0x5C02, 0x5402, 0x5402, 0x5402, 0x5402, 0x5402, 0x5402, 0x5402, 0x5402, // 0x0030 (48) 12 | 0x53E3, 0x53E5, 0x5C47, 0x18A0, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x7639, 0x1084, 0x6346, 0x63E5, 0x63E5, 0x5BE6, 0x5C06, // 0x0040 (64) 13 | 0x5BE6, 0x5BE6, 0x63C7, 0x63A6, 0x5BC6, 0x5BC6, 0x5BC6, 0x5BC6, 0x53C6, 0x53C6, 0x53C6, 0x53C6, 0x53C6, 0x53C6, 0x53C6, 0x5BC6, // 0x0050 (80) 14 | 0x5BC6, 0x5BC6, 0x5BC6, 0x5BC6, 0x5BE6, 0x63E7, 0x5BC6, 0x5BC6, 0x5BE7, 0x5BE7, 0x5BE7, 0x5BE7, 0x6406, 0x6406, 0x6406, 0x6406, // 0x0060 (96) 15 | 0x6406, 0x6407, 0x6407, 0x6406, 0x63E7, 0x6407, 0x63E7, 0x6407, 0x5BE6, 0x6C47, 0x20C1, 0x7639, 0x7639, 0x7639, 0x7639, 0x7BEF, // 0x0070 (112) 16 | 0x0000, 0x0001, 0x1881, 0x10A1, 0x10A1, 0x10A1, 0x0880, 0x1081, 0x1081, 0x1081, 0x1081, 0x1081, 0x1081, 0x1081, 0x1081, 0x1081, // 0x0080 (128) 17 | 0x1061, 0x1061, 0x1061, 0x1061, 0x1061, 0x1061, 0x1061, 0x1061, 0x1881, 0x1881, 0x1861, 0x1061, 0x1061, 0x1861, 0x1881, 0x1881, // 0x0090 (144) 18 | 0x1861, 0x1881, 0x1081, 0x1081, 0x1081, 0x1081, 0x1081, 0x1081, 0x1081, 0x1081, 0x10A1, 0x10A2, 0x10A2, 0x10A2, 0x10A0, 0x10C0, // 0x00A0 (160) 19 | 0x0000, 0x0882, 0x08E4, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0x6368, 0x5B46, 0x5B46, 0x5B46, 0x5B46, 0x5B46, 0x5326, 0x5346, // 0x00B0 (176) 20 | 0x5326, 0x5326, 0x5346, 0x5346, 0x5346, 0x5345, 0x5B46, 0x5B46, 0x5B46, 0x5B46, 0x5346, 0x5346, 0x5346, 0x5346, 0x5346, 0x5B46, // 0x00C0 (192) 21 | 0x5B46, 0x5B46, 0x5B46, 0x5B46, 0x5B46, 0x5B46, 0x5B46, 0x5B66, 0x5B67, 0x5B67, 0x5346, 0x5B46, 0x5B66, 0x5B66, 0x5B66, 0x5B67, // 0x00D0 (208) 22 | 0x5B67, 0x5B46, 0x5B46, 0x5B46, 0x5B47, 0x5B48, 0x5B47, 0x6367, 0x6308, 0x1062, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0x6CC6, // 0x00E0 (224) 23 | 0x64C5, 0x64C4, 0x64C4, 0x6CC4, 0x6CE4, 0x6CE4, 0x6CE4, 0x6CE5, 0x6CE5, 0x6CC4, 0x6CC4, 0x64C4, 0x6CC4, 0x64A4, 0x64A4, 0x64A4, // 0x00F0 (240) 24 | 0x64A4, 0x64A4, 0x64A4, 0x64A4, 0x6484, 0x5C84, 0x5C84, 0x5C84, 0x5C84, 0x5C84, 0x5C84, 0x5C84, 0x5C84, 0x5463, 0x5463, 0x5463, // 0x0100 (256) 25 | 0x5463, 0x5463, 0x5443, 0x4C43, 0x4C43, 0x4C43, 0x4C23, 0x4C23, 0x5443, 0x4C43, 0x4C43, 0x4C43, 0x6426, 0x5C05, 0x6C05, 0x6346, // 0x0110 (272) 26 | 0x1061, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0xFFF6, 0xF7F4, 0xF7F4, 0xF7F4, 0xF7F4, 0xF7F3, 0xF7F3, 0xF7F3, 0xF7F3, 0xF7F4, // 0x0120 (288) 27 | 0xEFF3, 0xEFF3, 0xEFF3, 0xEFF3, 0xEFD2, 0xE7B2, 0xE792, 0xDF71, 0xD710, 0xCF10, 0xCEEF, 0xC6AF, 0xBE8E, 0xAE4D, 0xAE2D, 0xA60C, // 0x0130 (304) 28 | 0x9DCB, 0x9DAA, 0x958A, 0x8D69, 0x8D49, 0x8528, 0x7CE7, 0x7CC7, 0x74A7, 0x7487, 0x6C66, 0x6445, 0x6445, 0x6425, 0x6425, 0x5BE4, // 0x0140 (320) 29 | 0x5BE4, 0x5BE4, 0x5BC4, 0x5C24, 0x53E3, 0x5BE2, 0x5B44, 0x1081, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0xE7B3, 0xDF71, 0xDF91, // 0x0150 (336) 30 | 0xDF91, 0xDFB1, 0xE7F1, 0xE7D1, 0xE7D2, 0xE7D1, 0xDFB1, 0xDF91, 0xDF91, 0xDF91, 0xDF71, 0xD750, 0xCF0F, 0xCF0F, 0xCEEF, 0xC6CF, // 0x0160 (352) 31 | 0xBEAE, 0xB66D, 0xB66D, 0xAE2C, 0xA5EC, 0xA5CB, 0x9DAB, 0x9D8A, 0x956A, 0x9549, 0x8D29, 0x8508, 0x84E7, 0x7CA6, 0x7486, 0x7487, // 0x0170 (368) 32 | 0x7466, 0x6C26, 0x6425, 0x6425, 0x6405, 0x6405, 0x5BE5, 0x5BC4, 0x5BC4, 0x5BC5, 0x5425, 0x4C04, 0x5C03, 0x5345, 0x0881, 0x7BEF, // 0x0180 (384) 33 | 0x7639, 0x7639, 0x7BEF, 0x0000, 0xE7D2, 0xD78F, 0xDFAF, 0xDFAF, 0xE7F0, 0xE7F0, 0xE7F0, 0xE7F0, 0xDFF0, 0xDFD0, 0xDFAF, 0xDFAF, // 0x0190 (400) 34 | 0xDFAF, 0xDF8F, 0xD74E, 0xCF4E, 0xCF2E, 0xC72E, 0xBEED, 0xB6CC, 0xB68C, 0xAE8C, 0xA64B, 0x9E2A, 0x9E0A, 0x95E9, 0x8DC9, 0x8DA8, // 0x01A0 (416) 35 | 0x8588, 0x8567, 0x7D47, 0x7526, 0x6CE5, 0x6CE5, 0x6CA5, 0x64A5, 0x5C84, 0x5C64, 0x5C64, 0x5444, 0x5444, 0x5444, 0x4C23, 0x4C03, // 0x01B0 (432) 36 | 0x4C23, 0x4C05, 0x4C05, 0x5C05, 0x4B26, 0x1082, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0xE7B2, 0xD790, 0xDFB0, 0xDF90, 0xE7D0, // 0x01C0 (448) 37 | 0xE7F1, 0xE7F1, 0xE7F1, 0xDFD1, 0xDFB1, 0xDF90, 0xDF90, 0xDF90, 0xDF8F, 0xD74F, 0xCF2E, 0xCF2E, 0xC72E, 0xBEEE, 0xB6AD, 0xB68D, // 0x01D0 (464) 38 | 0xAE8D, 0xA64C, 0xA60B, 0x9E0B, 0x9DCA, 0x95AA, 0x8D89, 0x8D69, 0x8548, 0x7D27, 0x7D07, 0x74C6, 0x74C6, 0x6CA6, 0x6C86, 0x6465, // 0x01E0 (480) 39 | 0x5C45, 0x5C45, 0x5C44, 0x5C44, 0x5424, 0x5404, 0x4C03, 0x5404, 0x4C05, 0x4C05, 0x5C05, 0x5326, 0x1082, 0x7BEF, 0x7639, 0x7639, // 0x01F0 (496) 40 | 0x7BEF, 0x0000, 0xE7B3, 0xD790, 0xDF91, 0xDF91, 0xE7D1, 0xE7F1, 0xE7F2, 0xE7F1, 0xDFD1, 0xDFB1, 0xDF90, 0xDF90, 0xDF90, 0xDF8F, // 0x0200 (512) 41 | 0xD74F, 0xCF2F, 0xCF2F, 0xC72F, 0xBEEE, 0xB6AD, 0xAE8D, 0xAE8D, 0xAE4C, 0xA60C, 0xA5EB, 0x9DAB, 0x9D8A, 0x9569, 0x8D49, 0x8D29, // 0x0210 (528) 42 | 0x8508, 0x7CE7, 0x74A6, 0x74A6, 0x7486, 0x6C86, 0x6445, 0x6445, 0x6445, 0x5C25, 0x5C25, 0x5C24, 0x53E4, 0x53E4, 0x5404, 0x4C04, // 0x0220 (544) 43 | 0x4C04, 0x5C03, 0x5325, 0x1082, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0xE7B2, 0xDF90, 0xDFB0, 0xDF90, 0xE7B0, 0xE7F1, 0xE7F1, // 0x0230 (560) 44 | 0xE7F1, 0xE7D1, 0xDFB1, 0xE78F, 0xE78F, 0xE7B0, 0xDF6F, 0xD74E, 0xCF2E, 0xCF2E, 0xCF0E, 0xBEED, 0xBEAD, 0xB68C, 0xAE8C, 0xAE4C, // 0x0240 (576) 45 | 0xA60B, 0x9E0B, 0x95CA, 0x95AA, 0x8D89, 0x8D69, 0x8548, 0x8528, 0x7D07, 0x74C6, 0x74A6, 0x6CA6, 0x6C86, 0x6465, 0x5C44, 0x5C44, // 0x0250 (592) 46 | 0x5C24, 0x5C24, 0x5424, 0x5403, 0x5403, 0x5404, 0x4C23, 0x4C23, 0x5C03, 0x5325, 0x1082, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, // 0x0260 (608) 47 | 0xE7B2, 0xDF90, 0xDFB0, 0xDFB0, 0xDFB0, 0xE7F1, 0xE7F1, 0xE7F0, 0xE7D0, 0xE7D0, 0xE7B0, 0xE7B0, 0xE7B0, 0xDF6F, 0xD76E, 0xCF2E, // 0x0270 (624) 48 | 0xCF4E, 0xC70D, 0xBEED, 0xBECC, 0xB68C, 0xAE8B, 0xA64B, 0x9E0B, 0xA60A, 0x9DCA, 0x95A9, 0x8D89, 0x8D68, 0x8548, 0x7D27, 0x7D07, // 0x0280 (640) 49 | 0x74C6, 0x74A6, 0x6CA6, 0x6C85, 0x6465, 0x6444, 0x5C44, 0x5C24, 0x5C24, 0x5424, 0x5403, 0x5403, 0x5404, 0x4C03, 0x4C23, 0x5C04, // 0x0290 (656) 50 | 0x5346, 0x1082, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0xE792, 0xDF91, 0xE791, 0xE791, 0xE7B0, 0xEFF1, 0xEFD1, 0xEFD1, 0xE7B1, // 0x02A0 (672) 51 | 0xE7B1, 0xE790, 0xE790, 0xE7B0, 0xDF6F, 0xD74F, 0xD72F, 0xD72F, 0xCF0F, 0xBECE, 0xBEAE, 0xB68D, 0xB66D, 0xAE4C, 0xA60B, 0xA5EB, // 0x02B0 (688) 52 | 0x9DCA, 0x95A9, 0x9569, 0x8D68, 0x8D48, 0x8528, 0x7D07, 0x74A6, 0x74A6, 0x7486, 0x6C86, 0x6465, 0x6445, 0x6445, 0x5C24, 0x5C24, // 0x02C0 (704) 53 | 0x5C04, 0x53E4, 0x53E4, 0x5404, 0x4C05, 0x4C05, 0x53E5, 0x5327, 0x1083, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0xE792, 0xDF90, // 0x02D0 (720) 54 | 0xE790, 0xE790, 0xE7B0, 0xEFF1, 0xEFF1, 0xEFD1, 0xE7B1, 0xE7B1, 0xE7B0, 0xE7B0, 0xE7B0, 0xDF6F, 0xD74F, 0xCF2F, 0xD72F, 0xCF0E, // 0x02E0 (736) 55 | 0xBECE, 0xBEAD, 0xB66D, 0xB66D, 0xAE4C, 0xA60B, 0xA60A, 0x9DCA, 0x95A9, 0x9588, 0x8D68, 0x8D48, 0x8527, 0x7D07, 0x74C6, 0x74A5, // 0x02F0 (752) 56 | 0x6CA5, 0x6C86, 0x6465, 0x6445, 0x6444, 0x5C24, 0x5C24, 0x5C04, 0x53E4, 0x5403, 0x5404, 0x4C05, 0x4C05, 0x53E5, 0x5347, 0x1083, // 0x0300 (768) 57 | 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0xE7B2, 0xDF8F, 0xDFB0, 0xDFB0, 0xE7D0, 0xE7F0, 0xE7F0, 0xE7D0, 0xDFB0, 0xDFB0, 0xDFAF, // 0x0310 (784) 58 | 0xDFAF, 0xDFAF, 0xD78E, 0xD76E, 0xCF4E, 0xCF4E, 0xC70E, 0xBEED, 0xBECD, 0xB68C, 0xAE8C, 0xA64B, 0xA62B, 0x9E0A, 0x9DEA, 0x95C9, // 0x0320 (800) 59 | 0x8DA8, 0x8D68, 0x8568, 0x7D27, 0x7D07, 0x74C6, 0x74C5, 0x6CA5, 0x6C85, 0x6465, 0x5C44, 0x5C44, 0x5C24, 0x5C24, 0x5424, 0x5403, // 0x0330 (816) 60 | 0x5403, 0x5404, 0x4C24, 0x4C23, 0x5C04, 0x5346, 0x1082, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0xEFF3, 0xDFB1, 0xDFD1, 0xDFD1, // 0x0340 (832) 61 | 0xE7F1, 0xE7D1, 0xE7D1, 0xE7F1, 0xE7D1, 0xDFD1, 0xD790, 0xD790, 0xD790, 0xD78F, 0xCF6F, 0xCF2E, 0xCF2E, 0xC70E, 0xB6AD, 0xB68D, // 0x0350 (848) 62 | 0xAE6C, 0xA64C, 0x9E0B, 0x95CA, 0x95CA, 0x8D8A, 0x8569, 0x8548, 0x7D28, 0x7D08, 0x74E7, 0x74C7, 0x6CA6, 0x6C86, 0x6C86, 0x6466, // 0x0360 (864) 63 | 0x5C45, 0x5C25, 0x5C25, 0x5404, 0x5404, 0x53E4, 0x53E4, 0x53E4, 0x53E4, 0x5403, 0x53E3, 0x5BE2, 0x5345, 0x1082, 0x7BEF, 0x7639, // 0x0370 (880) 64 | 0x7639, 0x7BEF, 0x0000, 0xDF71, 0xD74E, 0xDF6F, 0xDF8F, 0xDF8F, 0xEFF0, 0xEFF1, 0xEFF1, 0xEFF1, 0xEFF1, 0xEFF1, 0xEFF1, 0xEFF0, // 0x0380 (896) 65 | 0xEFF0, 0xE7D0, 0xE7D0, 0xE7B0, 0xE7D0, 0xDFB0, 0xDFAF, 0xDF8F, 0xD78F, 0xD74F, 0xCF2E, 0xC70E, 0xC6ED, 0xBECD, 0xB6AC, 0xB68C, // 0x0390 (912) 66 | 0xAE6C, 0xA62B, 0x9E0A, 0x95A9, 0x95A9, 0x95A9, 0x8D68, 0x8527, 0x7D06, 0x7D06, 0x7CC6, 0x7CC6, 0x74C5, 0x74A5, 0x74A5, 0x6C64, // 0x03A0 (928) 67 | 0x6426, 0x6C26, 0x6C06, 0x6347, 0x1082, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x0000, 0xC611, 0xBDF0, 0xC610, 0xC630, 0xCE50, 0xCE51, // 0x03B0 (944) 68 | 0xCE51, 0xCE51, 0xCE51, 0xCE51, 0xD672, 0xD672, 0xD672, 0xD672, 0xD671, 0xCE71, 0xCE71, 0xCE71, 0xCE71, 0xCE51, 0xCE51, 0xCE51, // 0x03C0 (960) 69 | 0xCE51, 0xC630, 0xC630, 0xBE10, 0xB60F, 0xB5EF, 0xADCE, 0xADAE, 0xA58E, 0xA56D, 0x9D2D, 0x9D2C, 0x94EB, 0x8CCB, 0x8CAA, 0x8CAA, // 0x03D0 (976) 70 | 0x8CAA, 0x846A, 0x846A, 0x7C49, 0x7C49, 0x7C49, 0x7428, 0x63A8, 0x6BC9, 0x6B87, 0x62E9, 0x1863, 0x7BEF, 0x7639, 0x7639, 0x7BEF, // 0x03E0 (992) 71 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x03F0 (1008) 72 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0400 (1024) 73 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 0x0410 (1040) 74 | 0x0000, 0x0000, 0x0000, 0x7BEF, 0x7639, 0x7639, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, // 0x0420 (1056) 75 | 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, // 0x0430 (1072) 76 | 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, // 0x0440 (1088) 77 | 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7BEF, 0x7639, }; 78 | -------------------------------------------------------------------------------- /examples/FolderBrowser/FolderBrowser.ino: -------------------------------------------------------------------------------- 1 | // BMP-loading example specifically for the TFTLCD breakout board. 2 | // If using the Arduino shield, use the tftbmp_shield.pde sketch instead! 3 | // If using an Arduino Mega make sure to use its hardware SPI pins, OR make 4 | // sure the SD library is configured for 'soft' SPI in the file Sd2Card.h. 5 | 6 | #include // Core graphics library 7 | #include // Hardware-specific library 8 | #include 9 | #include 10 | 11 | // The control pins for the LCD can be assigned to any digital or 12 | // analog pins...but we'll use the analog pins as this allows us to 13 | // double up the pins with the touch screen (see the TFT paint example). 14 | #define LCD_CS A3 // Chip Select goes to Analog 3 15 | #define LCD_CD A2 // Command/Data goes to Analog 2 16 | #define LCD_WR A1 // LCD Write goes to Analog 1 17 | #define LCD_RD A0 // LCD Read goes to Analog 0 18 | 19 | // When using the BREAKOUT BOARD only, use these 8 data lines to the LCD: 20 | // For the Arduino Uno, Duemilanove, Diecimila, etc.: 21 | // D0 connects to digital pin 8 (Notice these are 22 | // D1 connects to digital pin 9 NOT in order!) 23 | // D2 connects to digital pin 2 24 | // D3 connects to digital pin 3 25 | // D4 connects to digital pin 4 26 | // D5 connects to digital pin 5 27 | // D6 connects to digital pin 6 28 | // D7 connects to digital pin 7 29 | // For the Arduino Mega, use digital pins 22 through 29 30 | // (on the 2-row header at the end of the board). 31 | 32 | // For Arduino Uno/Duemilanove, etc 33 | // connect the SD card with DI going to pin 11, DO going to pin 12 and SCK going to pin 13 (standard) 34 | // Then pin 10 goes to CS (or whatever you have set up) 35 | #define SD_CS 10 // Set the chip select line to whatever you use (10 doesnt conflict with the library) 36 | 37 | // In the SD card, place 24 bit color BMP files (be sure they are 24-bit!) 38 | // There are examples in the sketch folder 39 | 40 | // our TFT wiring 41 | Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, A4); 42 | 43 | void setup() 44 | { 45 | Serial.begin(9600); 46 | 47 | tft.reset(); 48 | 49 | uint16_t identifier = tft.readID(); 50 | 51 | if(identifier == 0x9325) { 52 | Serial.println(F("Found ILI9325 LCD driver")); 53 | } else if(identifier == 0x9328) { 54 | Serial.println(F("Found ILI9328 LCD driver")); 55 | } else if(identifier == 0x7575) { 56 | Serial.println(F("Found HX8347G LCD driver")); 57 | } else if(identifier == 0x9341) { 58 | Serial.println(F("Found ILI9341 LCD driver")); 59 | } else if(identifier == 0x8357) { 60 | Serial.println(F("Found HX8357D LCD driver")); 61 | } else { 62 | Serial.print(F("Unknown LCD driver chip: ")); 63 | Serial.println(identifier, HEX); 64 | Serial.println(F("If using the Adafruit 2.8\" TFT Arduino shield, the line:")); 65 | Serial.println(F(" #define USE_ADAFRUIT_SHIELD_PINOUT")); 66 | Serial.println(F("should appear in the library header (Adafruit_TFT.h).")); 67 | Serial.println(F("If using the breakout board, it should NOT be #defined!")); 68 | Serial.println(F("Also if using the breakout, double-check that all wiring")); 69 | Serial.println(F("matches the tutorial.")); 70 | return; 71 | } 72 | 73 | tft.begin(identifier); 74 | 75 | Serial.print(F("Initializing SD card...")); 76 | if (!SD.begin(SD_CS)) { 77 | Serial.println(F("failed!")); 78 | return; 79 | } 80 | Serial.println(F("OK!")); 81 | 82 | bmpDraw("woof.bmp", 0, 0); 83 | delay(1000); 84 | } 85 | 86 | void loop() 87 | { 88 | for(int i = 0; i<4; i++) { 89 | tft.setRotation(i); 90 | tft.fillScreen(0); 91 | for(int j=0; j <= 200; j += 50) { 92 | bmpDraw("miniwoof.bmp", j, j); 93 | } 94 | delay(1000); 95 | } 96 | } 97 | 98 | // This function opens a Windows Bitmap (BMP) file and 99 | // displays it at the given coordinates. It's sped up 100 | // by reading many pixels worth of data at a time 101 | // (rather than pixel by pixel). Increasing the buffer 102 | // size takes more of the Arduino's precious RAM but 103 | // makes loading a little faster. 20 pixels seems a 104 | // good balance. 105 | 106 | #define BUFFPIXEL 20 107 | 108 | void bmpDraw(char *filename, int x, int y) { 109 | 110 | File bmpFile; 111 | int bmpWidth, bmpHeight; // W+H in pixels 112 | uint8_t bmpDepth; // Bit depth (currently must be 24) 113 | uint32_t bmpImageoffset; // Start of image data in file 114 | uint32_t rowSize; // Not always = bmpWidth; may have padding 115 | uint8_t sdbuffer[3*BUFFPIXEL]; // pixel in buffer (R+G+B per pixel) 116 | uint16_t lcdbuffer[BUFFPIXEL]; // pixel out buffer (16-bit per pixel) 117 | uint8_t buffidx = sizeof(sdbuffer); // Current position in sdbuffer 118 | boolean goodBmp = false; // Set to true on valid header parse 119 | boolean flip = true; // BMP is stored bottom-to-top 120 | int w, h, row, col; 121 | uint8_t r, g, b; 122 | uint32_t pos = 0, startTime = millis(); 123 | uint8_t lcdidx = 0; 124 | boolean first = true; 125 | 126 | if((x >= tft.width()) || (y >= tft.height())) return; 127 | 128 | Serial.println(); 129 | Serial.print(F("Loading image '")); 130 | Serial.print(filename); 131 | Serial.println('\''); 132 | // Open requested file on SD card 133 | if ((bmpFile = SD.open(filename)) == NULL) { 134 | Serial.println(F("File not found")); 135 | return; 136 | } 137 | 138 | // Parse BMP header 139 | if(read16(bmpFile) == 0x4D42) { // BMP signature 140 | Serial.println(F("File size: ")); Serial.println(read32(bmpFile)); 141 | (void)read32(bmpFile); // Read & ignore creator bytes 142 | bmpImageoffset = read32(bmpFile); // Start of image data 143 | Serial.print(F("Image Offset: ")); Serial.println(bmpImageoffset, DEC); 144 | // Read DIB header 145 | Serial.print(F("Header size: ")); Serial.println(read32(bmpFile)); 146 | bmpWidth = read32(bmpFile); 147 | bmpHeight = read32(bmpFile); 148 | if(read16(bmpFile) == 1) { // # planes -- must be '1' 149 | bmpDepth = read16(bmpFile); // bits per pixel 150 | Serial.print(F("Bit Depth: ")); Serial.println(bmpDepth); 151 | if((bmpDepth == 24) && (read32(bmpFile) == 0)) { // 0 = uncompressed 152 | 153 | goodBmp = true; // Supported BMP format -- proceed! 154 | Serial.print(F("Image size: ")); 155 | Serial.print(bmpWidth); 156 | Serial.print('x'); 157 | Serial.println(bmpHeight); 158 | 159 | // BMP rows are padded (if needed) to 4-byte boundary 160 | rowSize = (bmpWidth * 3 + 3) & ~3; 161 | 162 | // If bmpHeight is negative, image is in top-down order. 163 | // This is not canon but has been observed in the wild. 164 | if(bmpHeight < 0) { 165 | bmpHeight = -bmpHeight; 166 | flip = false; 167 | } 168 | 169 | // Crop area to be loaded 170 | w = bmpWidth; 171 | h = bmpHeight; 172 | if((x+w-1) >= tft.width()) w = tft.width() - x; 173 | if((y+h-1) >= tft.height()) h = tft.height() - y; 174 | 175 | // Set TFT address window to clipped image bounds 176 | tft.setAddrWindow(x, y, x+w-1, y+h-1); 177 | 178 | for (row=0; row= sizeof(sdbuffer)) { // Indeed 197 | // Push LCD buffer to the display first 198 | if(lcdidx > 0) { 199 | tft.pushColors(lcdbuffer, lcdidx, first); 200 | lcdidx = 0; 201 | first = false; 202 | } 203 | bmpFile.read(sdbuffer, sizeof(sdbuffer)); 204 | buffidx = 0; // Set index to beginning 205 | } 206 | 207 | // Convert pixel from BMP to TFT format 208 | b = sdbuffer[buffidx++]; 209 | g = sdbuffer[buffidx++]; 210 | r = sdbuffer[buffidx++]; 211 | lcdbuffer[lcdidx++] = tft.color565(r,g,b); 212 | } // end pixel 213 | } // end scanline 214 | // Write any remaining data to LCD 215 | if(lcdidx > 0) { 216 | tft.pushColors(lcdbuffer, lcdidx, first); 217 | } 218 | Serial.print(F("Loaded in ")); 219 | Serial.print(millis() - startTime); 220 | Serial.println(" ms"); 221 | } // end goodBmp 222 | } 223 | } 224 | 225 | bmpFile.close(); 226 | if(!goodBmp) Serial.println(F("BMP format not recognized.")); 227 | } 228 | 229 | // These read 16- and 32-bit types from the SD card file. 230 | // BMP data is stored little-endian, Arduino is little-endian too. 231 | // May need to reverse subscript order if porting elsewhere. 232 | 233 | uint16_t read16(File f) { 234 | uint16_t result; 235 | ((uint8_t *)&result)[0] = f.read(); // LSB 236 | ((uint8_t *)&result)[1] = f.read(); // MSB 237 | return result; 238 | } 239 | 240 | uint32_t read32(File f) { 241 | uint32_t result; 242 | ((uint8_t *)&result)[0] = f.read(); // LSB 243 | ((uint8_t *)&result)[1] = f.read(); 244 | ((uint8_t *)&result)[2] = f.read(); 245 | ((uint8_t *)&result)[3] = f.read(); // MSB 246 | return result; 247 | } 248 | 249 | -------------------------------------------------------------------------------- /examples/bitmaps/miniwoof.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stevstrong/Adafruit_TFTLCD_16bit_STM32/39a76c6589ac3e5fff8441e3aa77a9d80dfb06f6/examples/bitmaps/miniwoof.bmp -------------------------------------------------------------------------------- /examples/bitmaps/test.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stevstrong/Adafruit_TFTLCD_16bit_STM32/39a76c6589ac3e5fff8441e3aa77a9d80dfb06f6/examples/bitmaps/test.bmp -------------------------------------------------------------------------------- /examples/bitmaps/woof.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stevstrong/Adafruit_TFTLCD_16bit_STM32/39a76c6589ac3e5fff8441e3aa77a9d80dfb06f6/examples/bitmaps/woof.bmp -------------------------------------------------------------------------------- /examples/graphicstest/graphicstest.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include // Hardware-specific library 4 | 5 | 6 | Adafruit_TFTLCD_16bit_STM32 tft; 7 | 8 | void setup(void) { 9 | Serial.begin(115200); 10 | while ( !Serial ) ; 11 | delay(1000); 12 | 13 | Serial.println(F("TFT LCD test")); 14 | 15 | Serial.print("TFT size is "); Serial.print((uint16_t)tft.width()); Serial.print("x"); Serial.println((uint16_t)tft.height()); 16 | 17 | /* 18 | pinMode(PB2, OUTPUT); 19 | while(1) { 20 | digitalWrite(PB2, HIGH); 21 | digitalWrite(PB2, LOW); 22 | } 23 | */ 24 | uint16_t identifier; 25 | #if 1 26 | identifier = 0x9341; 27 | #else 28 | tft.reset(); 29 | do { 30 | identifier = tft.readID(); 31 | if (identifier==0) identifier = 0x9341; 32 | if(identifier == 0x9325) { 33 | Serial.println(F("Found ILI9325 LCD driver")); 34 | } else if(identifier == 0x9328) { 35 | Serial.println(F("Found ILI9328 LCD driver")); 36 | } else if(identifier == 0x7575) { 37 | Serial.println(F("Found HX8347G LCD driver")); 38 | } else if(identifier == 0x9341) { 39 | Serial.println(F("Found ILI9341 LCD driver")); 40 | } else if(identifier == 0x8357) { 41 | Serial.println(F("Found HX8357D LCD driver")); 42 | } else { 43 | Serial.print(F("\n*** Unknown LCD driver chip: ")); 44 | Serial.println(identifier, HEX); 45 | //return; 46 | //identifier = 0; 47 | delay(1000); 48 | } 49 | } while (identifier==0); 50 | #endif 51 | 52 | tft.begin(identifier); 53 | Serial.println("TFT begin done."); 54 | /* 55 | // color gradient test 56 | while(1) { 57 | tft.setRotation(0); 58 | tft.fillScreen(BLACK); 59 | uint16_t x = 0, y = 10; 60 | uint8_t r=0,g=0,b=0; 61 | uint16_t color = 0; 62 | // r 63 | Serial.println("*** RED ***"); 64 | while (x0; i-=6) { 287 | i2 = i / 2; 288 | start = micros(); 289 | tft.fillRect(cx-i2, cy-i2, i, i, color1); 290 | t += micros() - start; 291 | // Outlines are not included in timing results 292 | tft.drawRect(cx-i2, cy-i2, i, i, color2); 293 | } 294 | 295 | return t; 296 | } 297 | 298 | unsigned long testFilledCircles(uint8_t radius, uint16_t color) { 299 | unsigned long start; 300 | int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2; 301 | 302 | tft.fillScreen(BLACK); 303 | start = micros(); 304 | for(x=radius; x10; i-=5) { 358 | start = micros(); 359 | tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i, 360 | tft.color565(0, i, i)); 361 | t += micros() - start; 362 | tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i, 363 | tft.color565(i, i, 0)); 364 | } 365 | 366 | return t; 367 | } 368 | 369 | unsigned long testRoundRects() { 370 | unsigned long start; 371 | int w, i, i2, 372 | cx = tft.width() / 2 - 1, 373 | cy = tft.height() / 2 - 1; 374 | 375 | tft.fillScreen(BLACK); 376 | w = min(tft.width(), tft.height()); 377 | start = micros(); 378 | for(i=0; i20; i-=6) { 395 | i2 = i / 2; 396 | tft.fillRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(0, i, 0)); 397 | } 398 | 399 | return micros() - start; 400 | } 401 | 402 | void doTest(void) 403 | { 404 | Serial.println(F("\nBenchmark Time (microseconds)")); 405 | 406 | Serial.print(F("Screen fill ")); 407 | Serial.println(testFillScreen()); 408 | delay(500); 409 | 410 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 411 | Serial.print(F("Text ")); 412 | Serial.println(testText()); 413 | delay(500); 414 | 415 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 416 | Serial.print(F("Lines ")); 417 | Serial.println(testLines(CYAN)); 418 | delay(500); 419 | 420 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 421 | Serial.print(F("Horiz/Vert Lines ")); 422 | Serial.println(testFastLines(RED, BLUE)); 423 | delay(500); 424 | 425 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 426 | Serial.print(F("Rectangles (outline) ")); 427 | Serial.println(testRects(GREEN)); 428 | delay(500); 429 | 430 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 431 | Serial.print(F("Rectangles (filled) ")); 432 | Serial.println(testFilledRects(YELLOW, MAGENTA)); 433 | delay(500); 434 | 435 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 436 | Serial.print(F("Circles (filled) ")); 437 | Serial.println(testFilledCircles(10, MAGENTA)); 438 | 439 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 440 | Serial.print(F("Circles (outline) ")); 441 | Serial.println(testCircles(10, WHITE)); 442 | delay(500); 443 | 444 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 445 | Serial.print(F("Triangles (outline) ")); 446 | Serial.println(testTriangles()); 447 | delay(500); 448 | 449 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 450 | Serial.print(F("Triangles (filled) ")); 451 | Serial.println(testFilledTriangles()); 452 | delay(500); 453 | 454 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 455 | Serial.print(F("Rounded rects (outline) ")); 456 | Serial.println(testRoundRects()); 457 | delay(500); 458 | 459 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 460 | Serial.print(F("Rounded rects (filled) ")); 461 | Serial.println(testFilledRoundRects()); 462 | delay(500); 463 | 464 | Serial.println(F("Done!")); 465 | } 466 | 467 | void loop(void) { 468 | for(uint8_t rotation=0; rotation<4; rotation++) { 469 | tft.setRotation(rotation); 470 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 471 | Serial.print("rotation: "); Serial.print(rotation); 472 | Serial.print(", runtime: "); 473 | Serial.println(testText()); 474 | delay(1000); 475 | } 476 | doTest(); 477 | } 478 | -------------------------------------------------------------------------------- /examples/graphicstest_pio/.gitignore: -------------------------------------------------------------------------------- 1 | .pioenvs 2 | .piolibdeps 3 | .clang_complete 4 | .gcc-flags.json 5 | -------------------------------------------------------------------------------- /examples/graphicstest_pio/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | graphicstest 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | 14 | 15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 16 | full,incremental, 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.cdt.core.cnature 23 | org.eclipse.cdt.core.ccnature 24 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 26 | 27 | 28 | -------------------------------------------------------------------------------- /examples/graphicstest_pio/.settings/language.settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/graphicstest_pio/.settings/org.eclipse.cdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | environment/project/0.910961921/PATH/delimiter=; 3 | environment/project/0.910961921/PATH/operation=replace 4 | environment/project/0.910961921/PATH/value=C\:\\Users\\Zo\\.platformio\\penv\\Scripts;C\:\\ProgramData\\Oracle\\Java\\javapath;C\:\\Program Files (x86)\\Intel\\iCLS Client\\;C\:\\Program Files\\Intel\\iCLS Client\\;C\:\\Windows\\system32;C\:\\Windows;C\:\\Windows\\System32\\Wbem;C\:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C\:\\Program Files (x86)\\Acer\\abFiles\\;C\:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C\:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C\:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C\:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C\:\\WINDOWS\\system32;C\:\\WINDOWS;C\:\\WINDOWS\\System32\\Wbem;C\:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C\:\\WinAVR\\bin;C\:\\WinAVR\\utils\\bin;C\:\\Program Files (x86)\\Skype\\Phone\\;C\:\\Program Files\\LLVM\\bin;C\:\\Program Files\\GPAC;C\:\\Users\\Zo\\AppData\\Local\\Microsoft\\WindowsApps;C\:\\Users\\Zo\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1;C\:\\Users\\Zo\\AppData\\Local\\atom\\bin;C\:\\ProgramData\\Oracle\\Java\\javapath;C\:\\Program Files (x86)\\Intel\\iCLS Client\\;C\:\\Program Files\\Intel\\iCLS Client\\;C\:\\Windows\\system32;C\:\\Windows;C\:\\Windows\\System32\\Wbem;C\:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C\:\\Program Files (x86)\\Acer\\abFiles\\;C\:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C\:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C\:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C\:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C\:\\WINDOWS\\system32;C\:\\WINDOWS;C\:\\WINDOWS\\System32\\Wbem;C\:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C\:\\WinAVR\\bin;C\:\\WinAVR\\utils\\bin;C\:\\Program Files (x86)\\Skype\\Phone\\;C\:\\Program Files\\LLVM\\bin;C\:\\Program Files\\GPAC;C\:\\Users\\Zo\\AppData\\Local\\Microsoft\\WindowsApps;C\:\\Users\\Zo\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1;C\:\\Users\\Zo\\AppData\\Local\\atom\\bin 5 | environment/project/0.910961921/append=true 6 | environment/project/0.910961921/appendContributed=true -------------------------------------------------------------------------------- /examples/graphicstest_pio/.travis.yml: -------------------------------------------------------------------------------- 1 | # Continuous Integration (CI) is the practice, in software 2 | # engineering, of merging all developer working copies with a shared mainline 3 | # several times a day < http://docs.platformio.org/page/ci/index.html > 4 | # 5 | # Documentation: 6 | # 7 | # * Travis CI Embedded Builds with PlatformIO 8 | # < https://docs.travis-ci.com/user/integration/platformio/ > 9 | # 10 | # * PlatformIO integration with Travis CI 11 | # < http://docs.platformio.org/page/ci/travis.html > 12 | # 13 | # * User Guide for `platformio ci` command 14 | # < http://docs.platformio.org/page/userguide/cmd_ci.html > 15 | # 16 | # 17 | # Please choice one of the following templates (proposed below) and uncomment 18 | # it (remove "# " before each line) or use own configuration according to the 19 | # Travis CI documentation (see above). 20 | # 21 | 22 | 23 | # 24 | # Template #1: General project. Test it using existing `platformio.ini`. 25 | # 26 | 27 | # language: python 28 | # python: 29 | # - "2.7" 30 | # 31 | # sudo: false 32 | # cache: 33 | # directories: 34 | # - "~/.platformio" 35 | # 36 | # install: 37 | # - pip install -U platformio 38 | # 39 | # script: 40 | # - platformio run 41 | 42 | 43 | # 44 | # Template #2: The project is intended to by used as a library with examples 45 | # 46 | 47 | # language: python 48 | # python: 49 | # - "2.7" 50 | # 51 | # sudo: false 52 | # cache: 53 | # directories: 54 | # - "~/.platformio" 55 | # 56 | # env: 57 | # - PLATFORMIO_CI_SRC=path/to/test/file.c 58 | # - PLATFORMIO_CI_SRC=examples/file.ino 59 | # - PLATFORMIO_CI_SRC=path/to/test/directory 60 | # 61 | # install: 62 | # - pip install -U platformio 63 | # 64 | # script: 65 | # - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N 66 | -------------------------------------------------------------------------------- /examples/graphicstest_pio/graphicstest.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // IMPORTANT: Adafruit_TFTLCD LIBRARY MUST BE SPECIFICALLY 4 | // CONFIGURED FOR EITHER THE TFT SHIELD OR THE BREAKOUT BOARD. 5 | // SEE RELEVANT COMMENTS IN Adafruit_TFTLCD.h FOR SETUP. 6 | 7 | #include // Hardware-specific library 8 | 9 | 10 | Adafruit_TFTLCD_16bit_STM32 tft; 11 | 12 | void setup(void) { 13 | Serial.begin(115200); 14 | //while ( !Serial.isConnected() ) ; 15 | 16 | delay(3000); 17 | 18 | Serial.println(F("TFT LCD test")); 19 | 20 | Serial.print("TFT size is "); Serial.print((uint16_t)tft.width()); Serial.print("x"); Serial.println((uint16_t)tft.height()); 21 | 22 | /* 23 | pinMode(PB2, OUTPUT); 24 | while(1) { 25 | digitalWrite(PB2, HIGH); 26 | digitalWrite(PB2, LOW); 27 | } 28 | */ 29 | uint16_t identifier; 30 | #if 1 31 | identifier = 0x9341; 32 | #else 33 | tft.reset(); 34 | do { 35 | identifier = tft.readID(); 36 | if (identifier==0) identifier = 0x9341; 37 | if(identifier == 0x9325) { 38 | Serial.println(F("Found ILI9325 LCD driver")); 39 | } else if(identifier == 0x9328) { 40 | Serial.println(F("Found ILI9328 LCD driver")); 41 | } else if(identifier == 0x7575) { 42 | Serial.println(F("Found HX8347G LCD driver")); 43 | } else if(identifier == 0x9341) { 44 | Serial.println(F("Found ILI9341 LCD driver")); 45 | } else if(identifier == 0x8357) { 46 | Serial.println(F("Found HX8357D LCD driver")); 47 | } else { 48 | Serial.print(F("\n*** Unknown LCD driver chip: ")); 49 | Serial.println(identifier, HEX); 50 | //return; 51 | //identifier = 0; 52 | delay(1000); 53 | } 54 | } while (identifier==0); 55 | #endif 56 | 57 | tft.begin(identifier); 58 | Serial.println("TFT begin done."); 59 | /* 60 | // color gradient test 61 | while(1) { 62 | tft.setRotation(0); 63 | tft.fillScreen(BLACK); 64 | uint16_t x = 0, y = 10; 65 | uint8_t r=0,g=0,b=0; 66 | uint16_t color = 0; 67 | // r 68 | Serial.println("*** RED ***"); 69 | while (x0; i-=6) { 292 | i2 = i / 2; 293 | start = micros(); 294 | tft.fillRect(cx-i2, cy-i2, i, i, color1); 295 | t += micros() - start; 296 | // Outlines are not included in timing results 297 | tft.drawRect(cx-i2, cy-i2, i, i, color2); 298 | } 299 | 300 | return t; 301 | } 302 | 303 | unsigned long testFilledCircles(uint8_t radius, uint16_t color) { 304 | unsigned long start; 305 | int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2; 306 | 307 | tft.fillScreen(BLACK); 308 | start = micros(); 309 | for(x=radius; x10; i-=5) { 363 | start = micros(); 364 | tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i, 365 | color565(0, i, i)); 366 | t += micros() - start; 367 | tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i, 368 | color565(i, i, 0)); 369 | } 370 | 371 | return t; 372 | } 373 | 374 | unsigned long testRoundRects() { 375 | unsigned long start; 376 | int w, i, i2, 377 | cx = tft.width() / 2 - 1, 378 | cy = tft.height() / 2 - 1; 379 | 380 | tft.fillScreen(BLACK); 381 | w = min(tft.width(), tft.height()); 382 | start = micros(); 383 | for(i=0; i20; i-=6) { 400 | i2 = i / 2; 401 | tft.fillRoundRect(cx-i2, cy-i2, i, i, i/8, color565(0, i, 0)); 402 | } 403 | 404 | return micros() - start; 405 | } 406 | 407 | void doTest(void) 408 | { 409 | Serial.println(F("\nBenchmark Time (microseconds)")); 410 | 411 | Serial.print(F("Screen fill ")); 412 | Serial.println(testFillScreen()); 413 | delay(500); 414 | 415 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 416 | Serial.print(F("Text ")); 417 | Serial.println(testText()); 418 | delay(500); 419 | 420 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 421 | Serial.print(F("Lines ")); 422 | Serial.println(testLines(CYAN)); 423 | delay(500); 424 | 425 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 426 | Serial.print(F("Horiz/Vert Lines ")); 427 | Serial.println(testFastLines(RED, BLUE)); 428 | delay(500); 429 | 430 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 431 | Serial.print(F("Rectangles (outline) ")); 432 | Serial.println(testRects(GREEN)); 433 | delay(500); 434 | 435 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 436 | Serial.print(F("Rectangles (filled) ")); 437 | Serial.println(testFilledRects(YELLOW, MAGENTA)); 438 | delay(500); 439 | 440 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 441 | Serial.print(F("Circles (filled) ")); 442 | Serial.println(testFilledCircles(10, MAGENTA)); 443 | 444 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 445 | Serial.print(F("Circles (outline) ")); 446 | Serial.println(testCircles(10, WHITE)); 447 | delay(500); 448 | 449 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 450 | Serial.print(F("Triangles (outline) ")); 451 | Serial.println(testTriangles()); 452 | delay(500); 453 | 454 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 455 | Serial.print(F("Triangles (filled) ")); 456 | Serial.println(testFilledTriangles()); 457 | delay(500); 458 | 459 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 460 | Serial.print(F("Rounded rects (outline) ")); 461 | Serial.println(testRoundRects()); 462 | delay(500); 463 | 464 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 465 | Serial.print(F("Rounded rects (filled) ")); 466 | Serial.println(testFilledRoundRects()); 467 | delay(500); 468 | 469 | Serial.println(F("Done!")); 470 | } 471 | 472 | void loop(void) { 473 | for(uint8_t rotation=0; rotation<4; rotation++) { 474 | tft.setRotation(rotation); 475 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 476 | Serial.print("rotation: "); Serial.print(rotation); 477 | Serial.print(", runtime: "); 478 | Serial.println(testText()); 479 | delay(1000); 480 | } 481 | doTest(); 482 | } 483 | -------------------------------------------------------------------------------- /examples/graphicstest_pio/lib/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for the project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link to executable file. 4 | 5 | The source code of each library should be placed in separate directory, like 6 | "lib/private_lib/[here are source files]". 7 | 8 | For example, see how can be organized `Foo` and `Bar` libraries: 9 | 10 | |--lib 11 | | |--Bar 12 | | | |--docs 13 | | | |--examples 14 | | | |--src 15 | | | |- Bar.c 16 | | | |- Bar.h 17 | | |--Foo 18 | | | |- Foo.c 19 | | | |- Foo.h 20 | | |- readme.txt --> THIS FILE 21 | |- platformio.ini 22 | |--src 23 | |- main.c 24 | 25 | Then in `src/main.c` you should use: 26 | 27 | #include 28 | #include 29 | 30 | // rest H/C/CPP code 31 | 32 | PlatformIO will find your libraries automatically, configure preprocessor's 33 | include paths and build them. 34 | 35 | More information about PlatformIO Library Dependency Finder 36 | - http://docs.platformio.org/page/librarymanager/ldf.html 37 | -------------------------------------------------------------------------------- /examples/graphicstest_pio/platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; http://docs.platformio.org/page/projectconf.html 10 | 11 | [env:genericSTM32F103CB] 12 | platform = ststm32 13 | board = genericSTM32F103CB 14 | framework = arduino 15 | ;build_flags = -v 16 | ;lib_extra_dirs = C:\Users\Zo\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries 17 | -------------------------------------------------------------------------------- /examples/graphicstest_pio/src/graphicstest.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // IMPORTANT: Adafruit_TFTLCD LIBRARY MUST BE SPECIFICALLY 4 | // CONFIGURED FOR EITHER THE TFT SHIELD OR THE BREAKOUT BOARD. 5 | // SEE RELEVANT COMMENTS IN Adafruit_TFTLCD.h FOR SETUP. 6 | 7 | #include // Hardware-specific library 8 | 9 | 10 | Adafruit_TFTLCD_8bit_STM32 tft; 11 | 12 | void setup(void) { 13 | Serial.begin(115200); 14 | //while ( !Serial.isConnected() ) ; 15 | 16 | delay(1000); 17 | 18 | Serial.println(F("TFT LCD test")); 19 | 20 | Serial.print("TFT size is "); Serial.print((uint16_t)tft.width()); Serial.print("x"); Serial.println((uint16_t)tft.height()); 21 | 22 | /* 23 | pinMode(PB2, OUTPUT); 24 | while(1) { 25 | digitalWrite(PB2, HIGH); 26 | digitalWrite(PB2, LOW); 27 | } 28 | */ 29 | uint16_t identifier; 30 | #if 0 31 | identifier = 0x9328; 32 | #else 33 | tft.reset(); 34 | do { 35 | identifier = tft.readID(); 36 | if (identifier==0) identifier = 0x9341; 37 | if(identifier == 0x9325) { 38 | Serial.println(F("Found ILI9325 LCD driver")); 39 | } else if(identifier == 0x9328) { 40 | Serial.println(F("Found ILI9328 LCD driver")); 41 | } else if(identifier == 0x7575) { 42 | Serial.println(F("Found HX8347G LCD driver")); 43 | } else if(identifier == 0x9341) { 44 | Serial.println(F("Found ILI9341 LCD driver")); 45 | } else if(identifier == 0x8357) { 46 | Serial.println(F("Found HX8357D LCD driver")); 47 | } else { 48 | Serial.print(F("\n*** Unknown LCD driver chip: ")); 49 | Serial.println(identifier, HEX); 50 | //return; 51 | //identifier = 0; 52 | delay(1000); 53 | } 54 | } while (identifier==0); 55 | #endif 56 | 57 | tft.begin(identifier); 58 | Serial.println("TFT begin done."); 59 | /* 60 | tft.fillScreen(BLACK); 61 | tft.fillRect(0,0,100,100,GREEN); 62 | tft.fillRect(200,200,10,10,RED); 63 | Serial.println("\nrect filled with blue."); 64 | while(1);*/ 65 | } 66 | 67 | unsigned long testFillScreen() { 68 | unsigned long start = micros(); 69 | tft.fillScreen(BLACK); 70 | tft.fillScreen(RED); 71 | tft.fillScreen(GREEN); 72 | tft.fillScreen(BLUE); 73 | tft.fillScreen(BLACK); 74 | return micros() - start; 75 | } 76 | 77 | unsigned long testText() { 78 | tft.fillScreen(BLACK); 79 | //return 0; 80 | unsigned long start = micros(); 81 | tft.setCursor(0, 0); 82 | tft.setTextColor(WHITE); tft.setTextSize(1); 83 | tft.println("Hello World!"); 84 | tft.setTextColor(YELLOW); tft.setTextSize(2); 85 | tft.println(1234.56); 86 | tft.setTextColor(RED); tft.setTextSize(3); 87 | tft.println(0xDEADBEEF, HEX); 88 | tft.println(); 89 | tft.setTextColor(GREEN); 90 | tft.setTextSize(5); 91 | tft.println("Groop"); 92 | tft.setTextSize(2); 93 | tft.println("I implore thee,"); 94 | tft.setTextSize(1); 95 | tft.println("my foonting turlingdromes."); 96 | tft.println("And hooptiously drangle me"); 97 | tft.println("with crinkly bindlewurdles,"); 98 | tft.println("Or I will rend thee"); 99 | tft.println("in the gobberwarts"); 100 | tft.println("with my blurglecruncheon,"); 101 | tft.println("see if I don't!"); 102 | return micros() - start; 103 | } 104 | 105 | unsigned long testLines(uint16_t color) { 106 | unsigned long start, t; 107 | int x1, y1, x2, y2, 108 | w = tft.width(), 109 | h = tft.height(); 110 | 111 | tft.fillScreen(BLACK); 112 | 113 | x1 = y1 = 0; 114 | y2 = h - 1; 115 | start = micros(); 116 | for(x2=0; x20; i-=6) { 194 | i2 = i / 2; 195 | start = micros(); 196 | tft.fillRect(cx-i2, cy-i2, i, i, color1); 197 | t += micros() - start; 198 | // Outlines are not included in timing results 199 | tft.drawRect(cx-i2, cy-i2, i, i, color2); 200 | } 201 | 202 | return t; 203 | } 204 | 205 | unsigned long testFilledCircles(uint8_t radius, uint16_t color) { 206 | unsigned long start; 207 | int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2; 208 | 209 | tft.fillScreen(BLACK); 210 | start = micros(); 211 | for(x=radius; x10; i-=5) { 265 | start = micros(); 266 | tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i, 267 | color565(0, i, i)); 268 | t += micros() - start; 269 | tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i, 270 | color565(i, i, 0)); 271 | } 272 | 273 | return t; 274 | } 275 | 276 | unsigned long testRoundRects() { 277 | unsigned long start; 278 | int w, i, i2, 279 | cx = tft.width() / 2 - 1, 280 | cy = tft.height() / 2 - 1; 281 | 282 | tft.fillScreen(BLACK); 283 | w = min(tft.width(), tft.height()); 284 | start = micros(); 285 | for(i=0; i20; i-=6) { 302 | i2 = i / 2; 303 | tft.fillRoundRect(cx-i2, cy-i2, i, i, i/8, color565(0, i, 0)); 304 | } 305 | 306 | return micros() - start; 307 | } 308 | 309 | void doTest(void) 310 | { 311 | Serial.println(F("\nBenchmark Time (microseconds)")); 312 | 313 | Serial.print(F("Screen fill ")); 314 | Serial.println(testFillScreen()); 315 | delay(500); 316 | 317 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 318 | Serial.print(F("Text ")); 319 | Serial.println(testText()); 320 | delay(500); 321 | 322 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 323 | Serial.print(F("Lines ")); 324 | Serial.println(testLines(CYAN)); 325 | delay(500); 326 | 327 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 328 | Serial.print(F("Horiz/Vert Lines ")); 329 | Serial.println(testFastLines(RED, BLUE)); 330 | delay(500); 331 | 332 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 333 | Serial.print(F("Rectangles (outline) ")); 334 | Serial.println(testRects(GREEN)); 335 | delay(500); 336 | 337 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 338 | Serial.print(F("Rectangles (filled) ")); 339 | Serial.println(testFilledRects(YELLOW, MAGENTA)); 340 | delay(500); 341 | 342 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 343 | Serial.print(F("Circles (filled) ")); 344 | Serial.println(testFilledCircles(10, MAGENTA)); 345 | 346 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 347 | Serial.print(F("Circles (outline) ")); 348 | Serial.println(testCircles(10, WHITE)); 349 | delay(500); 350 | 351 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 352 | Serial.print(F("Triangles (outline) ")); 353 | Serial.println(testTriangles()); 354 | delay(500); 355 | 356 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 357 | Serial.print(F("Triangles (filled) ")); 358 | Serial.println(testFilledTriangles()); 359 | delay(500); 360 | 361 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 362 | Serial.print(F("Rounded rects (outline) ")); 363 | Serial.println(testRoundRects()); 364 | delay(500); 365 | 366 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 367 | Serial.print(F("Rounded rects (filled) ")); 368 | Serial.println(testFilledRoundRects()); 369 | delay(500); 370 | 371 | Serial.println(F("Done!")); 372 | } 373 | 374 | void loop(void) { 375 | for(uint8_t rotation=0; rotation<4; rotation++) { 376 | tft.setRotation(rotation); 377 | //Serial.print("ID: "); Serial.println(tft.readID(),HEX); 378 | Serial.print("rotation: "); Serial.print(rotation); 379 | Serial.print(", runtime: "); 380 | Serial.println(testText()); 381 | delay(1000); 382 | } 383 | doTest(); 384 | } 385 | 386 | 387 | -------------------------------------------------------------------------------- /examples/rotationtest/rotationtest.ino: -------------------------------------------------------------------------------- 1 | // IMPORTANT: Adafruit_TFTLCD LIBRARY MUST BE SPECIFICALLY 2 | // CONFIGURED FOR EITHER THE TFT SHIELD OR THE BREAKOUT BOARD. 3 | // SEE RELEVANT COMMENTS IN Adafruit_TFTLCD.h FOR SETUP. 4 | 5 | #include // Core graphics library 6 | #include // Hardware-specific library 7 | 8 | // check the pin connections in the header file. 9 | 10 | // Assign human-readable names to some common 16-bit color values: 11 | #define BLACK 0x0000 12 | #define BLUE 0x001F 13 | #define RED 0xF800 14 | #define GREEN 0x07E0 15 | #define CYAN 0x07FF 16 | #define MAGENTA 0xF81F 17 | #define YELLOW 0xFFE0 18 | #define WHITE 0xFFFF 19 | 20 | 21 | Adafruit_TFTLCD_8bit_STM32 tft; 22 | 23 | 24 | void setup(void) { 25 | Serial.begin(9600); 26 | delay(6000); 27 | Serial.println(F("TFT LCD test")); 28 | 29 | #ifdef USE_ADAFRUIT_SHIELD_PINOUT 30 | Serial.println(F("Using Adafruit 2.8\" TFT Arduino Shield Pinout")); 31 | #else 32 | Serial.println(F("Using Adafruit 2.8\" TFT Breakout Board Pinout")); 33 | #endif 34 | 35 | tft.reset(); 36 | 37 | uint16_t identifier = tft.readID(); 38 | 39 | if(identifier == 0x9325) { 40 | Serial.println(F("Found ILI9325 LCD driver")); 41 | } else if(identifier == 0x9328) { 42 | Serial.println(F("Found ILI9328 LCD driver")); 43 | } else if(identifier == 0x7575) { 44 | Serial.println(F("Found HX8347G LCD driver")); 45 | } else if(identifier == 0x9341) { 46 | Serial.println(F("Found ILI9341 LCD driver")); 47 | } else if(identifier == 0x8357) { 48 | Serial.println(F("Found HX8357D LCD driver")); 49 | } else { 50 | Serial.print(F("Unknown LCD driver chip: ")); 51 | Serial.println(identifier, HEX); 52 | Serial.println(F("If using the Adafruit 2.8\" TFT Arduino shield, the line:")); 53 | Serial.println(F(" #define USE_ADAFRUIT_SHIELD_PINOUT")); 54 | Serial.println(F("should appear in the library header (Adafruit_TFT.h).")); 55 | Serial.println(F("If using the breakout board, it should NOT be #defined!")); 56 | Serial.println(F("Also if using the breakout, double-check that all wiring")); 57 | Serial.println(F("matches the tutorial.")); 58 | return; 59 | } 60 | 61 | tft.begin(identifier); 62 | 63 | tft.fillScreen(BLACK); 64 | 65 | Serial.println(F("This is a test of the rotation capabilities of the TFT library!")); 66 | Serial.println(F("Press (or type a character) to advance")); 67 | } 68 | 69 | void loop(void) { 70 | rotatePixel(); 71 | rotateLine(); 72 | rotateFastline(); 73 | rotateDrawrect(); 74 | rotateFillrect(); 75 | rotateDrawcircle(); 76 | rotateFillcircle(); 77 | rotateText(); 78 | } 79 | 80 | void rotateText() { 81 | for (uint8_t i=0; i<4; i++) { 82 | tft.fillScreen(BLACK); 83 | Serial.println(tft.getRotation(), DEC); 84 | 85 | tft.setCursor(0, 30); 86 | tft.setTextColor(RED); 87 | tft.setTextSize(1); 88 | tft.println("Hello World!"); 89 | tft.setTextColor(YELLOW); 90 | tft.setTextSize(2); 91 | tft.println("Hello World!"); 92 | tft.setTextColor(GREEN); 93 | tft.setTextSize(3); 94 | tft.println("Hello World!"); 95 | tft.setTextColor(BLUE); 96 | tft.setTextSize(4); 97 | tft.print(1234.567); 98 | 99 | while (!Serial.available()); 100 | Serial.read(); Serial.read(); Serial.read(); 101 | 102 | tft.setRotation(tft.getRotation()+1); 103 | } 104 | } 105 | 106 | void rotateFillcircle(void) { 107 | for (uint8_t i=0; i<4; i++) { 108 | tft.fillScreen(BLACK); 109 | Serial.println(tft.getRotation(), DEC); 110 | 111 | tft.fillCircle(10, 30, 10, YELLOW); 112 | 113 | while (!Serial.available()); 114 | Serial.read(); Serial.read(); Serial.read(); 115 | 116 | tft.setRotation(tft.getRotation()+1); 117 | } 118 | } 119 | 120 | void rotateDrawcircle(void) { 121 | for (uint8_t i=0; i<4; i++) { 122 | tft.fillScreen(BLACK); 123 | Serial.println(tft.getRotation(), DEC); 124 | 125 | tft.drawCircle(10, 30, 10, YELLOW); 126 | 127 | while (!Serial.available()); 128 | Serial.read(); Serial.read(); Serial.read(); 129 | 130 | tft.setRotation(tft.getRotation()+1); 131 | } 132 | } 133 | 134 | void rotateFillrect(void) { 135 | for (uint8_t i=0; i<4; i++) { 136 | tft.fillScreen(BLACK); 137 | Serial.println(tft.getRotation(), DEC); 138 | 139 | tft.fillRect(10, 20, 10, 20, GREEN); 140 | 141 | while (!Serial.available()); 142 | Serial.read(); Serial.read(); Serial.read(); 143 | 144 | tft.setRotation(tft.getRotation()+1); 145 | } 146 | } 147 | 148 | void rotateDrawrect(void) { 149 | for (uint8_t i=0; i<4; i++) { 150 | tft.fillScreen(BLACK); 151 | Serial.println(tft.getRotation(), DEC); 152 | 153 | tft.drawRect(10, 20, 10, 20, GREEN); 154 | 155 | while (!Serial.available()); 156 | Serial.read(); Serial.read(); Serial.read(); 157 | 158 | tft.setRotation(tft.getRotation()+1); 159 | } 160 | } 161 | 162 | void rotateFastline(void) { 163 | for (uint8_t i=0; i<4; i++) { 164 | tft.fillScreen(BLACK); 165 | Serial.println(tft.getRotation(), DEC); 166 | 167 | tft.drawFastHLine(0, 20, tft.width(), RED); 168 | tft.drawFastVLine(20, 0, tft.height(), BLUE); 169 | 170 | while (!Serial.available()); 171 | Serial.read(); Serial.read(); Serial.read(); 172 | 173 | tft.setRotation(tft.getRotation()+1); 174 | } 175 | } 176 | 177 | void rotateLine(void) { 178 | for (uint8_t i=0; i<4; i++) { 179 | tft.fillScreen(BLACK); 180 | Serial.println(tft.getRotation(), DEC); 181 | 182 | tft.drawLine(tft.width()/2, tft.height()/2, 0, 0, RED); 183 | while (!Serial.available()); 184 | Serial.read(); Serial.read(); Serial.read(); 185 | 186 | tft.setRotation(tft.getRotation()+1); 187 | } 188 | } 189 | 190 | void rotatePixel(void) { 191 | for (uint8_t i=0; i<4; i++) { 192 | tft.fillScreen(BLACK); 193 | Serial.println(tft.getRotation(), DEC); 194 | 195 | tft.drawPixel(10,20, RED); 196 | while (!Serial.available()); 197 | Serial.read(); Serial.read(); Serial.read(); 198 | 199 | tft.setRotation(tft.getRotation()+1); 200 | } 201 | } 202 | 203 | -------------------------------------------------------------------------------- /examples/tftbmp/tftbmp.ino: -------------------------------------------------------------------------------- 1 | // BMP-loading example specifically for the TFTLCD breakout board. 2 | // If using the Arduino shield, use the tftbmp_shield.pde sketch instead! 3 | // If using an Arduino Mega make sure to use its hardware SPI pins, OR make 4 | // sure the SD library is configured for 'soft' SPI in the file Sd2Card.h. 5 | 6 | #include // Core graphics library 7 | #include // Hardware-specific library 8 | #include 9 | #include 10 | 11 | // The control pins for the LCD can be assigned to any digital or 12 | // analog pins...but we'll use the analog pins as this allows us to 13 | // double up the pins with the touch screen (see the TFT paint example). 14 | #define LCD_CS A3 // Chip Select goes to Analog 3 15 | #define LCD_CD A2 // Command/Data goes to Analog 2 16 | #define LCD_WR A1 // LCD Write goes to Analog 1 17 | #define LCD_RD A0 // LCD Read goes to Analog 0 18 | 19 | // When using the BREAKOUT BOARD only, use these 8 data lines to the LCD: 20 | // For the Arduino Uno, Duemilanove, Diecimila, etc.: 21 | // D0 connects to digital pin 8 (Notice these are 22 | // D1 connects to digital pin 9 NOT in order!) 23 | // D2 connects to digital pin 2 24 | // D3 connects to digital pin 3 25 | // D4 connects to digital pin 4 26 | // D5 connects to digital pin 5 27 | // D6 connects to digital pin 6 28 | // D7 connects to digital pin 7 29 | // For the Arduino Mega, use digital pins 22 through 29 30 | // (on the 2-row header at the end of the board). 31 | 32 | // For Arduino Uno/Duemilanove, etc 33 | // connect the SD card with DI going to pin 11, DO going to pin 12 and SCK going to pin 13 (standard) 34 | // Then pin 10 goes to CS (or whatever you have set up) 35 | #define SD_CS 10 // Set the chip select line to whatever you use (10 doesnt conflict with the library) 36 | 37 | // In the SD card, place 24 bit color BMP files (be sure they are 24-bit!) 38 | // There are examples in the sketch folder 39 | 40 | // our TFT wiring 41 | Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, A4); 42 | 43 | void setup() 44 | { 45 | Serial.begin(9600); 46 | 47 | tft.reset(); 48 | 49 | uint16_t identifier = tft.readID(); 50 | 51 | if(identifier == 0x9325) { 52 | Serial.println(F("Found ILI9325 LCD driver")); 53 | } else if(identifier == 0x9328) { 54 | Serial.println(F("Found ILI9328 LCD driver")); 55 | } else if(identifier == 0x7575) { 56 | Serial.println(F("Found HX8347G LCD driver")); 57 | } else if(identifier == 0x9341) { 58 | Serial.println(F("Found ILI9341 LCD driver")); 59 | } else if(identifier == 0x8357) { 60 | Serial.println(F("Found HX8357D LCD driver")); 61 | } else { 62 | Serial.print(F("Unknown LCD driver chip: ")); 63 | Serial.println(identifier, HEX); 64 | Serial.println(F("If using the Adafruit 2.8\" TFT Arduino shield, the line:")); 65 | Serial.println(F(" #define USE_ADAFRUIT_SHIELD_PINOUT")); 66 | Serial.println(F("should appear in the library header (Adafruit_TFT.h).")); 67 | Serial.println(F("If using the breakout board, it should NOT be #defined!")); 68 | Serial.println(F("Also if using the breakout, double-check that all wiring")); 69 | Serial.println(F("matches the tutorial.")); 70 | return; 71 | } 72 | 73 | tft.begin(identifier); 74 | 75 | Serial.print(F("Initializing SD card...")); 76 | if (!SD.begin(SD_CS)) { 77 | Serial.println(F("failed!")); 78 | return; 79 | } 80 | Serial.println(F("OK!")); 81 | 82 | bmpDraw("woof.bmp", 0, 0); 83 | delay(1000); 84 | } 85 | 86 | void loop() 87 | { 88 | for(int i = 0; i<4; i++) { 89 | tft.setRotation(i); 90 | tft.fillScreen(0); 91 | for(int j=0; j <= 200; j += 50) { 92 | bmpDraw("miniwoof.bmp", j, j); 93 | } 94 | delay(1000); 95 | } 96 | } 97 | 98 | // This function opens a Windows Bitmap (BMP) file and 99 | // displays it at the given coordinates. It's sped up 100 | // by reading many pixels worth of data at a time 101 | // (rather than pixel by pixel). Increasing the buffer 102 | // size takes more of the Arduino's precious RAM but 103 | // makes loading a little faster. 20 pixels seems a 104 | // good balance. 105 | 106 | #define BUFFPIXEL 20 107 | 108 | void bmpDraw(char *filename, int x, int y) { 109 | 110 | File bmpFile; 111 | int bmpWidth, bmpHeight; // W+H in pixels 112 | uint8_t bmpDepth; // Bit depth (currently must be 24) 113 | uint32_t bmpImageoffset; // Start of image data in file 114 | uint32_t rowSize; // Not always = bmpWidth; may have padding 115 | uint8_t sdbuffer[3*BUFFPIXEL]; // pixel in buffer (R+G+B per pixel) 116 | uint16_t lcdbuffer[BUFFPIXEL]; // pixel out buffer (16-bit per pixel) 117 | uint8_t buffidx = sizeof(sdbuffer); // Current position in sdbuffer 118 | boolean goodBmp = false; // Set to true on valid header parse 119 | boolean flip = true; // BMP is stored bottom-to-top 120 | int w, h, row, col; 121 | uint8_t r, g, b; 122 | uint32_t pos = 0, startTime = millis(); 123 | uint8_t lcdidx = 0; 124 | boolean first = true; 125 | 126 | if((x >= tft.width()) || (y >= tft.height())) return; 127 | 128 | Serial.println(); 129 | Serial.print(F("Loading image '")); 130 | Serial.print(filename); 131 | Serial.println('\''); 132 | // Open requested file on SD card 133 | if ((bmpFile = SD.open(filename)) == NULL) { 134 | Serial.println(F("File not found")); 135 | return; 136 | } 137 | 138 | // Parse BMP header 139 | if(read16(bmpFile) == 0x4D42) { // BMP signature 140 | Serial.println(F("File size: ")); Serial.println(read32(bmpFile)); 141 | (void)read32(bmpFile); // Read & ignore creator bytes 142 | bmpImageoffset = read32(bmpFile); // Start of image data 143 | Serial.print(F("Image Offset: ")); Serial.println(bmpImageoffset, DEC); 144 | // Read DIB header 145 | Serial.print(F("Header size: ")); Serial.println(read32(bmpFile)); 146 | bmpWidth = read32(bmpFile); 147 | bmpHeight = read32(bmpFile); 148 | if(read16(bmpFile) == 1) { // # planes -- must be '1' 149 | bmpDepth = read16(bmpFile); // bits per pixel 150 | Serial.print(F("Bit Depth: ")); Serial.println(bmpDepth); 151 | if((bmpDepth == 24) && (read32(bmpFile) == 0)) { // 0 = uncompressed 152 | 153 | goodBmp = true; // Supported BMP format -- proceed! 154 | Serial.print(F("Image size: ")); 155 | Serial.print(bmpWidth); 156 | Serial.print('x'); 157 | Serial.println(bmpHeight); 158 | 159 | // BMP rows are padded (if needed) to 4-byte boundary 160 | rowSize = (bmpWidth * 3 + 3) & ~3; 161 | 162 | // If bmpHeight is negative, image is in top-down order. 163 | // This is not canon but has been observed in the wild. 164 | if(bmpHeight < 0) { 165 | bmpHeight = -bmpHeight; 166 | flip = false; 167 | } 168 | 169 | // Crop area to be loaded 170 | w = bmpWidth; 171 | h = bmpHeight; 172 | if((x+w-1) >= tft.width()) w = tft.width() - x; 173 | if((y+h-1) >= tft.height()) h = tft.height() - y; 174 | 175 | // Set TFT address window to clipped image bounds 176 | tft.setAddrWindow(x, y, x+w-1, y+h-1); 177 | 178 | for (row=0; row= sizeof(sdbuffer)) { // Indeed 197 | // Push LCD buffer to the display first 198 | if(lcdidx > 0) { 199 | tft.pushColors(lcdbuffer, lcdidx, first); 200 | lcdidx = 0; 201 | first = false; 202 | } 203 | bmpFile.read(sdbuffer, sizeof(sdbuffer)); 204 | buffidx = 0; // Set index to beginning 205 | } 206 | 207 | // Convert pixel from BMP to TFT format 208 | b = sdbuffer[buffidx++]; 209 | g = sdbuffer[buffidx++]; 210 | r = sdbuffer[buffidx++]; 211 | lcdbuffer[lcdidx++] = tft.color565(r,g,b); 212 | } // end pixel 213 | } // end scanline 214 | // Write any remaining data to LCD 215 | if(lcdidx > 0) { 216 | tft.pushColors(lcdbuffer, lcdidx, first); 217 | } 218 | Serial.print(F("Loaded in ")); 219 | Serial.print(millis() - startTime); 220 | Serial.println(" ms"); 221 | } // end goodBmp 222 | } 223 | } 224 | 225 | bmpFile.close(); 226 | if(!goodBmp) Serial.println(F("BMP format not recognized.")); 227 | } 228 | 229 | // These read 16- and 32-bit types from the SD card file. 230 | // BMP data is stored little-endian, Arduino is little-endian too. 231 | // May need to reverse subscript order if porting elsewhere. 232 | 233 | uint16_t read16(File f) { 234 | uint16_t result; 235 | ((uint8_t *)&result)[0] = f.read(); // LSB 236 | ((uint8_t *)&result)[1] = f.read(); // MSB 237 | return result; 238 | } 239 | 240 | uint32_t read32(File f) { 241 | uint32_t result; 242 | ((uint8_t *)&result)[0] = f.read(); // LSB 243 | ((uint8_t *)&result)[1] = f.read(); 244 | ((uint8_t *)&result)[2] = f.read(); 245 | ((uint8_t *)&result)[3] = f.read(); // MSB 246 | return result; 247 | } 248 | 249 | -------------------------------------------------------------------------------- /examples/tftpaint/tftpaint.in_: -------------------------------------------------------------------------------- 1 | // Paint example specifically for the TFTLCD breakout board. 2 | // If using the Arduino shield, use the tftpaint_shield.pde sketch instead! 3 | // DOES NOT CURRENTLY WORK ON ARDUINO LEONARDO 4 | 5 | #include // Core graphics library 6 | //#include "Adafruit_ILI9341_8bit_STM.h" 7 | #include // Hardware-specific library 8 | //#include 9 | 10 | #include 11 | 12 | /*****************************************************************************/ 13 | #define LED_PIN PC13 14 | // Assign human-readable names to some common 16-bit color values: 15 | #define BLACK 0x0000 16 | #define BLUE 0x001F 17 | #define RED 0xF800 18 | #define GREEN 0x07E0 19 | #define CYAN 0x07FF 20 | #define MAGENTA 0xF81F 21 | #define YELLOW 0xFFE0 22 | #define WHITE 0xFFFF 23 | 24 | Adafruit_TFTLCD_8bit_STM32 tft; 25 | int counter; 26 | 27 | /*****************************************************************************/ 28 | void setup() 29 | { 30 | counter = 0; 31 | pinMode(LED_PIN, OUTPUT); 32 | 33 | Serial.begin(115200); 34 | delay(6000); 35 | SPI.begin(); 36 | SPI.setDataMode(SPI_MODE0); 37 | SPI.setBitOrder(MSBFIRST); 38 | 39 | tft.reset(); 40 | uint16_t identifier = tft.readID(); 41 | if(identifier == 0x9325) { 42 | Serial.println(F("Found ILI9325 LCD driver")); 43 | } else if(identifier == 0x9328) { 44 | Serial.println(F("Found ILI9328 LCD driver")); 45 | } else if(identifier == 0x7575) { 46 | Serial.println(F("Found HX8347G LCD driver")); 47 | } else if(identifier == 0x9341) { 48 | Serial.println(F("Found ILI9341 LCD driver")); 49 | } else if(identifier == 0x8357) { 50 | Serial.println(F("Found HX8357D LCD driver")); 51 | } else { 52 | Serial.print(F("Unknown LCD driver chip: ")); 53 | Serial.println(identifier, HEX); 54 | while(1); //halt 55 | } 56 | 57 | tft.begin(identifier); 58 | //tft.begin(); 59 | 60 | tft.setRotation(2); 61 | tft.fillScreen(BLACK); 62 | tft.setCursor(30 , 30); 63 | tft.setTextColor(WHITE); 64 | tft.setTextSize(3); 65 | tft.println("test"); 66 | tft.setTextSize(1); 67 | tft.setCursor(55 , 20); 68 | tft.println("test"); 69 | 70 | } 71 | 72 | /*****************************************************************************/ 73 | void loop() 74 | { 75 | Serial.println(counter++); 76 | 77 | digitalWrite(LED_PIN, HIGH); 78 | delay(1000); 79 | digitalWrite(LED_PIN, LOW); 80 | delay(1000); 81 | } 82 | -------------------------------------------------------------------------------- /examples/tftpaint/tftpaint.ino: -------------------------------------------------------------------------------- 1 | // Paint example for a LCD board with touch screen. 2 | // Includes touch calibration feature. 3 | // Uses simple touch to select point, colour. 4 | // Uses double click/touch to clear the background in selected colour. 5 | // Uses double click/touch to set paint radius back to original value. 6 | 7 | #include // Core graphics library 8 | #include // Hardware-specific library 9 | #include 10 | 11 | 12 | // Assign human-readable names to some common 16-bit color values: 13 | #define BLACK 0x0000 14 | #define BLUE 0x001F 15 | #define RED 0xF800 16 | #define GREEN 0x07E0 17 | #define CYAN 0x07FF 18 | #define MAGENTA 0xF81F 19 | #define YELLOW 0xFFE0 20 | #define WHITE 0xFFFF 21 | 22 | #define LED_PIN PC13 23 | 24 | Adafruit_TFTLCD_8bit_STM32 tft; 25 | 26 | #define BOX_X 30 27 | #define BOX_Y 40 28 | 29 | int penradius; 30 | 31 | // test colours 32 | #define X_WHITE 0 33 | #define X_YELLOW (BOX_X) 34 | #define X_CYAN (BOX_X*2) 35 | #define X_GREEN (BOX_X*3) 36 | #define X_MAGENTA (BOX_X*4) 37 | #define X_RED (BOX_X*5) 38 | #define X_BLUE (BOX_X*6) 39 | #define X_BLACK (BOX_X*7) 40 | 41 | int oldcolor, currentcolor; 42 | int old_x, current_x; 43 | /* 44 | #define TFT_RD PA0 45 | #define TFT_WR PA1 46 | #define TFT_RS PA2 47 | #define TFT_CS PA3 48 | */ 49 | // overlaping: 50 | #define XM TFT_RS // 330 Ohm // must be an analog pin !!! 51 | #define YP TFT_CS // 500 Ohm // must be an analog pin !!! 52 | #define XP PB0 //TFT_D0 // 330 Ohm // can be a digital pin 53 | #define YM PB1 //TFT_D1 // 500 Ohm // can be a digital pin 54 | 55 | TouchScreen ts = TouchScreen(XP, YP, XM, YM); 56 | 57 | /*****************************************************************************/ 58 | void setup(void) 59 | { 60 | Serial.begin(115200); 61 | 62 | //delay(6000); // allow time for OS to enumerate USB as COM port 63 | 64 | Serial.print("\n*** Paint demo with easy touch calibration process ***\n"); 65 | 66 | uint16_t identifier = 0; 67 | do { 68 | tft.reset(); 69 | identifier = tft.readID(); 70 | if(identifier == 0x9325) { 71 | Serial.println(F("Found ILI9325 LCD driver")); 72 | } else if(identifier == 0x9328) { 73 | Serial.println(F("Found ILI9328 LCD driver")); 74 | } else if(identifier == 0x7575) { 75 | Serial.println(F("Found HX8347G LCD driver")); 76 | } else if(identifier == 0x9341) { 77 | Serial.println(F("Found ILI9341 LCD driver")); 78 | } else if(identifier == 0x8357) { 79 | Serial.println(F("Found HX8357D LCD driver")); 80 | } else { 81 | Serial.print(F("Unknown LCD driver chip: ")); 82 | Serial.println(identifier, HEX); 83 | identifier = 0; 84 | } 85 | delay(200); 86 | } while (identifier == 0); 87 | 88 | tft.begin(identifier); 89 | 90 | // Touch screen range setting 91 | // set display X and Y range of the display screen 92 | // the returned coordinates will be automatically mapped to these values. 93 | // If this is not used, the default values form the header file are used. 94 | ts.rangeSet(TFTWIDTH, TFTHEIGHT); 95 | 96 | 97 | // Calibration 98 | // needs sequentially touching two, diagonally opposite corners (check serial output!) 99 | // the touching can include small circular movements around the corners 100 | // it will keep calibrating the corner as long as pressure is applied 101 | tft.fillScreen(WHITE); 102 | tft.setCursor(0, 30); 103 | tft.setTextColor(BLACK); tft.setTextSize(1); 104 | tft.println("Calibration"); 105 | tft.println("Press one corner..."); 106 | Serial.println("Calibrating the touch surface"); 107 | Serial.print("> please press one corner..."); 108 | tft.fillRect(244, 0, 5, 5, GREEN); 109 | ts.calibratePoint(); 110 | tft.fillRect(244, 0, 5, 5, BLUE); 111 | delay(1000); 112 | tft.println("Now press the opposite corner..."); 113 | Serial.print("ok.\n> and now press the diagonally opposite corner..."); 114 | tft.fillRect(0, 314, 5, 5, GREEN); 115 | ts.calibratePoint(); 116 | tft.setTextSize(2); 117 | tft.setCursor(0, 200); 118 | tft.println("Calibration done."); 119 | Serial.println("ok.\nCalibration done."); 120 | tft.fillRect(0, 314, 5, 5, BLUE); 121 | 122 | delay(1000); 123 | 124 | tft.fillScreen(BLACK); 125 | // display test color boxes 126 | tft.fillRect(X_WHITE, 0, BOX_X, BOX_Y, WHITE); 127 | tft.fillRect(X_YELLOW, 0, BOX_X, BOX_Y, YELLOW); 128 | tft.fillRect(X_CYAN, 0, BOX_X, BOX_Y, CYAN); 129 | tft.fillRect(X_GREEN, 0, BOX_X, BOX_Y, GREEN); 130 | tft.fillRect(X_MAGENTA, 0, BOX_X, BOX_Y, MAGENTA); 131 | tft.fillRect(X_RED, 0, BOX_X, BOX_Y, RED); 132 | tft.fillRect(X_BLUE, 0, BOX_X, BOX_Y, BLUE); 133 | tft.fillRect(X_BLACK, 0, BOX_X, BOX_Y, BLACK); 134 | 135 | currentcolor = oldcolor = WHITE; 136 | current_x = old_x = X_WHITE; 137 | tft.drawRect(X_WHITE, 0, BOX_X, BOX_Y, BLACK); // box selection 138 | penradius = 3; 139 | 140 | pinMode(LED_PIN, OUTPUT); 141 | } 142 | 143 | #define PAINT_MARGIN 10 144 | 145 | void loop() 146 | { 147 | TSPoint p; // a point object holds x, y and z coordinates 148 | 149 | // check for valid touch 150 | if ( ts.getPoint(&p) ) { // returns 'true' if touch is detected, otherwise 'false' 151 | digitalWrite(LED_PIN, LOW); 152 | // the coordinates will be mapped to the set display ranges by using 'rangeSet()' in setup 153 | // x, y (in pixels) can be directly used for display routines! 154 | if (p.y < BOX_Y) { 155 | // colour selection area 156 | // recover old box frame 157 | tft.drawRect(old_x, 0, BOX_X, BOX_Y, oldcolor); 158 | // draw white box frame for the new colour 159 | if (p.x > X_BLACK) { 160 | currentcolor = BLACK; 161 | current_x = X_BLACK; 162 | } else if (p.x > X_BLUE) { 163 | currentcolor = BLUE; 164 | current_x = X_BLUE; 165 | } else if (p.x > X_RED) { 166 | currentcolor = RED; 167 | current_x = X_RED; 168 | } else if (p.x > X_MAGENTA) { 169 | currentcolor = MAGENTA; 170 | current_x = X_MAGENTA; 171 | } else if (p.x > X_GREEN) { 172 | currentcolor = GREEN; 173 | current_x = X_GREEN; 174 | } else if (p.x > X_CYAN) { 175 | currentcolor = CYAN; 176 | current_x = X_CYAN; 177 | } else if (p.x > X_YELLOW) { 178 | currentcolor = YELLOW; 179 | current_x = X_YELLOW; 180 | } else if (p.x > X_WHITE) { 181 | currentcolor = WHITE; 182 | current_x = X_WHITE; 183 | } 184 | tft.drawRect(current_x, 0, BOX_X, BOX_Y, (currentcolor^0xFFFF)); 185 | 186 | if (p.dbl) { 187 | // set background of the painting area with current colour 188 | tft.fillRect(0, BOX_Y+PAINT_MARGIN, TFTWIDTH, TFTHEIGHT-BOX_Y-PAINT_MARGIN, currentcolor); 189 | penradius = 3; 190 | } 191 | 192 | oldcolor = currentcolor; 193 | old_x = current_x; 194 | 195 | } else 196 | // check point position, repetition and double click 197 | if (((p.y-penradius) > (BOX_Y+PAINT_MARGIN)) && ((p.y+penradius) < tft.height())) { 198 | // painting area 199 | if (p.dbl) penradius = 3; // reset pen radius to default value 200 | else if (penradiusMODER , HEX); 34 | Serial.print("PUPDR: "); Serial.println(dataRegs->PUPDR , HEX); 35 | Serial.print("OSPEEDR: "); Serial.println(dataRegs->OSPEEDR, HEX); 36 | Serial.print("OTYPER: "); Serial.println(dataRegs->OTYPER , HEX); 37 | Serial.println("testing TFT data pins..."); 38 | uint16_t c = 0; 39 | while(1) { 40 | write16(c); 41 | c++; 42 | //RD_ACTIVE; 43 | //RD_IDLE; 44 | CD_COMMAND; 45 | CD_DATA; 46 | CS_ACTIVE; 47 | CS_IDLE; 48 | RST_ACTIVE; 49 | RST_IDLE; 50 | } 51 | */ 52 | if ((id == 0x9325) || (id == 0x9328)) { 53 | driver = ID_932X; 54 | ili932x_begin(); 55 | } else if (id == 0x9341) { 56 | driver = ID_9341; 57 | ili9341_begin(); 58 | } else if (id == 0x8357) { 59 | // HX8357D 60 | driver = ID_HX8357D; 61 | hx8357x_begin(); 62 | } else if(id == 0x7575) { 63 | driver = ID_7575; 64 | hx8347g_begin(); 65 | } else { 66 | driver = ID_UNKNOWN; 67 | } 68 | } 69 | 70 | /*****************************************************************************/ 71 | void Adafruit_TFTLCD_16bit_STM32::reset(void) 72 | { 73 | #ifdef USE_FSMC 74 | fsmc_lcd_init(); 75 | #else 76 | ctrl_port = &(TFT_CNTRL_PORT->regs->BSRR); 77 | data_port = &(TFT_DATA_PORT->regs->ODR); 78 | wr_bitmask = digitalPinToBitMask(TFT_WR_PIN); 79 | rs_bitmask = digitalPinToBitMask(TFT_RS_PIN); 80 | cs_bitmask = digitalPinToBitMask(TFT_CS_PIN); 81 | //Set control lines as output 82 | //cntrlRegs->CRL = (cntrlRegs->CRL & 0xFFFF0000) | 0x00003333; 83 | #if 0 // used TFT does not support RD operation 84 | pinMode(TFT_RD_PIN, OUTPUT); 85 | RD_IDLE; 86 | #endif 87 | pinMode(TFT_WR_PIN, OUTPUT); 88 | pinMode(TFT_RS_PIN, OUTPUT); 89 | pinMode(TFT_CS_PIN, OUTPUT); 90 | CS_IDLE; // Set all control bits to HIGH (idle) 91 | CD_DATA; // Signals are ACTIVE LOW 92 | WR_IDLE; 93 | /* testing PB4 - sometimes reserved by debug port, see http://www.stm32duino.com/viewtopic.php?f=35&t=1130&p=24289#p24289 94 | pinMode(PB4, OUTPUT); 95 | digitalWrite(PB4, HIGH); 96 | while (1) { 97 | CS_ACTIVE; 98 | digitalWrite(PB4, LOW); 99 | digitalWrite(PB4, HIGH); 100 | CS_IDLE; 101 | delay(1000); 102 | } 103 | */ 104 | //set up data port to write mode. 105 | setWriteDir(); 106 | #endif // USE_FSCM 107 | 108 | // toggle RST low to reset 109 | if (TFT_RST_PIN >= 0) { // don't use PA0 as reset !!! 110 | pinMode(TFT_RST_PIN, OUTPUT); 111 | digitalWrite(TFT_RST_PIN, HIGH); 112 | delay(100); 113 | digitalWrite(TFT_RST_PIN, LOW); 114 | delay(100); 115 | digitalWrite(TFT_RST_PIN, HIGH); 116 | delay(100); 117 | } 118 | } 119 | 120 | /*****************************************************************************/ 121 | // Sets the LCD address window (and address counter, on 932X). 122 | // Relevant to rect/screen fills and H/V lines. Input coordinates are 123 | // assumed pre-sorted (e.g. x2 >= x1). 124 | /*****************************************************************************/ 125 | void Adafruit_TFTLCD_16bit_STM32::setAddrWindow(int16_t x1, int16_t y1, int16_t x2, int16_t y2) 126 | { 127 | if ((driver == ID_9341) || (driver == ID_HX8357D)){ 128 | ili9341_setAddrWindow(x1, y1, x2, y2); 129 | } else if(driver == ID_932X) { 130 | ili932x_setAddrWindow(x1, y1, x2, y2); 131 | } else if(driver == ID_7575) { 132 | hx8347g_setAddrWindow(x1, y1, x2, y2); 133 | } 134 | } 135 | 136 | /*****************************************************************************/ 137 | // Fast block fill operation for fillScreen, fillRect, H/V line, etc. 138 | // Requires setAddrWindow() has previously been called to set the fill 139 | // bounds. 'len' is inclusive, MUST be >= 1. 140 | /*****************************************************************************/ 141 | void Adafruit_TFTLCD_16bit_STM32::flood(uint16_t color, uint32_t len) 142 | { 143 | CS_ACTIVE_CD_COMMAND; 144 | if (driver == ID_9341) { 145 | writeCmd(ILI9341_MEMORYWRITE); 146 | } else if (driver == ID_932X) { 147 | writeCmd(ILI932X_RW_GRAM); 148 | } else if (driver == ID_HX8357D) { 149 | writeCmd(HX8357_RAMWR); 150 | } else { 151 | writeCmd(0x22); // Write data to GRAM 152 | } 153 | 154 | // Write first pixel normally 155 | CD_DATA; 156 | #ifndef USE_FSMC 157 | writeData_(color); 158 | #endif 159 | uint16_t blocks = len>>3; 160 | // optimized write in group of 8 consecutive strobes 161 | while ( (blocks--) ) { 162 | WR_STROBE; WR_STROBE; WR_STROBE; WR_STROBE; WR_STROBE; WR_STROBE; WR_STROBE; WR_STROBE; 163 | } 164 | // remaining less than 8 bytes 165 | len &= 0x07; 166 | while ( (len--) ) { 167 | WR_STROBE; 168 | } 169 | CS_IDLE; 170 | } 171 | 172 | /*****************************************************************************/ 173 | void Adafruit_TFTLCD_16bit_STM32::drawFastHLine(int16_t x, int16_t y, int16_t length, uint16_t color) 174 | { 175 | int16_t x2; 176 | 177 | // Initial off-screen clipping 178 | if((length <= 0 ) || 179 | (y < 0 ) || ( y >= _height) || 180 | (x >= _width) || ((x2 = (x+length-1)) < 0 )) return; 181 | 182 | if(x < 0) { // Clip left 183 | length += x; 184 | x = 0; 185 | } 186 | if(x2 >= _width) { // Clip right 187 | x2 = _width - 1; 188 | length = x2 - x + 1; 189 | } 190 | 191 | setAddrWindow(x, y, x2, y); 192 | flood(color, length); 193 | if(driver == ID_932X) setAddrWindow(0, 0, _width - 1, _height - 1); 194 | else hx8347g_setLR(); 195 | } 196 | 197 | /*****************************************************************************/ 198 | void Adafruit_TFTLCD_16bit_STM32::drawFastVLine(int16_t x, int16_t y, int16_t length, uint16_t color) 199 | { 200 | int16_t y2; 201 | 202 | // Initial off-screen clipping 203 | if((length <= 0 ) || 204 | (x < 0 ) || ( x >= _width) || 205 | (y >= _height) || ((y2 = (y+length-1)) < 0 )) return; 206 | if(y < 0) { // Clip top 207 | length += y; 208 | y = 0; 209 | } 210 | if(y2 >= _height) { // Clip bottom 211 | y2 = _height - 1; 212 | length = y2 - y + 1; 213 | } 214 | 215 | setAddrWindow(x, y, x, y2); 216 | flood(color, length); 217 | if(driver == ID_932X) setAddrWindow(0, 0, _width - 1, _height - 1); 218 | else hx8347g_setLR(); 219 | } 220 | 221 | /*****************************************************************************/ 222 | void Adafruit_TFTLCD_16bit_STM32::fillRect(int16_t x1, int16_t y1, int16_t w, int16_t h, uint16_t fillcolor) 223 | { 224 | //Serial.println("\n::fillRect..."); 225 | int16_t x2, y2; 226 | 227 | // Initial off-screen clipping 228 | if( (w <= 0 ) || (h <= 0 ) || 229 | (x1 >= _width) || (y1 >= _height) || 230 | ((x2 = x1+w-1) < 0 ) || ((y2 = y1+h-1) < 0 )) return; 231 | if(x1 < 0) { // Clip left 232 | w += x1; 233 | x1 = 0; 234 | } 235 | if(y1 < 0) { // Clip top 236 | h += y1; 237 | y1 = 0; 238 | } 239 | if(x2 >= _width) { // Clip right 240 | x2 = _width - 1; 241 | w = x2 - x1 + 1; 242 | } 243 | if(y2 >= _height) { // Clip bottom 244 | y2 = _height - 1; 245 | h = y2 - y1 + 1; 246 | } 247 | 248 | setAddrWindow(x1, y1, x2, y2); 249 | flood(fillcolor, (uint32_t)w * (uint32_t)h); 250 | if(driver == ID_932X) setAddrWindow(0, 0, _width - 1, _height - 1); 251 | //else hx8347g_setLR(); 252 | } 253 | 254 | /*****************************************************************************/ 255 | void Adafruit_TFTLCD_16bit_STM32::fillScreen(uint16_t color) 256 | { 257 | if(driver == ID_932X) { 258 | // For the 932X, a full-screen address window is already the default 259 | // state, just need to set the address pointer to the top-left corner. 260 | // Although we could fill in any direction, the code uses the current 261 | // screen rotation because some users find it disconcerting when a 262 | // fill does not occur top-to-bottom. 263 | ili932x_fillScreen(color); 264 | } else if ((driver == ID_9341) || (driver == ID_7575) || (driver == ID_HX8357D)) { 265 | // For these, there is no settable address pointer, instead the 266 | // address window must be set for each drawing operation. However, 267 | // this display takes rotation into account for the parameters, no 268 | // need to do extra rotation math here. 269 | setAddrWindow(0, 0, _width - 1, _height - 1); 270 | } 271 | flood(color, (long)TFTWIDTH * (long)TFTHEIGHT); 272 | } 273 | 274 | /*****************************************************************************/ 275 | void Adafruit_TFTLCD_16bit_STM32::drawPixel(int16_t x, int16_t y, uint16_t color) 276 | { 277 | // Clip 278 | if((x < 0) || (y < 0) || (x >= _width) || (y >= _height)) return; 279 | 280 | if ((driver == ID_9341) || (driver == ID_HX8357D)) { 281 | 282 | setAddrWindow(x, y, x+1, y+1); 283 | writeRegister16(0x2C, color); 284 | } else if(driver == ID_7575) { 285 | 286 | uint8_t lo; 287 | switch(rotation) { 288 | default: lo = 0 ; break; 289 | case 1 : lo = 0x60; break; 290 | case 2 : lo = 0xc0; break; 291 | case 3 : lo = 0xa0; break; 292 | } 293 | writeRegister8( HX8347G_MEMACCESS , lo); 294 | // Only upper-left is set -- bottom-right is full screen default 295 | writeRegisterPair(HX8347G_COLADDRSTART_HI, HX8347G_COLADDRSTART_LO, x); 296 | writeRegisterPair(HX8347G_ROWADDRSTART_HI, HX8347G_ROWADDRSTART_LO, y); 297 | writeCommand(0x22); CD_DATA; writeData(color); CS_IDLE; 298 | 299 | } else if(driver == ID_932X) { 300 | 301 | ili932x_drawPixel(x, y, color); 302 | } 303 | } 304 | 305 | /*****************************************************************************/ 306 | // Draw an image bitmap (16bits per color) at the specified position from the provided buffer. 307 | /*****************************************************************************/ 308 | void Adafruit_TFTLCD_16bit_STM32::drawBitmap(int16_t x, int16_t y, int16_t w, int16_t h, const uint16_t * bitmap) 309 | { 310 | if ( x>=0 && (x+w)<_width && y>=0 && (y+h)<=_height ) { 311 | // all pixel visible, do it in the fast way 312 | setAddrWindow(x,y,x+w-1,y+h-1); 313 | pushColors((uint16_t*)bitmap, w*h, true); 314 | } else { 315 | // some pixels outside visible area, do it in the classical way to disable off-screen points 316 | int16_t i, j; 317 | uint16_t * colorP = (uint16_t*)bitmap; 318 | for(j=0; j> 3); 369 | //return ((r & 0x1F) << 11) | ((g & 0x3F) << 5) | (b & 0x1F); 370 | } 371 | 372 | /*****************************************************************************/ 373 | void Adafruit_TFTLCD_16bit_STM32::setRotation(uint8_t x) 374 | { 375 | // Call parent rotation func first -- sets up rotation flags, etc. 376 | Adafruit_GFX::setRotation(x); 377 | // Then perform hardware-specific rotation operations... 378 | 379 | if (driver == ID_932X) { 380 | 381 | ili932x_setRotation(x); 382 | 383 | } else if (driver == ID_7575) { 384 | 385 | hx8347g_setRotation(x); 386 | 387 | } else if (driver == ID_9341) { 388 | // MEME, HX8357D uses same registers as 9341 but different values 389 | uint16_t t; 390 | 391 | switch (rotation) { 392 | case 1: 393 | t = ILI9341_MADCTL_MX | ILI9341_MADCTL_MY | ILI9341_MADCTL_MV | ILI9341_MADCTL_BGR; 394 | break; 395 | case 2: 396 | t = ILI9341_MADCTL_MX | ILI9341_MADCTL_BGR; 397 | break; 398 | case 3: 399 | t = ILI9341_MADCTL_MV | ILI9341_MADCTL_BGR; 400 | break; 401 | case 0: 402 | default: 403 | t = ILI9341_MADCTL_MY | ILI9341_MADCTL_BGR; 404 | break; 405 | } 406 | writeRegister8(ILI9341_MADCTL, t ); // MADCTL 407 | // For 9341, init default full-screen address window: 408 | //setAddrWindow(0, 0, _width - 1, _height - 1); // CS_IDLE happens here 409 | 410 | } else if (driver == ID_HX8357D) { 411 | // MEME, HX8357D uses same registers as 9341 but different values 412 | uint16_t t; 413 | 414 | switch (rotation) { 415 | case 1: 416 | t = HX8357B_MADCTL_MY | HX8357B_MADCTL_MV | HX8357B_MADCTL_RGB; 417 | break; 418 | case 2: 419 | t = HX8357B_MADCTL_RGB; 420 | break; 421 | case 3: 422 | t = HX8357B_MADCTL_MX | HX8357B_MADCTL_MV | HX8357B_MADCTL_RGB; 423 | break; 424 | case 0: 425 | default: 426 | t = HX8357B_MADCTL_MX | HX8357B_MADCTL_MY | HX8357B_MADCTL_RGB; 427 | break; 428 | } 429 | writeRegister8(ILI9341_MADCTL, t ); // MADCTL 430 | // For 8357, init default full-screen address window: 431 | setAddrWindow(0, 0, _width - 1, _height - 1); // CS_IDLE happens here 432 | } 433 | } 434 | 435 | /**************************************************************************** 436 | uint8_t read8_(void) 437 | { 438 | RD_ACTIVE; 439 | delayMicroseconds(10); 440 | uint8_t temp = ( (dataRegs->IDR>>TFT_DATA_SHIFT) & 0x00FF); 441 | delayMicroseconds(10); 442 | RD_IDLE; 443 | delayMicroseconds(10); 444 | return temp; 445 | }*/ 446 | 447 | 448 | #if 0 // used TFT cannot be read 449 | /*****************************************************************************/ 450 | // Because this function is used infrequently, it configures the ports for 451 | // the read operation, reads the data, then restores the ports to the write 452 | // configuration. Write operations happen a LOT, so it's advantageous to 453 | // leave the ports in that state as a default. 454 | /*****************************************************************************/ 455 | uint16_t Adafruit_TFTLCD_16bit_STM32::readPixel(int16_t x, int16_t y) 456 | { 457 | if((x < 0) || (y < 0) || (x >= _width) || (y >= _height)) return 0; 458 | 459 | if(driver == ID_932X) { 460 | 461 | return ili932x_readPixel(x, y); 462 | 463 | } else if(driver == ID_7575) { 464 | 465 | uint8_t r, g, b; 466 | writeRegisterPair(HX8347G_COLADDRSTART_HI, HX8347G_COLADDRSTART_LO, x); 467 | writeRegisterPair(HX8347G_ROWADDRSTART_HI, HX8347G_ROWADDRSTART_LO, y); 468 | writeCommand(0x22); // Read data from GRAM 469 | setReadDir(); // Set up LCD data port(s) for READ operations 470 | CD_DATA; 471 | read8(r); // First byte back is a dummy read 472 | read8(r); 473 | read8(g); 474 | read8(b); 475 | setWriteDir(); // Restore LCD data port(s) to WRITE configuration 476 | CS_IDLE; 477 | return (((uint16_t)r & B11111000) << 8) | 478 | (((uint16_t)g & B11111100) << 3) | 479 | ( b >> 3); 480 | } else return 0; 481 | } 482 | 483 | /*****************************************************************************/ 484 | uint16_t Adafruit_TFTLCD_16bit_STM32::readID(void) 485 | { 486 | /* 487 | for (uint8_t i=0; i<128; i++) { 488 | Serial.print("$"); Serial.print(i, HEX); 489 | Serial.print(" = 0x"); Serial.println(readReg(i), HEX); 490 | } 491 | */ 492 | /* 493 | Serial.println("!"); 494 | for (uint8_t i=0; i<4; i++) { 495 | Serial.print("$"); Serial.print(i, HEX); 496 | Serial.print(" = 0x"); Serial.println(readReg(i), HEX); 497 | } 498 | */ 499 | /**/ 500 | if (readReg32(0x04) == 0x8000) { // eh close enough 501 | // setc! 502 | writeRegister24(HX8357D_SETC, 0xFF8357); 503 | delay(300); 504 | //Serial.println(readReg(0xD0), HEX); 505 | if (readReg32(0xD0) == 0x990000) { 506 | return 0x8357; 507 | } 508 | } 509 | 510 | uint16_t id = readReg32(0xD3); 511 | if (id != 0x9341) { 512 | id = readReg(0); 513 | } 514 | //Serial.print("ID: "); Serial.println(id,HEX); 515 | return id; 516 | } 517 | 518 | /*****************************************************************************/ 519 | uint32_t readReg32(uint8_t r) 520 | { 521 | uint32_t id; 522 | uint8_t x; 523 | 524 | // try reading register #4 525 | writeCommand(r); 526 | setReadDir(); // Set up LCD data port(s) for READ operations 527 | CD_DATA; 528 | delayMicroseconds(50); 529 | read8(x); 530 | id = x; // Do not merge or otherwise simplify 531 | id <<= 8; // these lines. It's an unfortunate 532 | read8(x); 533 | id |= x; // shenanigans that are going on. 534 | id <<= 8; // these lines. It's an unfortunate 535 | read8(x); 536 | id |= x; // shenanigans that are going on. 537 | id <<= 8; // these lines. It's an unfortunate 538 | read8(x); 539 | id |= x; // shenanigans that are going on. 540 | CS_IDLE; 541 | setWriteDir(); // Restore LCD data port(s) to WRITE configuration 542 | return id; 543 | } 544 | /*****************************************************************************/ 545 | uint16_t readReg(uint8_t r) 546 | { 547 | uint16_t id; 548 | uint8_t x; 549 | 550 | writeCommand(r); 551 | setReadDir(); // Set up LCD data port(s) for READ operations 552 | CD_DATA; 553 | delayMicroseconds(10); 554 | read8(x); 555 | id = x; // Do not merge or otherwise simplify 556 | id <<= 8; // these lines. It's an unfortunate 557 | read8(x); 558 | id |= x; // shenanigans that are going on. 559 | CS_IDLE; 560 | setWriteDir(); // Restore LCD data port(s) to WRITE configuration 561 | 562 | //Serial.print("Read $"); Serial.print(r, HEX); 563 | //Serial.print(":\t0x"); Serial.println(id, HEX); 564 | return id; 565 | } 566 | #endif // used TFT cannot be read 567 | 568 | /*****************************************************************************/ 569 | void writeRegister8(uint16_t a, uint8_t d) 570 | { 571 | writeCommand(a); 572 | CD_DATA; 573 | writeData(d&0x00FF); 574 | CS_IDLE; 575 | } 576 | 577 | /*****************************************************************************/ 578 | void writeRegister16(uint16_t a, uint16_t d) 579 | { 580 | writeCommand(a); 581 | CD_DATA; 582 | writeData(d); 583 | CS_IDLE; 584 | } 585 | 586 | /*****************************************************************************/ 587 | void writeRegisterPair(uint16_t aH, uint16_t aL, uint16_t d) 588 | { 589 | writeRegister8(aH, d>>8); 590 | writeRegister8(aL, d); 591 | } 592 | 593 | /**************************************************************************** 594 | void writeRegister24(uint16_t r, uint32_t d) 595 | { 596 | writeCommand(r); // includes CS_ACTIVE 597 | CD_DATA; 598 | write8(d >> 16); 599 | write8(d >> 8); 600 | write8(d); 601 | CS_IDLE; 602 | }*/ 603 | 604 | /*****************************************************************************/ 605 | void writeRegister32(uint16_t r, uint32_t d) 606 | { 607 | writeCommand(r); 608 | CD_DATA; 609 | writeData((d >> 24)); 610 | writeData((d >> 16)&0x00FF); 611 | writeData((d >> 8)&0x00FF); 612 | writeData(d&0x00FF); 613 | CS_IDLE; 614 | } 615 | -------------------------------------------------------------------------------- /src/Adafruit_TFTLCD_16bit_STM32.h: -------------------------------------------------------------------------------- 1 | // IMPORTANT: SEE COMMENTS @ LINE 15 REGARDING SHIELD VS BREAKOUT BOARD USAGE. 2 | 3 | // Graphics library by ladyada/adafruit with init code from Rossum 4 | // MIT license 5 | 6 | #ifndef _ADAFRUIT_TFTLCD_16BIT_STM32_H_ 7 | #define _ADAFRUIT_TFTLCD_16BIT_STM32_H_ 8 | 9 | 10 | #include 11 | 12 | //#define USE_FSMC 1 // use FSCM interface instead raw GPIO access 13 | 14 | //#define USE_MAPLE_MINI_PINOUT // for use with maple mini 15 | 16 | /*****************************************************************************/ 17 | // LCD controller chip identifiers 18 | #define ID_932X 0 19 | #define ID_7575 1 20 | #define ID_9341 2 21 | #define ID_HX8357D 3 22 | #define ID_UNKNOWN 0xFF 23 | 24 | /*****************************************************************************/ 25 | #ifndef TFTWIDTH 26 | #define TFTWIDTH 320 27 | #define TFTHEIGHT 480 28 | #endif 29 | // Initialization command tables for different LCD controllers 30 | #define TFTLCD_DELAY 0xFF 31 | 32 | // For compatibility with sketches written for older versions of library. 33 | // Color function name was changed to 'color565' for parity with 2.2" LCD 34 | // library. 35 | #define Color565 color565 36 | 37 | /*****************************************************************************/ 38 | #define BLACK 0x0000 39 | #define BLUE 0x001F 40 | #define RED 0xF800 41 | #define GREEN 0x07E0 42 | #define CYAN 0x07FF 43 | #define MAGENTA 0xF81F 44 | #define YELLOW 0xFFE0 45 | #define WHITE 0xFFFF 46 | /*****************************************************************************/ 47 | // Define pins and Output Data Registers 48 | /*****************************************************************************/ 49 | 50 | #ifdef USE_FSMC 51 | 52 | // use USE_FSMC peripheral 53 | #include 54 | 55 | #define CD_COMMAND 56 | #define CD_DATA 57 | #define CS_ACTIVE 58 | #define CS_IDLE 59 | #define CS_ACTIVE_CD_COMMAND 60 | 61 | #define lcdCommand (*fsmcCommand) 62 | #define lcdData (*fsmcData) 63 | 64 | // set pins to output the 8 bit value 65 | #define writeCmd(d) { lcdCommand = d; } 66 | #define writeData(d) { lcdData = d; } 67 | 68 | #define WR_STROBE writeData(color) 69 | 70 | #else 71 | 72 | // use normal GPIO access 73 | #include 74 | 75 | // Data port 76 | #if defined (__STM32F1__) 77 | #define TFT_DATA_PORT GPIOB 78 | #elif defined (__STM32F4__) 79 | #define TFT_DATA_PORT GPIOD 80 | #endif 81 | 82 | //Control port and pins |WR |RS |CS 83 | // All of them must have common IO port! 84 | #define TFT_WR_PIN PA1 85 | #define TFT_RS_PIN PA2 86 | #define TFT_CS_PIN PA3 87 | 88 | #if defined (__STM32F1__) 89 | #define TFT_CNTRL_PORT GPIOA // must be common to all control pins 90 | #elif defined (__STM32F4__) 91 | #define TFT_CNTRL_PORT GPIOC 92 | #endif 93 | 94 | #define RST_ACTIVE digitalWrite(TFT_RST_PIN, LOW) 95 | #define RST_IDLE digitalWrite(TFT_RST_PIN, HIGH) 96 | // used TFT does not support RD operation 97 | //#define RD_ACTIVE digitalWrite(TFT_RD_PIN, LOW) 98 | //#define RD_IDLE digitalWrite(TFT_RD_PIN, HIGH) 99 | 100 | extern volatile uint32_t *ctrl_port, *data_port; 101 | extern uint16_t wr_bitmask, rs_bitmask, cs_bitmask; 102 | #if 0 103 | // use old definition, standard bit toggling, low speed 104 | #define WR_ACTIVE digitalWrite(TFT_WR_PIN, LOW) // 105 | #define WR_IDLE digitalWrite(TFT_WR_PIN, HIGH) // 106 | #define CD_COMMAND digitalWrite(TFT_RS_PIN, LOW) 107 | #define CD_DATA digitalWrite(TFT_RS_PIN, HIGH) 108 | #define CS_ACTIVE digitalWrite(TFT_CS_PIN, LOW) 109 | #define CS_IDLE digitalWrite(TFT_CS_PIN, HIGH) 110 | #define CS_ACTIVE_CD_COMMAND { CS_ACTIVE; CD_COMMAND; } 111 | #else 112 | // use fast bit toggling, very fast speed! 113 | //volatile uint32_t * const rd_port = portSetRegister(TFT_RD_PIN); 114 | #define WR_ACTIVE ( *ctrl_port = (uint32_t)wr_bitmask<<16 ) 115 | #define WR_IDLE ( *ctrl_port = (uint32_t)wr_bitmask ) 116 | #define CD_COMMAND ( *ctrl_port = (uint32_t)rs_bitmask<<16 ) 117 | #define CD_DATA ( *ctrl_port = (uint32_t)rs_bitmask ) 118 | #define CS_ACTIVE ( *ctrl_port = (uint32_t)cs_bitmask<<16 ) 119 | #define CS_IDLE ( *ctrl_port = (uint32_t)cs_bitmask ) 120 | #define CS_ACTIVE_CD_COMMAND ( *ctrl_port = (uint32_t)(cs_bitmask+rs_bitmask)<<16 ) 121 | #endif 122 | 123 | #define WR_STROBE { WR_ACTIVE; WR_IDLE; } 124 | 125 | // set pins to output the 8 bit value 126 | #define writeData_(d) { *data_port = d; } 127 | //#define writeCmd(d) { writeData_(d&0x00FF); WR_STROBE; } 128 | #define writeCmd(d) { CS_ACTIVE_CD_COMMAND; writeData_(d); WR_STROBE; } 129 | #define writeData(d) { writeData_(d); WR_STROBE; } 130 | 131 | // configure the pins to input 132 | #if 0 // used TFT cannot be read 133 | extern uint8_t read8_(void); 134 | #define read8(x) ( x = read8_() ) 135 | #define setReadDir() { TFT_DATA_PORT->regs->CRL = 0x88888888; TFT_DATA_PORT->regs->CRH = 0x88888888; } 136 | #endif // used TFT cannot be read 137 | 138 | // configure the pins to output 139 | #if defined (__STM32F1__) 140 | #define setWriteDir() { TFT_DATA_PORT->regs->CRL = 0x33333333; TFT_DATA_PORT->regs->CRH = 0x33333333; } 141 | #elif defined (__STM32F4__) 142 | #define setWriteDir() { TFT_DATA_PORT->regs->MODER = 0x55555555; } 143 | #endif 144 | 145 | #endif // USE_FSMC 146 | 147 | #define TFT_RST_PIN PC15 148 | 149 | /*****************************************************************************/ 150 | 151 | #define swap(a, b) { int16_t t = a; a = b; b = t; } 152 | 153 | /*****************************************************************************/ 154 | class Adafruit_TFTLCD_16bit_STM32 : public Adafruit_GFX { 155 | 156 | public: 157 | 158 | //Adafruit_TFTLCD_8bit_STM32(uint8_t cs, uint8_t cd, uint8_t wr, uint8_t rd, uint8_t rst); 159 | Adafruit_TFTLCD_16bit_STM32(void); 160 | 161 | void begin(uint16_t id = 0x9341); 162 | void drawPixel(int16_t x, int16_t y, uint16_t color); 163 | void drawFastHLine(int16_t x0, int16_t y0, int16_t w, uint16_t color); 164 | void drawFastVLine(int16_t x0, int16_t y0, int16_t h, uint16_t color); 165 | void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t c); 166 | void fillScreen(uint16_t color); 167 | void reset(void); 168 | void setRegisters8(uint8_t *ptr, uint8_t n); 169 | void setRegisters16(uint16_t *ptr, uint8_t n); 170 | void setRotation(uint8_t x); 171 | // These methods are public in order for BMP examples to work: 172 | void setAddrWindow(int16_t x1, int16_t y1, int16_t x2, int16_t y2); 173 | void invertDisplay(boolean i), 174 | pushColors(uint16_t *data, int16_t len, boolean first), 175 | drawBitmap(int16_t x, int16_t y, int16_t w, int16_t h, const uint16_t * bitmap); 176 | uint16_t color565(uint8_t r, uint8_t g, uint8_t b); 177 | #if 0 // used TFT cannot be read 178 | uint16_t readPixel(int16_t x, int16_t y), 179 | readID(void); 180 | #endif 181 | private: 182 | 183 | void init(), 184 | flood(uint16_t color, uint32_t len); 185 | uint8_t driver; 186 | }; 187 | 188 | #if 0 // used TFT cannot be read 189 | extern uint16_t readReg(uint8_t r); 190 | extern uint32_t readReg32(uint8_t r); 191 | #endif 192 | 193 | void inline writeCommand(uint16_t c) { CS_ACTIVE_CD_COMMAND; writeCmd(c); } 194 | extern void writeRegister8(uint16_t a, uint8_t d); 195 | extern void writeRegister16(uint16_t a, uint16_t d); 196 | //extern void writeRegister24(uint16_t a, uint32_t d); 197 | extern void writeRegister32(uint16_t a, uint32_t d); 198 | //extern void writeRegister32(uint16_t a, uint16_t d1, uint16_t d2); 199 | extern void writeRegisterPair(uint16_t aH, uint16_t aL, uint16_t d); 200 | 201 | #endif 202 | -------------------------------------------------------------------------------- /src/Adafruit_common.h: -------------------------------------------------------------------------------- 1 | #ifndef _ADAFRUIT_COMMON_H_ 2 | #define _ADAFRUIT_COMMON_H_ 3 | 4 | 5 | #include 6 | 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/hx8347g.cpp: -------------------------------------------------------------------------------- 1 | // IMPORTANT: LIBRARY MUST BE SPECIFICALLY CONFIGURED FOR EITHER TFT SHIELD 2 | // OR BREAKOUT BOARD USAGE. SEE RELEVANT COMMENTS IN Adafruit_TFTLCD.h 3 | 4 | // Graphics library by ladyada/adafruit with init code from Rossum 5 | // MIT license 6 | 7 | 8 | #include "Adafruit_common.h" 9 | 10 | #include "hx8347g.h" 11 | 12 | /*****************************************************************************/ 13 | static const uint8_t HX8347G_regValues[] PROGMEM = { 14 | 0x2E , 0x89, 15 | 0x29 , 0x8F, 16 | 0x2B , 0x02, 17 | 0xE2 , 0x00, 18 | 0xE4 , 0x01, 19 | 0xE5 , 0x10, 20 | 0xE6 , 0x01, 21 | 0xE7 , 0x10, 22 | 0xE8 , 0x70, 23 | 0xF2 , 0x00, 24 | 0xEA , 0x00, 25 | 0xEB , 0x20, 26 | 0xEC , 0x3C, 27 | 0xED , 0xC8, 28 | 0xE9 , 0x38, 29 | 0xF1 , 0x01, 30 | 31 | // skip gamma, do later 32 | 33 | 0x1B , 0x1A, 34 | 0x1A , 0x02, 35 | 0x24 , 0x61, 36 | 0x25 , 0x5C, 37 | 38 | 0x18 , 0x36, 39 | 0x19 , 0x01, 40 | 0x1F , 0x88, 41 | TFTLCD_DELAY , 5 , // delay 5 ms 42 | 0x1F , 0x80, 43 | TFTLCD_DELAY , 5 , 44 | 0x1F , 0x90, 45 | TFTLCD_DELAY , 5 , 46 | 0x1F , 0xD4, 47 | TFTLCD_DELAY , 5 , 48 | 0x17 , 0x05, 49 | 50 | 0x36 , 0x09, 51 | 0x28 , 0x38, 52 | TFTLCD_DELAY , 40 , 53 | 0x28 , 0x3C, 54 | 55 | 0x02 , 0x00, 56 | 0x03 , 0x00, 57 | 0x04 , 0x00, 58 | 0x05 , 0xEF, 59 | 0x06 , 0x00, 60 | 0x07 , 0x00, 61 | 0x08 , 0x01, 62 | 0x09 , 0x3F 63 | }; 64 | 65 | /*****************************************************************************/ 66 | // Unlike the 932X drivers that set the address window to the full screen 67 | // by default (using the address counter for drawPixel operations), the 68 | // 7575 needs the address window set on all graphics operations. In order 69 | // to save a few register writes on each pixel drawn, the lower-right 70 | // corner of the address window is reset after most fill operations, so 71 | // that drawPixel only needs to change the upper left each time. 72 | /*****************************************************************************/ 73 | void hx8347g_setLR(void) 74 | { 75 | writeRegisterPair(HX8347G_COLADDREND_HI, HX8347G_COLADDREND_LO, TFTWIDTH - 1); 76 | writeRegisterPair(HX8347G_ROWADDREND_HI, HX8347G_ROWADDREND_LO, TFTHEIGHT - 1); 77 | } 78 | 79 | /*****************************************************************************/ 80 | void hx8347g_begin(void) 81 | { 82 | uint8_t a, d, i = 0; 83 | CS_ACTIVE; 84 | while(i < sizeof(HX8347G_regValues)) { 85 | a = HX8347G_regValues[i++]; 86 | d = HX8347G_regValues[i++]; 87 | if(a == TFTLCD_DELAY) delay(d); 88 | else writeRegister8(a, d); 89 | } 90 | hx8347g_setRotation(0); 91 | hx8347g_setLR(); // Lower-right corner of address window 92 | } 93 | 94 | /*****************************************************************************/ 95 | // Sets the LCD address window (and address counter, on 932X). 96 | // Relevant to rect/screen fills and H/V lines. Input coordinates are 97 | // assumed pre-sorted (e.g. x2 >= x1). 98 | /*****************************************************************************/ 99 | void hx8347g_setAddrWindow(int x1, int y1, int x2, int y2) 100 | { 101 | writeRegisterPair(HX8347G_COLADDRSTART_HI, HX8347G_COLADDRSTART_LO, x1); 102 | writeRegisterPair(HX8347G_ROWADDRSTART_HI, HX8347G_ROWADDRSTART_LO, y1); 103 | writeRegisterPair(HX8347G_COLADDREND_HI , HX8347G_COLADDREND_LO , x2); 104 | writeRegisterPair(HX8347G_ROWADDREND_HI , HX8347G_ROWADDREND_LO , y2); 105 | } 106 | 107 | /*****************************************************************************/ 108 | void hx8347g_fillScreen(uint16_t color) 109 | { 110 | } 111 | 112 | /*****************************************************************************/ 113 | void hx8347g_drawPixel(int16_t x, int16_t y, uint16_t color) 114 | { 115 | } 116 | 117 | /*****************************************************************************/ 118 | void hx8347g_setRotation(uint8_t x) 119 | { 120 | uint8_t t; 121 | switch(x) { 122 | default: t = 0 ; break; 123 | case 1 : t = 0x60; break; 124 | case 2 : t = 0xc0; break; 125 | case 3 : t = 0xa0; break; 126 | } 127 | writeRegister8(HX8347G_MEMACCESS, t); 128 | // 7575 has to set the address window on most drawing operations. 129 | // drawPixel() cheats by setting only the top left...by default, 130 | // the lower right is always reset to the corner. 131 | hx8347g_setLR(); // CS_IDLE happens here 132 | } 133 | 134 | /*****************************************************************************/ 135 | uint16_t hx8347g_readPixel(int16_t x, int16_t y) 136 | { 137 | return 0; 138 | } 139 | -------------------------------------------------------------------------------- /src/hx8347g.h: -------------------------------------------------------------------------------- 1 | #ifndef _HX8347G_H_ 2 | #define _HX8347G_H_ 3 | 4 | 5 | // Register names 6 | #define HX8347G_COLADDRSTART_HI 0x02 7 | #define HX8347G_COLADDRSTART_LO 0x03 8 | #define HX8347G_COLADDREND_HI 0x04 9 | #define HX8347G_COLADDREND_LO 0x05 10 | #define HX8347G_ROWADDRSTART_HI 0x06 11 | #define HX8347G_ROWADDRSTART_LO 0x07 12 | #define HX8347G_ROWADDREND_HI 0x08 13 | #define HX8347G_ROWADDREND_LO 0x09 14 | #define HX8347G_MEMACCESS 0x16 15 | 16 | 17 | /*****************************************************************************/ 18 | extern void hx8347g_setLR(void); 19 | extern void hx8347g_begin(void); 20 | extern void hx8347g_setAddrWindow(int x1, int y1, int x2, int y2); 21 | extern void hx8347g_fillScreen(uint16_t color); 22 | extern void hx8347g_drawPixel(int16_t x, int16_t y, uint16_t color); 23 | extern void hx8347g_setRotation(uint8_t x); 24 | extern uint16_t hx8347g_readPixel(int16_t x, int16_t y); 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/hx8357x.cpp: -------------------------------------------------------------------------------- 1 | // IMPORTANT: LIBRARY MUST BE SPECIFICALLY CONFIGURED FOR EITHER TFT SHIELD 2 | // OR BREAKOUT BOARD USAGE. SEE RELEVANT COMMENTS IN Adafruit_TFTLCD.h 3 | 4 | // Graphics library by ladyada/adafruit with init code from Rossum 5 | // MIT license 6 | 7 | 8 | #include "Adafruit_common.h" 9 | 10 | #include "hx8357x.h" 11 | 12 | /*****************************************************************************/ 13 | static const uint8_t HX8357D_regValues[] PROGMEM = { 14 | HX8357_SWRESET, 0, 15 | HX8357D_SETC, 3, 0xFF, 0x83, 0x57, 16 | TFTLCD_DELAY, 250, 17 | HX8357_SETRGB, 4, 0x00, 0x00, 0x06, 0x06, 18 | HX8357D_SETCOM, 1, 0x25, // -1.52V 19 | HX8357_SETOSC, 1, 0x68, // Normal mode 70Hz, Idle mode 55 Hz 20 | HX8357_SETPANEL, 1, 0x05, // BGR, Gate direction swapped 21 | HX8357_SETPWR1, 6, 0x00, 0x15, 0x1C, 0x1C, 0x83, 0xAA, 22 | HX8357D_SETSTBA, 6, 0x50, 0x50, 0x01, 0x3C, 0x1E, 0x08, 23 | // MEME GAMMA HERE 24 | HX8357D_SETCYC, 7, 0x02, 0x40, 0x00, 0x2A, 0x2A, 0x0D, 0x78, 25 | HX8357_COLMOD, 1, 0x55, 26 | HX8357_MADCTL, 1, 0xC0, 27 | HX8357_TEON, 1, 0x00, 28 | HX8357_TEARLINE, 2, 0x00, 0x02, 29 | HX8357_SLPOUT, 0, 30 | TFTLCD_DELAY, 150, 31 | HX8357_DISPON, 0, 32 | TFTLCD_DELAY, 50, 33 | }; 34 | 35 | /*****************************************************************************/ 36 | void hx8357x_begin(void) 37 | { 38 | uint8_t i = 0; 39 | while(i < sizeof(HX8357D_regValues)) { 40 | uint8_t r = HX8357D_regValues[i++]; 41 | uint8_t len = HX8357D_regValues[i++]; 42 | if(r == TFTLCD_DELAY) { 43 | delay(len); 44 | } else { 45 | //Serial.print("Register $"); Serial.print(r, HEX); 46 | //Serial.print(" datalen "); Serial.println(len); 47 | 48 | writeCommand(r); 49 | CD_DATA; 50 | for (uint8_t d=0; d= x1). 64 | /*****************************************************************************/ 65 | void hx8357x_setAddrWindow(int x1, int y1, int x2, int y2) 66 | { 67 | } 68 | 69 | /*****************************************************************************/ 70 | void hx8357x_fillScreen(uint16_t color) 71 | { 72 | } 73 | 74 | /*****************************************************************************/ 75 | void hx8357x_drawPixel(int16_t x, int16_t y, uint16_t color) 76 | { 77 | } 78 | 79 | /*****************************************************************************/ 80 | void hx8357x_setRotation(uint8_t x) 81 | { 82 | } 83 | 84 | /*****************************************************************************/ 85 | uint16_t hx8357x_readPixel(int16_t x, int16_t y) 86 | { 87 | return 0; 88 | } 89 | -------------------------------------------------------------------------------- /src/hx8357x.h: -------------------------------------------------------------------------------- 1 | #ifndef _HX8357X_H_ 2 | #define _HX8357X_H_ 3 | 4 | 5 | // Register names 6 | #define HX8357_NOP 0x00 7 | #define HX8357_SWRESET 0x01 8 | #define HX8357_RDDID 0x04 9 | #define HX8357_RDDST 0x09 10 | 11 | #define HX8357B_RDPOWMODE 0x0A 12 | #define HX8357B_RDMADCTL 0x0B 13 | #define HX8357B_RDCOLMOD 0x0C 14 | #define HX8357B_RDDIM 0x0D 15 | #define HX8357B_RDDSDR 0x0F 16 | 17 | #define HX8357_SLPIN 0x10 18 | #define HX8357_SLPOUT 0x11 19 | #define HX8357B_PTLON 0x12 20 | #define HX8357B_NORON 0x13 21 | 22 | #define HX8357_INVOFF 0x20 23 | #define HX8357_INVON 0x21 24 | #define HX8357_DISPOFF 0x28 25 | #define HX8357_DISPON 0x29 26 | 27 | #define HX8357_CASET 0x2A 28 | #define HX8357_PASET 0x2B 29 | #define HX8357_RAMWR 0x2C 30 | #define HX8357_RAMRD 0x2E 31 | 32 | #define HX8357B_PTLAR 0x30 33 | #define HX8357_TEON 0x35 34 | #define HX8357_TEARLINE 0x44 35 | #define HX8357_MADCTL 0x36 36 | #define HX8357_COLMOD 0x3A 37 | 38 | #define HX8357_SETOSC 0xB0 39 | #define HX8357_SETPWR1 0xB1 40 | #define HX8357B_SETDISPLAY 0xB2 41 | #define HX8357_SETRGB 0xB3 42 | #define HX8357D_SETCOM 0xB6 43 | 44 | #define HX8357B_SETDISPMODE 0xB4 45 | #define HX8357D_SETCYC 0xB4 46 | #define HX8357B_SETOTP 0xB7 47 | #define HX8357D_SETC 0xB9 48 | 49 | #define HX8357B_SET_PANEL_DRIVING 0xC0 50 | #define HX8357D_SETSTBA 0xC0 51 | #define HX8357B_SETDGC 0xC1 52 | #define HX8357B_SETID 0xC3 53 | #define HX8357B_SETDDB 0xC4 54 | #define HX8357B_SETDISPLAYFRAME 0xC5 55 | #define HX8357B_GAMMASET 0xC8 56 | #define HX8357B_SETCABC 0xC9 57 | #define HX8357_SETPANEL 0xCC 58 | 59 | 60 | #define HX8357B_SETPOWER 0xD0 61 | #define HX8357B_SETVCOM 0xD1 62 | #define HX8357B_SETPWRNORMAL 0xD2 63 | 64 | #define HX8357B_RDID1 0xDA 65 | #define HX8357B_RDID2 0xDB 66 | #define HX8357B_RDID3 0xDC 67 | #define HX8357B_RDID4 0xDD 68 | 69 | #define HX8357D_SETGAMMA 0xE0 70 | 71 | #define HX8357B_SETGAMMA 0xC8 72 | #define HX8357B_SETPANELRELATED 0xE9 73 | 74 | #define HX8357B_MADCTL_MY 0x80 75 | #define HX8357B_MADCTL_MX 0x40 76 | #define HX8357B_MADCTL_MV 0x20 77 | #define HX8357B_MADCTL_ML 0x10 78 | #define HX8357B_MADCTL_RGB 0x00 79 | #define HX8357B_MADCTL_BGR 0x08 80 | #define HX8357B_MADCTL_MH 0x04 81 | 82 | 83 | /*****************************************************************************/ 84 | extern void hx8357x_begin(void); 85 | extern void hx8357x_setAddrWindow(int x1, int y1, int x2, int y2); 86 | extern void hx8357x_fillScreen(uint16_t color); 87 | extern void hx8357x_drawPixel(int16_t x, int16_t y, uint16_t color); 88 | extern void hx8357x_setRotation(uint8_t x); 89 | extern uint16_t hx8357x_readPixel(int16_t x, int16_t y); 90 | 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /src/ili932x.cpp: -------------------------------------------------------------------------------- 1 | // IMPORTANT: LIBRARY MUST BE SPECIFICALLY CONFIGURED FOR EITHER TFT SHIELD 2 | // OR BREAKOUT BOARD USAGE. SEE RELEVANT COMMENTS IN Adafruit_TFTLCD.h 3 | 4 | // Graphics library by ladyada/adafruit with init code from Rossum 5 | // MIT license 6 | 7 | 8 | #include "Adafruit_common.h" 9 | 10 | #include "ili932x.h" 11 | 12 | static uint8_t rotation; 13 | static int _width, _height; 14 | /*****************************************************************************/ 15 | static const uint16_t ILI932x_regValues[] = { 16 | ILI932X_START_OSC , 0x0001, // Start oscillator 17 | TFTLCD_DELAY , 50, // 50 millisecond delay 18 | ILI932X_DRIV_OUT_CTRL , 0x0100, 19 | ILI932X_DRIV_WAV_CTRL , 0x0700, 20 | ILI932X_ENTRY_MOD , 0x1030, 21 | ILI932X_RESIZE_CTRL , 0x0000, 22 | ILI932X_DISP_CTRL2 , 0x0202, 23 | ILI932X_DISP_CTRL3 , 0x0000, 24 | ILI932X_DISP_CTRL4 , 0x0000, 25 | ILI932X_RGB_DISP_IF_CTRL1, 0x0, 26 | ILI932X_FRM_MARKER_POS , 0x0, 27 | ILI932X_RGB_DISP_IF_CTRL2, 0x0, 28 | ILI932X_POW_CTRL1 , 0x0000, 29 | ILI932X_POW_CTRL2 , 0x0007, 30 | ILI932X_POW_CTRL3 , 0x0000, 31 | ILI932X_POW_CTRL4 , 0x0000, 32 | TFTLCD_DELAY , 200, 33 | ILI932X_POW_CTRL1 , 0x1690, 34 | ILI932X_POW_CTRL2 , 0x0227, 35 | TFTLCD_DELAY , 50, 36 | ILI932X_POW_CTRL3 , 0x001A, 37 | TFTLCD_DELAY , 50, 38 | ILI932X_POW_CTRL4 , 0x1800, 39 | ILI932X_POW_CTRL7 , 0x002A, 40 | TFTLCD_DELAY , 50, 41 | ILI932X_GAMMA_CTRL1 , 0x0000, 42 | ILI932X_GAMMA_CTRL2 , 0x0000, 43 | ILI932X_GAMMA_CTRL3 , 0x0000, 44 | ILI932X_GAMMA_CTRL4 , 0x0206, 45 | ILI932X_GAMMA_CTRL5 , 0x0808, 46 | ILI932X_GAMMA_CTRL6 , 0x0007, 47 | ILI932X_GAMMA_CTRL7 , 0x0201, 48 | ILI932X_GAMMA_CTRL8 , 0x0000, 49 | ILI932X_GAMMA_CTRL9 , 0x0000, 50 | ILI932X_GAMMA_CTRL10 , 0x0000, 51 | ILI932X_GRAM_HOR_AD , 0x0000, 52 | ILI932X_GRAM_VER_AD , 0x0000, 53 | ILI932X_HOR_START_AD , 0x0000, 54 | ILI932X_HOR_END_AD , 0x00EF, 55 | ILI932X_VER_START_AD , 0X0000, 56 | ILI932X_VER_END_AD , 0x013F, 57 | ILI932X_GATE_SCAN_CTRL1 , 0xA700, // Driver Output Control (R60h) 58 | ILI932X_GATE_SCAN_CTRL2 , 0x0003, // Driver Output Control (R61h) 59 | ILI932X_GATE_SCAN_CTRL3 , 0x0000, // Driver Output Control (R62h) 60 | ILI932X_PANEL_IF_CTRL1 , 0X0010, // Panel Interface Control 1 (R90h) 61 | ILI932X_PANEL_IF_CTRL2 , 0X0000, 62 | ILI932X_PANEL_IF_CTRL3 , 0X0003, 63 | ILI932X_PANEL_IF_CTRL4 , 0X1100, 64 | ILI932X_PANEL_IF_CTRL5 , 0X0000, 65 | ILI932X_PANEL_IF_CTRL6 , 0X0000, 66 | ILI932X_DISP_CTRL1 , 0x0133, // Main screen turn on 67 | }; 68 | 69 | 70 | /*****************************************************************************/ 71 | void ili932x_begin(void) 72 | { 73 | //Serial.println("initializing ILI932x..."); 74 | uint16_t a, d; 75 | uint8_t i = 0; 76 | 77 | while(i < sizeof(ILI932x_regValues) / sizeof(uint16_t)) { 78 | a = pgm_read_word(&ILI932x_regValues[i++]); 79 | d = pgm_read_word(&ILI932x_regValues[i++]); 80 | if(a == TFTLCD_DELAY) delay(d); 81 | else { 82 | //Serial.print("writing to 0x"); Serial.print(a,HEX); Serial.print(" value: 0x"); Serial.println(d,HEX); 83 | writeRegister16(a, d); 84 | } 85 | } 86 | rotation = 0; 87 | ili932x_setRotation(rotation); 88 | //setAddrWindow(0, 0, TFTWIDTH-1, TFTHEIGHT-1); // done in setRotation() 89 | } 90 | 91 | /*****************************************************************************/ 92 | // Sets the LCD address window (and address counter, on 932X). 93 | // Relevant to rect/screen fills and H/V lines. Input coordinates are 94 | // assumed pre-sorted (e.g. x2 >= x1). 95 | /*****************************************************************************/ 96 | void ili932x_setAddrWindow(int x1, int y1, int x2, int y2) 97 | { 98 | // Values passed are in current (possibly rotated) coordinate 99 | // system. 932X requires hardware-native coords regardless of 100 | // MADCTL, so rotate inputs as needed. The address counter is 101 | // set to the top-left corner -- although fill operations can be 102 | // done in any direction, the current screen rotation is applied 103 | // because some users find it disconcerting when a fill does not 104 | // occur top-to-bottom. 105 | int x, y, t; 106 | switch(rotation) { 107 | default: 108 | x = x1; 109 | y = y1; 110 | break; 111 | case 1: 112 | t = y1; 113 | y1 = x1; 114 | x1 = TFTWIDTH - 1 - y2; 115 | y2 = x2; 116 | x2 = TFTWIDTH - 1 - t; 117 | x = x2; 118 | y = y1; 119 | break; 120 | case 2: 121 | t = x1; 122 | x1 = TFTWIDTH - 1 - x2; 123 | x2 = TFTWIDTH - 1 - t; 124 | t = y1; 125 | y1 = TFTHEIGHT - 1 - y2; 126 | y2 = TFTHEIGHT - 1 - t; 127 | x = x2; 128 | y = y2; 129 | break; 130 | case 3: 131 | t = x1; 132 | x1 = y1; 133 | y1 = TFTHEIGHT - 1 - x2; 134 | x2 = y2; 135 | y2 = TFTHEIGHT - 1 - t; 136 | x = x1; 137 | y = y2; 138 | break; 139 | } 140 | //Serial.print("setAddrWindow: rot: "); Serial.print(rotation); Serial.print(", x1: "); Serial.print(x1); Serial.print(", y1: "); Serial.print(y1); Serial.print(", x2: "); Serial.print(x2); Serial.print(", y2: "); Serial.println(y2); 141 | writeRegister16(ILI932X_HOR_START_AD, x1); // Set window address 142 | writeRegister16(ILI932X_HOR_END_AD, x2); 143 | writeRegister16(ILI932X_VER_START_AD, y1); 144 | writeRegister16(ILI932X_VER_END_AD, y2); 145 | writeRegister16(ILI932X_GRAM_HOR_AD, x ); // Set address counter to top left 146 | writeRegister16(ILI932X_GRAM_VER_AD, y ); 147 | } 148 | 149 | /*****************************************************************************/ 150 | void ili932x_fillScreen(uint16_t color) 151 | { 152 | //Serial.println("932x fill screen..."); 153 | // For the 932X, a full-screen address window is already the default 154 | // state, just need to set the address pointer to the top-left corner. 155 | // Although we could fill in any direction, the code uses the current 156 | // screen rotation because some users find it disconcerting when a 157 | // fill does not occur top-to-bottom. 158 | uint16_t x, y; 159 | switch(rotation) { 160 | default: x = 0 ; y = 0 ; break; 161 | case 1 : x = TFTWIDTH - 1; y = 0 ; break; 162 | case 2 : x = TFTWIDTH - 1; y = TFTHEIGHT - 1; break; 163 | case 3 : x = 0 ; y = TFTHEIGHT - 1; break; 164 | } 165 | writeRegister16(ILI932X_GRAM_HOR_AD, x); 166 | writeRegister16(ILI932X_GRAM_VER_AD, y); 167 | } 168 | 169 | /*****************************************************************************/ 170 | void ili932x_drawPixel(int16_t x, int16_t y, uint16_t color) 171 | { 172 | int16_t t; 173 | switch(rotation) { 174 | case 1: 175 | t = x; 176 | x = TFTWIDTH - 1 - y; 177 | y = t; 178 | break; 179 | case 2: 180 | x = TFTWIDTH - 1 - x; 181 | y = TFTHEIGHT - 1 - y; 182 | break; 183 | case 3: 184 | t = x; 185 | x = y; 186 | y = TFTHEIGHT - 1 - t; 187 | break; 188 | } 189 | writeRegister16(ILI932X_GRAM_HOR_AD, x); 190 | writeRegister16(ILI932X_GRAM_VER_AD, y); 191 | writeRegister16(ILI932X_RW_GRAM, color); 192 | } 193 | 194 | /*****************************************************************************/ 195 | void ili932x_invertDisplay(boolean i) 196 | { 197 | //uint16_t r = readReg(ILI932X_GATE_SCAN_CTRL2); 198 | //r = i ? (r&BIT0) : (r|BIT0); 199 | writeRegister16(ILI932X_GATE_SCAN_CTRL2, i ? 1 : 0); // MADCTL 200 | } 201 | 202 | /*****************************************************************************/ 203 | void ili932x_setRotation(uint8_t rot) 204 | { 205 | uint16_t t; 206 | rotation = rot&3; 207 | switch(rotation) { 208 | default: t = 0x1030; _width = TFTWIDTH; _height = TFTHEIGHT; break; 209 | case 1 : t = 0x1028; _width = TFTHEIGHT; _height = TFTWIDTH; break; 210 | case 2 : t = 0x1000; _width = TFTWIDTH; _height = TFTHEIGHT; break; 211 | case 3 : t = 0x1018; _width = TFTHEIGHT; _height = TFTWIDTH; break; 212 | } 213 | writeRegister16(ILI932X_ENTRY_MOD, t ); // MADCTL 214 | //Serial.print("setRotation: w: "); Serial.print(_width-1); 215 | // For 932X, init default full-screen address window: 216 | ili932x_setAddrWindow(0, 0, _width-1, _height-1); 217 | } 218 | 219 | #if 0 // used TFT does not support read access 220 | /*****************************************************************************/ 221 | uint16_t ili932x_readPixel(int16_t x, int16_t y) 222 | { 223 | int16_t t,r; 224 | switch(rotation) { 225 | case 1: 226 | t = x; 227 | x = _width - 1 - y; 228 | y = t; 229 | break; 230 | case 2: 231 | x = _width - 1 - x; 232 | y = _height - 1 - y; 233 | break; 234 | case 3: 235 | t = x; 236 | x = y; 237 | y = _height - 1 - t; 238 | break; 239 | } 240 | writeRegister16(ILI932X_GRAM_HOR_AD, x); 241 | writeRegister16(ILI932X_GRAM_VER_AD, y); 242 | // Inexplicable thing: sometimes pixel read has high/low bytes 243 | // reversed. A second read fixes this. Unsure of reason. Have 244 | // tried adjusting timing in read8() etc. to no avail. 245 | for(uint8_t pass=0; pass<2; pass++) { 246 | r = readReg(ILI932X_RW_GRAM); // Read data from GRAM 247 | } 248 | return r; 249 | } 250 | #endif 251 | -------------------------------------------------------------------------------- /src/ili932x.h: -------------------------------------------------------------------------------- 1 | #ifndef _ILI932X_H_ 2 | #define _ILI932X_H_ 3 | 4 | 5 | // Register names from Peter Barrett's Microtouch code 6 | #define ILI932X_START_OSC 0x00 7 | #define ILI932X_DRIV_OUT_CTRL 0x01 8 | #define ILI932X_DRIV_WAV_CTRL 0x02 9 | #define ILI932X_ENTRY_MOD 0x03 10 | #define ILI932X_RESIZE_CTRL 0x04 11 | #define ILI932X_DISP_CTRL1 0x07 12 | #define ILI932X_DISP_CTRL2 0x08 13 | #define ILI932X_DISP_CTRL3 0x09 14 | #define ILI932X_DISP_CTRL4 0x0A 15 | #define ILI932X_RGB_DISP_IF_CTRL1 0x0C 16 | #define ILI932X_FRM_MARKER_POS 0x0D 17 | #define ILI932X_RGB_DISP_IF_CTRL2 0x0F 18 | #define ILI932X_POW_CTRL1 0x10 19 | #define ILI932X_POW_CTRL2 0x11 20 | #define ILI932X_POW_CTRL3 0x12 21 | #define ILI932X_POW_CTRL4 0x13 22 | #define ILI932X_GRAM_HOR_AD 0x20 23 | #define ILI932X_GRAM_VER_AD 0x21 24 | #define ILI932X_RW_GRAM 0x22 25 | #define ILI932X_POW_CTRL7 0x29 26 | #define ILI932X_FRM_RATE_COL_CTRL 0x2B 27 | #define ILI932X_GAMMA_CTRL1 0x30 28 | #define ILI932X_GAMMA_CTRL2 0x31 29 | #define ILI932X_GAMMA_CTRL3 0x32 30 | #define ILI932X_GAMMA_CTRL4 0x35 31 | #define ILI932X_GAMMA_CTRL5 0x36 32 | #define ILI932X_GAMMA_CTRL6 0x37 33 | #define ILI932X_GAMMA_CTRL7 0x38 34 | #define ILI932X_GAMMA_CTRL8 0x39 35 | #define ILI932X_GAMMA_CTRL9 0x3C 36 | #define ILI932X_GAMMA_CTRL10 0x3D 37 | #define ILI932X_HOR_START_AD 0x50 38 | #define ILI932X_HOR_END_AD 0x51 39 | #define ILI932X_VER_START_AD 0x52 40 | #define ILI932X_VER_END_AD 0x53 41 | #define ILI932X_GATE_SCAN_CTRL1 0x60 42 | #define ILI932X_GATE_SCAN_CTRL2 0x61 43 | #define ILI932X_GATE_SCAN_CTRL3 0x6A 44 | #define ILI932X_PART_IMG1_DISP_POS 0x80 45 | #define ILI932X_PART_IMG1_START_AD 0x81 46 | #define ILI932X_PART_IMG1_END_AD 0x82 47 | #define ILI932X_PART_IMG2_DISP_POS 0x83 48 | #define ILI932X_PART_IMG2_START_AD 0x84 49 | #define ILI932X_PART_IMG2_END_AD 0x85 50 | #define ILI932X_PANEL_IF_CTRL1 0x90 51 | #define ILI932X_PANEL_IF_CTRL2 0x92 52 | #define ILI932X_PANEL_IF_CTRL3 0x93 53 | #define ILI932X_PANEL_IF_CTRL4 0x95 54 | #define ILI932X_PANEL_IF_CTRL5 0x97 55 | #define ILI932X_PANEL_IF_CTRL6 0x98 56 | 57 | extern void ili932x_begin(void); 58 | extern void ili932x_setAddrWindow(int x1, int y1, int x2, int y2); 59 | extern void ili932x_fillScreen(uint16_t color); 60 | extern void ili932x_drawPixel(int16_t x, int16_t y, uint16_t color); 61 | extern void ili932x_setRotation(uint8_t x); 62 | extern uint16_t ili932x_readPixel(int16_t x, int16_t y); 63 | extern void ili932x_invertDisplay(boolean i); 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/ili9341.cpp: -------------------------------------------------------------------------------- 1 | // IMPORTANT: LIBRARY MUST BE SPECIFICALLY CONFIGURED FOR EITHER TFT SHIELD 2 | // OR BREAKOUT BOARD USAGE. SEE RELEVANT COMMENTS IN Adafruit_TFTLCD.h 3 | 4 | // Graphics library by ladyada/adafruit with init code from Rossum 5 | // MIT license 6 | 7 | /* 8 | Benchmark Time (microseconds) 9 | --------------------------------------------- 10 | Using GPIO 11 | --------------------------------------------- 12 | Screen fill 104767 13 | Text 10386 14 | Lines 185635 15 | Horiz/Vert Lines 9400 16 | Rectangles (outline) 5971 17 | Rectangles (filled) 255546 18 | Circles (filled) 95452 19 | Circles (outline) 78896 20 | Triangles (outline) 51741 21 | Triangles (filled) 112147 22 | Rounded rects (outline) 26409 23 | Rounded rects (filled) 295197 24 | --------------------------------------------- 25 | Using FSMC: 26 | --------------------------------------------- 27 | Screen fill 48091 28 | Text 5683 29 | Lines 83850 30 | Horiz/Vert Lines 4258 31 | Rectangles (outline) 2655 32 | Rectangles (filled) 117322 33 | Circles (filled) 39360 34 | Circles (outline) 35190 35 | Triangles (outline) 23373 36 | Triangles (filled) 50048 37 | Rounded rects (outline) 12160 38 | Rounded rects (filled) 134562 39 | Done! 40 | 41 | */ 42 | 43 | #include "Adafruit_common.h" 44 | 45 | #include "ili9341.h" 46 | 47 | #define ILI9486 1 48 | 49 | /**/ 50 | #define TFTLCD_DELAY8 0xFF 51 | 52 | const uint8_t ILI9341_regValues_ada[] = { // Adafruit_TFTLCD only works with EXTC=0 53 | // 0xF6, 3, 0x00, 0x01, 0x00, //Interface Control needs EXTC=1 TM=0, RIM=0 54 | // 0xF6, 3, 0x01, 0x01, 0x03, //Interface Control needs EXTC=1 RM=1, RIM=1 55 | /**/ 56 | 0xF6, 3, 0x09, 0x01, 0x03, //Interface Control needs EXTC=1 RM=0, RIM=1 57 | 0xB0, 1, 0x40, //RGB Signal [40] RCM=2 58 | 0xB4, 1, 0x00, //Inversion Control [02] .kbv NLA=1, NLB=1, NLC=1 59 | 0xC0, 1, 0x23, //Power Control 1 [26] 60 | 0xC1, 1, 0x10, //Power Control 2 [00] 61 | 0xC5, 2, 0x2B, 0x2B, //VCOM 1 [31 3C] 62 | 0xC7, 1, 0xC0, //VCOM 2 [C0] 63 | 0x36, 1, 0x48, //Memory Access [00] 64 | 0xB1, 2, 0x00, 0x1B, //Frame Control [00 1B] 65 | 0xB7, 1, 0x07, //Entry Mode [00] 66 | // TFTLCD_DELAY8, 1, 67 | }; 68 | 69 | /* 70 | .write16: 36_write8: 0__write8: 36__write8: 48_ 71 | .write16: 33_write8: 0__write8: 33__write8: 0__write8: 0__write8: 1__write8: 40__write8: 0__write8: 0_ 72 | .write16: 37_write8: 0__write8: 37__write8: 0__write8: 0_ 73 | .write16: 13_write8: 0__write8: 13_ 74 | .write16: 21_write8: 0__write8: 21_ 75 | */ 76 | const uint8_t ILI9341_regValues_post[] = 77 | { // post-init settings, sniffed from David's lib 78 | 0x36, 1, 0x48, //Memory Access [00] 79 | 0x33, 6, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 80 | 0x37, 2, 0x00, 0x00, 81 | 0x13, 0, // normaldisp 82 | 0x21, 0, // invert off 83 | }; 84 | /*****************************************************************************/ 85 | static void WriteCmdParamN(uint16_t cmd, int8_t N, const uint8_t * block) 86 | { 87 | //Serial.print("cmd: "); Serial.print(cmd,HEX); 88 | writeCommand(cmd); 89 | //Serial.print(", data: "); 90 | while (N-- > 0) { 91 | uint8_t u8 = *block++; 92 | CD_DATA; 93 | //Serial.print(u8,HEX); 94 | writeData(0x00FF&u8); 95 | } 96 | CS_IDLE; 97 | //Serial.write('\n'); 98 | } 99 | 100 | /*****************************************************************************/ 101 | static void init_table(const uint8_t *table, int16_t size) 102 | { 103 | while (size > 0) { 104 | uint8_t cmd = *table++; 105 | uint8_t len = *table++; 106 | if (cmd == TFTLCD_DELAY8) { 107 | //Serial.print("delay: "); Serial.println(len); 108 | delay(len); 109 | len = 0; 110 | } else { 111 | WriteCmdParamN(cmd, len, table); 112 | table += len; 113 | } 114 | size -= len + 2; 115 | } 116 | } 117 | 118 | const uint8_t reset_off[] = { 119 | 0x01, 0, //Soft Reset 120 | TFTLCD_DELAY8, 150, // .kbv will power up with ONLY reset, sleep out, display on 121 | 0x28, 0, //Display Off 122 | 0x3A, 1, 0x55, //Pixel read=565, write=565. 123 | #ifdef ILI9486 124 | // PGAMCTRL(Positive Gamma Control) 125 | 0xE0, 15, 0x0F, 0x1F, 0x1C, 0x0C, 0x0F, 0x08, 0x48, 0x98, 126 | 0x37, 0x0A, 0x13, 0x04, 0x11, 0x0D, 0x00, 127 | // NGAMCTRL(Negative Gamma Control) 128 | 0xE1, 15, 0x0F, 0x32, 0x2E, 0x0B, 0x0D, 0x05, 0x47, 0x75, 129 | 0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00, 130 | // Digital Gamma Control 1 131 | 0xE2, 15, 0x0F, 0x32, 0x2E, 0x0B, 0x0D, 0x05, 0x47, 0x75, 132 | 0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00, 133 | #endif 134 | }; 135 | const uint8_t wake_on[] = { 136 | 0x11, 0, //Sleep Out 137 | TFTLCD_DELAY8, 150, 138 | 0x29, 0, //Display On 139 | //additional settings 140 | // 0x21, 0, // invert off 141 | 0x36, 1, 0x48, //Memory Access 142 | 0xB0, 1, 0x40, //RGB Signal [40] RCM=2 143 | }; 144 | /*****************************************************************************/ 145 | void ili9341_begin(void) 146 | { 147 | // Serial.println("\nILI9341 begin..."); 148 | init_table(reset_off, sizeof(reset_off)); 149 | //init_table(ILI9341_regValues_ada, sizeof(ILI9341_regValues_ada)); //can change PIXFMT 150 | init_table(wake_on, sizeof(wake_on)); 151 | //init_table(ILI9341_regValues_post, sizeof(ILI9341_regValues_post)); 152 | } 153 | 154 | /*****************************************************************************/ 155 | // Sets the LCD address window. Relevant to all write routines. 156 | // Input coordinates are assumed pre-sorted (e.g. x2 >= x1). 157 | /*****************************************************************************/ 158 | void ili9341_setAddrWindow(int16_t x1, int16_t y1, int16_t x2, int16_t y2) 159 | { 160 | writeRegister32(ILI9341_COLADDRSET, ((uint32_t)(x1<<16) | x2)); // HX8357D uses same registers! 161 | writeRegister32(ILI9341_PAGEADDRSET, ((uint32_t)(y1<<16) | y2)); // HX8357D uses same registers! 162 | } 163 | 164 | /*****************************************************************************/ 165 | void ili9341_fillScreen(uint16_t color) 166 | { 167 | } 168 | 169 | /*****************************************************************************/ 170 | void ili9341_drawPixel(int16_t x, int16_t y, uint16_t color) 171 | { 172 | } 173 | 174 | /*****************************************************************************/ 175 | void ili9341_setRotation(uint8_t x) 176 | { 177 | } 178 | 179 | /*****************************************************************************/ 180 | uint16_t ili9341_readPixel(int16_t x, int16_t y) 181 | { 182 | return 0; 183 | } 184 | -------------------------------------------------------------------------------- /src/ili9341.h: -------------------------------------------------------------------------------- 1 | #ifndef _ILI9341_H_ 2 | #define _ILI9341_H_ 3 | 4 | 5 | // Register names 6 | #define ILI9341_SOFTRESET 0x01 7 | #define ILI9341_SLEEPIN 0x10 8 | #define ILI9341_SLEEPOUT 0x11 9 | #define ILI9341_NORMALDISP 0x13 10 | #define ILI9341_INVERTOFF 0x20 11 | #define ILI9341_INVERTON 0x21 12 | #define ILI9341_GAMMASET 0x26 13 | #define ILI9341_DISPLAYOFF 0x28 14 | #define ILI9341_DISPLAYON 0x29 15 | #define ILI9341_COLADDRSET 0x2A 16 | #define ILI9341_PAGEADDRSET 0x2B 17 | #define ILI9341_MEMORYWRITE 0x2C 18 | #define ILI9341_PIXELFORMAT 0x3A 19 | #define ILI9341_FRAMECONTROL 0xB1 20 | #define ILI9341_DISPLAYFUNC 0xB6 21 | #define ILI9341_ENTRYMODE 0xB7 22 | #define ILI9341_POWERCONTROL1 0xC0 23 | #define ILI9341_POWERCONTROL2 0xC1 24 | #define ILI9341_VCOMCONTROL1 0xC5 25 | #define ILI9341_VCOMCONTROL2 0xC7 26 | #define ILI9341_MEMCONTROL 0x36 27 | #define ILI9341_MADCTL 0x36 28 | 29 | #define ILI9341_MADCTL_MY 0x80 30 | #define ILI9341_MADCTL_MX 0x40 31 | #define ILI9341_MADCTL_MV 0x20 32 | #define ILI9341_MADCTL_ML 0x10 33 | #define ILI9341_MADCTL_RGB 0x00 34 | #define ILI9341_MADCTL_BGR 0x08 35 | #define ILI9341_MADCTL_MH 0x04 36 | 37 | 38 | /*****************************************************************************/ 39 | extern void ili9341_begin(void); 40 | extern void ili9341_setAddrWindow(int16_t x1, int16_t y1, int16_t x2, int16_t y2); 41 | extern void ili9341_fillScreen(uint16_t color); 42 | extern void ili9341_drawPixel(int16_t x, int16_t y, uint16_t color); 43 | extern void ili9341_setRotation(uint8_t x); 44 | extern uint16_t ili9341_readPixel(int16_t x, int16_t y); 45 | 46 | 47 | #endif 48 | --------------------------------------------------------------------------------