├── .gitattributes ├── .gitignore ├── DefaultFonts.c ├── License - CC BY-NC-SA 3.0 - Legal.pdf ├── License - CC BY-NC-SA 3.0 - Summary.pdf ├── README.md ├── Tools ├── ImageConverter565.exe ├── ImgConv.exe ├── Online-tool - ImageConverter 565.url └── UTFT Image Converters.pdf ├── UTFT.cpp ├── UTFT.h ├── UTFT.pdf ├── UTFT_Requirements.pdf ├── UTFT_Supported_display_modules_&_controllers.pdf ├── examples ├── Arduino (ARM) + Teensy │ ├── UTFT_Bitmap │ │ ├── UTFT_Bitmap.ino │ │ ├── icon.c │ │ ├── info.c │ │ └── tux.c │ ├── UTFT_Bitmap_128x128 │ │ ├── UTFT_Bitmap_128x128.ino │ │ ├── icon1.c │ │ ├── icon2.c │ │ └── tux.c │ ├── UTFT_CPLD_PageSwitching │ │ └── UTFT_CPLD_PageSwitching.ino │ ├── UTFT_Demo_128x128_Serial │ │ └── UTFT_Demo_128x128_Serial.ino │ ├── UTFT_Demo_160x128_Serial │ │ └── UTFT_Demo_160x128_Serial.ino │ ├── UTFT_Demo_220x176 │ │ └── UTFT_Demo_220x176.ino │ ├── UTFT_Demo_220x176_Serial │ │ └── UTFT_Demo_220x176_Serial.ino │ ├── UTFT_Demo_320x240 │ │ └── UTFT_Demo_320x240.ino │ ├── UTFT_Demo_320x240_Serial │ │ └── UTFT_Demo_320x240_Serial.ino │ ├── UTFT_Demo_400x240 │ │ └── UTFT_Demo_400x240.ino │ ├── UTFT_Demo_480x272 │ │ └── UTFT_Demo_480x272.ino │ ├── UTFT_Demo_480x320 │ │ └── UTFT_Demo_480x320.ino │ ├── UTFT_Demo_800x480 │ │ └── UTFT_Demo_800x480.ino │ ├── UTFT_Rotate_Bitmap │ │ ├── UTFT_Rotate_Bitmap.ino │ │ └── biohazard.c │ ├── UTFT_Textrotation_Demo │ │ └── UTFT_Textrotation_Demo.ino │ └── UTFT_ViewFont │ │ └── UTFT_ViewFont.ino ├── Arduino (AVR) │ ├── UTFT_Benchmark_400x240 │ │ └── UTFT_Benchmark_400x240.ino │ ├── UTFT_Bitmap │ │ ├── UTFT_Bitmap.ino │ │ ├── icon.c │ │ ├── info.c │ │ └── tux.c │ ├── UTFT_Bitmap_128x128 │ │ ├── UTFT_Bitmap_128x128.ino │ │ ├── icon1.c │ │ ├── icon2.c │ │ └── tux.c │ ├── UTFT_CPLD_PageSwitching │ │ └── UTFT_CPLD_PageSwitching.ino │ ├── UTFT_Demo_128x128_Serial │ │ └── UTFT_Demo_128x128_Serial.ino │ ├── UTFT_Demo_160x128_Serial │ │ └── UTFT_Demo_160x128_Serial.ino │ ├── UTFT_Demo_220x176 │ │ └── UTFT_Demo_220x176.ino │ ├── UTFT_Demo_220x176_Serial │ │ └── UTFT_Demo_220x176_Serial.ino │ ├── UTFT_Demo_320x240 │ │ └── UTFT_Demo_320x240.ino │ ├── UTFT_Demo_320x240_Serial │ │ └── UTFT_Demo_320x240_Serial.ino │ ├── UTFT_Demo_400x240 │ │ └── UTFT_Demo_400x240.ino │ ├── UTFT_Demo_480x272 │ │ └── UTFT_Demo_480x272.ino │ ├── UTFT_Demo_480x320 │ │ └── UTFT_Demo_480x320.ino │ ├── UTFT_Demo_800x480 │ │ └── UTFT_Demo_800x480.ino │ ├── UTFT_Leonardo_Demo_320x240 │ │ └── UTFT_Leonardo_Demo_320x240.ino │ ├── UTFT_Rotate_Bitmap │ │ ├── UTFT_Rotate_Bitmap.ino │ │ └── tux.c │ ├── UTFT_Textrotation_Demo │ │ └── UTFT_Textrotation_Demo.ino │ └── UTFT_ViewFont │ │ └── UTFT_ViewFont.ino └── chipKit │ ├── UTFT_Bitmap │ ├── UTFT_Bitmap.pde │ ├── icon.c │ ├── info.c │ └── tux.c │ ├── UTFT_Bitmap_128x128 │ ├── UTFT_Bitmap_128x128.pde │ ├── icon1.c │ ├── icon2.c │ └── tux.c │ ├── UTFT_Demo_128x128_Serial │ └── UTFT_Demo_128x128_Serial.pde │ ├── UTFT_Demo_160x128_Serial │ └── UTFT_Demo_160x128_Serial.pde │ ├── UTFT_Demo_220x176 │ └── UTFT_Demo_220x176.pde │ ├── UTFT_Demo_220x176_Serial │ └── UTFT_Demo_220x176_Serial.pde │ ├── UTFT_Demo_320x240 │ └── UTFT_Demo_320x240.pde │ ├── UTFT_Demo_320x240_Serial │ └── UTFT_Demo_320x240_Serial.pde │ ├── UTFT_Demo_400x240 │ └── UTFT_Demo_400x240.pde │ ├── UTFT_Demo_480x272 │ └── UTFT_Demo_480x272.pde │ ├── UTFT_Demo_480x320 │ └── UTFT_Demo_480x320.pde │ ├── UTFT_Demo_800x480 │ └── UTFT_Demo_800x480.pde │ ├── UTFT_Rotate_Bitmap │ ├── UTFT_Rotate_Bitmap.pde │ └── biohazard.c │ ├── UTFT_Textrotation_Demo │ └── UTFT_Textrotation_Demo.pde │ └── UTFT_ViewFont │ └── UTFT_ViewFont.pde ├── hardware ├── arm │ ├── HW_ARM.h │ ├── HW_ARM_defines.h │ ├── HW_MX20DX256.h │ └── HW_SAM3X8E.h ├── avr │ ├── HW_ATmega1280.h │ ├── HW_ATmega1284P.h │ ├── HW_ATmega328P.h │ ├── HW_ATmega32U4.h │ ├── HW_AVR.h │ └── HW_AVR_defines.h └── pic32 │ ├── HW_PIC32.h │ ├── HW_PIC32MX320F128H.h │ ├── HW_PIC32MX340F512H.h │ ├── HW_PIC32MX795F512L.h │ └── HW_PIC32_defines.h ├── keywords.txt ├── memorysaver.h ├── tft_drivers ├── cpld │ ├── initlcd.h │ └── setxy.h ├── hx8340b │ ├── 8 │ │ ├── initlcd.h │ │ └── setxy.h │ └── s │ │ ├── initlcd.h │ │ └── setxy.h ├── hx8347a │ ├── initlcd.h │ └── setxy.h ├── hx8352a │ ├── initlcd.h │ └── setxy.h ├── hx8353c │ ├── initlcd.h │ └── setxy.h ├── ili9320 │ ├── initlcd.h │ └── setxy.h ├── ili9325c │ ├── initlcd.h │ └── setxy.h ├── ili9325d │ ├── alt │ │ ├── initlcd.h │ │ └── setxy.h │ └── default │ │ ├── initlcd.h │ │ └── setxy.h ├── ili9327 │ ├── initlcd.h │ └── setxy.h ├── ili9327_8 │ ├── initlcd.h │ └── setxy.h ├── ili9341 │ ├── s4p │ │ ├── initlcd.h │ │ └── setxy.h │ └── s5p │ │ ├── initlcd.h │ │ └── setxy.h ├── ili9481 │ ├── initlcd.h │ └── setxy.h ├── ili9486 │ ├── initlcd.h │ └── setxy.h ├── pcf8833 │ ├── initlcd.h │ └── setxy.h ├── r61581 │ ├── initlcd.h │ └── setxy.h ├── s1d19122 │ ├── initlcd.h │ └── setxy.h ├── s6d0164 │ ├── initlcd.h │ └── setxy.h ├── s6d1121 │ ├── initlcd.h │ └── setxy.h ├── ssd1289 │ ├── initlcd.h │ └── setxy.h ├── ssd1963 │ ├── 480 │ │ ├── initlcd.h │ │ └── setxy.h │ ├── 800 │ │ ├── initlcd.h │ │ └── setxy.h │ └── 800alt │ │ ├── initlcd.h │ │ └── setxy.h ├── st7735 │ ├── initlcd.h │ └── setxy.h └── st7735s │ ├── initlcd.h │ └── setxy.h └── version.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.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 | # ========================= 18 | # Operating System Files 19 | # ========================= 20 | 21 | # OSX 22 | # ========================= 23 | 24 | .DS_Store 25 | .AppleDouble 26 | .LSOverride 27 | 28 | # Icon must ends with two \r. 29 | Icon 30 | 31 | 32 | # Thumbnails 33 | ._* 34 | 35 | # Files that might appear on external disk 36 | .Spotlight-V100 37 | .Trashes 38 | .idea 39 | *.iml -------------------------------------------------------------------------------- /License - CC BY-NC-SA 3.0 - Legal.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgolda/UTFT/cecc1cbdd3c2f14a2928baabaed0d095d4e23a91/License - CC BY-NC-SA 3.0 - Legal.pdf -------------------------------------------------------------------------------- /License - CC BY-NC-SA 3.0 - Summary.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgolda/UTFT/cecc1cbdd3c2f14a2928baabaed0d095d4e23a91/License - CC BY-NC-SA 3.0 - Summary.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Unofficial version of UTFT library 2 | ================================== 3 | Note: I've added alias ILI9327_8 for display type NIC35WS 4 | 5 | This UTFT library original written by Henning Karlsen (see: http://www.henningkarlsen.com/electronics/library.php?id=51) 6 | is modified by Damian Golda (based on NIC work) to support 3.5" TFTLCD for Arduino MEGA (2560) from mcufriend.com 7 | (ILI9327 8 bit with customized timings etc). 8 | 9 | THIS library was tested ONLY on: 10 | 1) Arduino MEGA clone and '3.5" TFTLCD for arduino 2560 from mcufriend.com' using: 11 | UTFT myGLCD(ILI9327_8,38,39,40,41); //3.5" TFTLCD for arduino 2560 from mcufriend.com on MEGA 12 | 13 | 2) Arduino UNO clone and '3.5" TFTLCD for arduino 2560 from mcufriend.com' (this display is for MEGA board!) using 14 | UTFT myGLCD(ILI9327_8,A2,A1,A3,A4); //3.5" TFTLCD for arduino 2560 from mcufriend.com on UNO 15 | 16 | THIS library was NOT TESTED on Arduino UNO nor other displays, but if it works, please send me a note about your configuration and used arguments 17 | 18 | This version IS NOT SUPPORTED by Henning Karlsen. 19 | If you have problems - create issue on GitHub. 20 | 21 | ## Instalation 22 | 1. If you have installed original UTFT from Henning Karlsen, then first remove (or rename) UTFT frolder from Arduino Library folder 23 | 2. "Download":https://github.com/dgolda/UTFT/archive/master.zip the Master branch from gitHub. 24 | 3. Unzip and modify the Folder name to "UTFT" (Remove the '-master') 25 | 4. Paste the modified folder on your Library folder (On your `Libraries` folder inside Sketchbooks or Arduino software). 26 | 27 | To test your display - open in Arduino IDE: Examples, UTFT, Arduino (AVR), UTFT_Demo_400x240.ino 28 | 29 | Or make your own sketch using `ILI9327_8` driver: 30 | 31 | UTFT myGLCD(ILI9327_8,38,39,40,41); //3.5" TFTLCD for arduino 2560 from mcufriend.com 32 | 33 | ## History 34 | 35 | * version 1.0 of original library from Henning Karlsen was modified by unknown author(s) to support 3.5" TFTLCD for arduino 2560 from mcufriend.com 36 | * merge changes from version 1.3, all customized code was put in conditional directives 37 | * merge changes from version 2.1 38 | * merge changes from version 2.41 39 | * merge changes from version 2.76 40 | * merge changes from version 2.77 41 | * merge changes from version 2.78 42 | -------------------------------------------------------------------------------- /Tools/ImageConverter565.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgolda/UTFT/cecc1cbdd3c2f14a2928baabaed0d095d4e23a91/Tools/ImageConverter565.exe -------------------------------------------------------------------------------- /Tools/ImgConv.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgolda/UTFT/cecc1cbdd3c2f14a2928baabaed0d095d4e23a91/Tools/ImgConv.exe -------------------------------------------------------------------------------- /Tools/Online-tool - ImageConverter 565.url: -------------------------------------------------------------------------------- 1 | [InternetShortcut] 2 | URL=http://www.henningkarlsen.com/electronics/t_imageconverter565.php 3 | IDList= 4 | IconFile=http://www.henningkarlsen.com/favicon.ico 5 | IconIndex=1 6 | [{000214A0-0000-0000-C000-000000000046}] 7 | Prop3=19,2 8 | -------------------------------------------------------------------------------- /Tools/UTFT Image Converters.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgolda/UTFT/cecc1cbdd3c2f14a2928baabaed0d095d4e23a91/Tools/UTFT Image Converters.pdf -------------------------------------------------------------------------------- /UTFT.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgolda/UTFT/cecc1cbdd3c2f14a2928baabaed0d095d4e23a91/UTFT.pdf -------------------------------------------------------------------------------- /UTFT_Requirements.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgolda/UTFT/cecc1cbdd3c2f14a2928baabaed0d095d4e23a91/UTFT_Requirements.pdf -------------------------------------------------------------------------------- /UTFT_Supported_display_modules_&_controllers.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgolda/UTFT/cecc1cbdd3c2f14a2928baabaed0d095d4e23a91/UTFT_Supported_display_modules_&_controllers.pdf -------------------------------------------------------------------------------- /examples/Arduino (ARM) + Teensy/UTFT_Bitmap/UTFT_Bitmap.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Bitmap (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the drawBitmap()-function. 5 | // 6 | // This demo was made to work on the 320x240 modules. 7 | // Any other size displays may cause strange behaviour. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | 14 | // Declare which fonts we will be using 15 | extern uint8_t SmallFont[]; 16 | 17 | // Set the pins to the correct ones for your development shield 18 | // ------------------------------------------------------------ 19 | // Standard Arduino Mega/Due shield : ,38,39,40,41 20 | // CTE TFT LCD/SD Shield for Arduino Due : ,25,26,27,28 21 | // Teensy 3.x TFT Test Board : ,23,22, 3, 4 22 | // ElecHouse TFT LCD/SD Shield for Arduino Due : ,22,23,31,33 23 | // 24 | // Remember to change the model parameter to suit your display module! 25 | UTFT myGLCD(ITDB32S,38,39,40,41); 26 | 27 | extern unsigned short info[0x400]; 28 | extern unsigned short icon[0x400]; 29 | extern unsigned short tux[0x400]; 30 | 31 | void setup() 32 | { 33 | myGLCD.InitLCD(); 34 | myGLCD.setFont(SmallFont); 35 | } 36 | 37 | void loop() 38 | { 39 | myGLCD.fillScr(255, 255, 255); 40 | myGLCD.setColor(255, 255, 255); 41 | myGLCD.print(" *** A 10 by 7 grid of a 32x32 icon *** ", CENTER, 228); 42 | for (int x=0; x<10; x++) 43 | for (int y=0; y<7; y++) 44 | myGLCD.drawBitmap (x*32, y*32, 32, 32, info); 45 | 46 | delay(5000); 47 | 48 | myGLCD.fillScr(255, 255, 255); 49 | myGLCD.setColor(255, 255, 255); 50 | myGLCD.print(" Two different icons in scale 1 to 4 ", CENTER, 228); 51 | int x=0; 52 | for (int s=0; s<4; s++) 53 | { 54 | x+=(s*32); 55 | myGLCD.drawBitmap (x, 0, 32, 32, tux, s+1); 56 | } 57 | x=0; 58 | for (int s=4; s>0; s--) 59 | { 60 | myGLCD.drawBitmap (x, 224-(s*32), 32, 32, icon, s); 61 | x+=(s*32); 62 | } 63 | 64 | delay(5000); 65 | } 66 | 67 | -------------------------------------------------------------------------------- /examples/Arduino (ARM) + Teensy/UTFT_Bitmap_128x128/UTFT_Bitmap_128x128.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Bitmap_128x128 (C)2013 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the drawBitmap()-function. 5 | // 6 | // This demo was made to work on the 128x128 modules. 7 | // Any other size displays may cause strange behaviour. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | 14 | UTFT myGLCD(LPH9135,6,5,2,3,4); // Remember to change the model parameter to suit your display module! 15 | 16 | extern unsigned short icon1[0x400]; 17 | extern unsigned short icon2[0x400]; 18 | extern unsigned short tux[0x1000]; 19 | 20 | void setup() 21 | { 22 | myGLCD.InitLCD(PORTRAIT); 23 | } 24 | 25 | void loop() 26 | { 27 | // Draw a 4 by 4 grid of a 32x32 icon. 28 | myGLCD.fillScr(255, 255, 255); 29 | for (int x=0; x<4; x++) 30 | for (int y=0; y<4; y++) 31 | myGLCD.drawBitmap (x*32, y*32, 32, 32, icon1); 32 | 33 | delay(5000); 34 | 35 | // Draw a 64x64 icon in double size. 36 | myGLCD.fillScr(255, 255, 255); 37 | myGLCD.drawBitmap (0, 0, 64, 64, tux, 2); 38 | 39 | delay(5000); 40 | 41 | // Draw a 2 by 2 grid of a 32x32 icon in double size. 42 | myGLCD.fillScr(255, 255, 255); 43 | for (int x=0; x<2; x++) 44 | for (int y=0; y<2; y++) 45 | myGLCD.drawBitmap (x*64, y*64, 32, 32, icon2, 2); 46 | 47 | delay(5000); 48 | } 49 | 50 | -------------------------------------------------------------------------------- /examples/Arduino (ARM) + Teensy/UTFT_CPLD_PageSwitching/UTFT_CPLD_PageSwitching.ino: -------------------------------------------------------------------------------- 1 | // UTFT_CPLD_PageSwitching (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of page switching on CPLD-based display modules.. 5 | // 6 | // This demo was made for modules with a screen resolution 7 | // of 800x480 pixels. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | // NOTE: The display will be black for a short while during the start 12 | // 13 | 14 | #include 15 | 16 | // Declare which fonts we will be using 17 | extern uint8_t BigFont[]; 18 | extern uint8_t SevenSegNumFont[]; 19 | 20 | // Set the pins to the correct ones for your development shield 21 | // ------------------------------------------------------------ 22 | // Standard Arduino Mega/Due shield : ,38,39,40,41 23 | // CTE TFT LCD/SD Shield for Arduino Due : ,25,26,27,28 24 | // Teensy 3.x TFT Test Board : ,23,22, 3, 4 25 | // ElecHouse TFT LCD/SD Shield for Arduino Due : ,22,23,31,33 26 | // 27 | // Remember to change the model parameter to suit your display module! 28 | UTFT myGLCD(EHOUSE50CPLD,22,23,31,33); 29 | 30 | void setup() 31 | { 32 | myGLCD.InitLCD(); 33 | } 34 | 35 | void loop() 36 | { 37 | myGLCD.setBackColor(VGA_TRANSPARENT); 38 | 39 | myGLCD.setBrightness(0); 40 | for (byte pg=0; pg<8; pg++) 41 | { 42 | myGLCD.setWritePage(pg); 43 | myGLCD.clrScr(); 44 | for (int ln=0; ln<480; ln+=2) 45 | { 46 | switch (pg) 47 | { 48 | case 0: 49 | myGLCD.setColor(ln/2, 0, 0); 50 | break; 51 | case 1: 52 | myGLCD.setColor(0, ln/2, 0); 53 | break; 54 | case 2: 55 | myGLCD.setColor(0, 0, ln/2); 56 | break; 57 | case 3: 58 | myGLCD.setColor(ln/4, ln/2, 0); 59 | break; 60 | case 4: 61 | myGLCD.setColor(0, ln/2, ln/2); 62 | break; 63 | case 5: 64 | myGLCD.setColor(ln/2, 0, ln/2); 65 | break; 66 | case 6: 67 | myGLCD.setColor(ln/2, ln/2, 0); 68 | break; 69 | case 7: 70 | myGLCD.setColor(0, ln/2, ln/4); 71 | break; 72 | } 73 | myGLCD.drawLine(0, ln, 799, ln); 74 | myGLCD.drawLine(0, ln+1, 799, ln+1); 75 | } 76 | myGLCD.setColor(VGA_WHITE); 77 | myGLCD.setFont(BigFont); 78 | myGLCD.print("This is page:", CENTER, 200); 79 | myGLCD.setFont(SevenSegNumFont); 80 | myGLCD.printNumI(pg, CENTER, 240); 81 | } 82 | myGLCD.setBrightness(16); 83 | 84 | while(1) 85 | { 86 | for (byte pg=0; pg<8; pg++) 87 | { 88 | myGLCD.setDisplayPage(pg); 89 | delay(500); 90 | } 91 | } 92 | } 93 | 94 | -------------------------------------------------------------------------------- /examples/Arduino (ARM) + Teensy/UTFT_Demo_800x480/UTFT_Demo_800x480.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Demo_800x480 (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of how to use most of the functions 5 | // of the library with a supported display modules. 6 | // 7 | // This demo was made for modules with a screen resolution 8 | // of 800x480 pixels. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | 13 | #include 14 | 15 | // Declare which fonts we will be using 16 | extern uint8_t SmallFont[]; 17 | 18 | // Set the pins to the correct ones for your development shield 19 | // ------------------------------------------------------------ 20 | // Standard Arduino Mega/Due shield : ,38,39,40,41 21 | // CTE TFT LCD/SD Shield for Arduino Due : ,25,26,27,28 22 | // Teensy 3.x TFT Test Board : ,23,22, 3, 4 23 | // ElecHouse TFT LCD/SD Shield for Arduino Due : ,22,23,31,33 24 | // 25 | // Remember to change the model parameter to suit your display module! 26 | UTFT myGLCD(ITDB50,38,39,40,41); 27 | 28 | void setup() 29 | { 30 | randomSeed(analogRead(0)); 31 | 32 | // Setup the LCD 33 | myGLCD.InitLCD(); 34 | myGLCD.setFont(SmallFont); 35 | } 36 | 37 | void loop() 38 | { 39 | int buf[798]; 40 | int x, x2; 41 | int y, y2; 42 | int r; 43 | 44 | // Clear the screen and draw the frame 45 | myGLCD.clrScr(); 46 | 47 | myGLCD.setColor(255, 0, 0); 48 | myGLCD.fillRect(0, 0, 799, 13); 49 | myGLCD.setColor(64, 64, 64); 50 | myGLCD.fillRect(0, 466, 799, 479); 51 | myGLCD.setColor(255, 255, 255); 52 | myGLCD.setBackColor(255, 0, 0); 53 | myGLCD.print("* Universal Color TFT Display Library *", CENTER, 1); 54 | myGLCD.setBackColor(64, 64, 64); 55 | myGLCD.setColor(255,255,0); 56 | myGLCD.print("", CENTER, 467); 57 | 58 | myGLCD.setColor(0, 0, 255); 59 | myGLCD.drawRect(0, 14, 799, 465); 60 | 61 | // Draw crosshairs 62 | myGLCD.setColor(0, 0, 255); 63 | myGLCD.setBackColor(0, 0, 0); 64 | myGLCD.drawLine(399, 15, 399, 464); 65 | myGLCD.drawLine(1, 239, 798, 239); 66 | for (int i=9; i<790; i+=10) 67 | myGLCD.drawLine(i, 237, i, 242); 68 | for (int i=19; i<470; i+=10) 69 | myGLCD.drawLine(397, i, 402, i); 70 | 71 | // Draw sin-, cos- and tan-lines 72 | myGLCD.setColor(0,255,255); 73 | myGLCD.print("Sin", 5, 15); 74 | for (int i=1; i<798; i++) 75 | { 76 | myGLCD.drawPixel(i,239+(sin(((i*1.13)*3.14)/180)*200)); 77 | } 78 | 79 | myGLCD.setColor(255,0,0); 80 | myGLCD.print("Cos", 5, 27); 81 | for (int i=1; i<798; i++) 82 | { 83 | myGLCD.drawPixel(i,239+(cos(((i*1.13)*3.14)/180)*200)); 84 | } 85 | 86 | myGLCD.setColor(255,255,0); 87 | myGLCD.print("Tan", 5, 39); 88 | for (int i=1; i<798; i++) 89 | { 90 | myGLCD.drawPixel(i,239+(tan(((i*0.9)*3.14)/180))); 91 | } 92 | 93 | delay(2000); 94 | 95 | myGLCD.setColor(0,0,0); 96 | myGLCD.fillRect(1,15,798,464); 97 | myGLCD.setColor(0, 0, 255); 98 | myGLCD.setBackColor(0, 0, 0); 99 | myGLCD.drawLine(399, 15, 399, 464); 100 | myGLCD.drawLine(1, 239, 798, 239); 101 | 102 | // Draw a moving sinewave 103 | x=1; 104 | for (int i=1; i<(798*20); i++) 105 | { 106 | x++; 107 | if (x==799) 108 | x=1; 109 | if (i>799) 110 | { 111 | if ((x==399)||(buf[x-1]==239)) 112 | myGLCD.setColor(0,0,255); 113 | else 114 | myGLCD.setColor(0,0,0); 115 | myGLCD.drawPixel(x,buf[x-1]); 116 | } 117 | myGLCD.setColor(0,255,255); 118 | y=239+(sin(((i*1.65)*3.14)/180)*(200-(i / 100))); 119 | myGLCD.drawPixel(x,y); 120 | buf[x-1]=y; 121 | } 122 | 123 | delay(2000); 124 | 125 | myGLCD.setColor(0,0,0); 126 | myGLCD.fillRect(1,15,798,464); 127 | 128 | // Draw some random filled rectangles 129 | for (int i=0; i<50; i++) 130 | { 131 | myGLCD.setColor(random(255), random(255), random(255)); 132 | x=2+random(746); 133 | y=16+random(397); 134 | x2=x+50; 135 | y2=y+50; 136 | myGLCD.fillRect(x, y, x2, y2); 137 | } 138 | 139 | delay(2000); 140 | 141 | myGLCD.setColor(0,0,0); 142 | myGLCD.fillRect(1,15,798,464); 143 | 144 | // Draw some random filled, rounded rectangles 145 | for (int i=0; i<50; i++) 146 | { 147 | myGLCD.setColor(random(255), random(255), random(255)); 148 | x=2+random(746); 149 | y=16+random(397); 150 | x2=x+50; 151 | y2=y+50; 152 | myGLCD.fillRoundRect(x, y, x2, y2); 153 | } 154 | 155 | delay(2000); 156 | 157 | myGLCD.setColor(0,0,0); 158 | myGLCD.fillRect(1,15,798,464); 159 | 160 | // Draw some random filled circles 161 | for (int i=0; i<50; i++) 162 | { 163 | myGLCD.setColor(random(255), random(255), random(255)); 164 | x=27+random(746); 165 | y=41+random(397); 166 | myGLCD.fillCircle(x, y, 25); 167 | } 168 | 169 | delay(2000); 170 | 171 | myGLCD.setColor(0,0,0); 172 | myGLCD.fillRect(1,15,798,464); 173 | 174 | // Draw some lines in a pattern 175 | myGLCD.setColor (255,0,0); 176 | for (int i=15; i<463; i+=5) 177 | { 178 | myGLCD.drawLine(1, i, (i*1.66)-10, 463); 179 | } 180 | myGLCD.setColor (255,0,0); 181 | for (int i=463; i>15; i-=5) 182 | { 183 | myGLCD.drawLine(798, i, (i*1.66)+30, 15); 184 | } 185 | myGLCD.setColor (0,255,255); 186 | for (int i=463; i>15; i-=5) 187 | { 188 | myGLCD.drawLine(1, i, 770-(i*1.66), 15); 189 | } 190 | myGLCD.setColor (0,255,255); 191 | for (int i=15; i<463; i+=5) 192 | { 193 | myGLCD.drawLine(798, i, 810-(i*1.66), 463); 194 | } 195 | 196 | delay(2000); 197 | 198 | myGLCD.setColor(0,0,0); 199 | myGLCD.fillRect(1,15,798,464); 200 | 201 | // Draw some random circles 202 | for (int i=0; i<250; i++) 203 | { 204 | myGLCD.setColor(random(255), random(255), random(255)); 205 | x=32+random(736); 206 | y=45+random(386); 207 | r=random(30); 208 | myGLCD.drawCircle(x, y, r); 209 | } 210 | 211 | delay(2000); 212 | 213 | myGLCD.setColor(0,0,0); 214 | myGLCD.fillRect(1,15,798,464); 215 | 216 | // Draw some random rectangles 217 | for (int i=0; i<250; i++) 218 | { 219 | myGLCD.setColor(random(255), random(255), random(255)); 220 | x=2+random(796); 221 | y=16+random(447); 222 | x2=2+random(796); 223 | y2=16+random(447); 224 | myGLCD.drawRect(x, y, x2, y2); 225 | } 226 | 227 | delay(2000); 228 | 229 | myGLCD.setColor(0,0,0); 230 | myGLCD.fillRect(1,15,798,464); 231 | 232 | // Draw some random rounded rectangles 233 | for (int i=0; i<250; i++) 234 | { 235 | myGLCD.setColor(random(255), random(255), random(255)); 236 | x=2+random(796); 237 | y=16+random(447); 238 | x2=2+random(796); 239 | y2=16+random(447); 240 | myGLCD.drawRoundRect(x, y, x2, y2); 241 | } 242 | 243 | delay(2000); 244 | 245 | myGLCD.setColor(0,0,0); 246 | myGLCD.fillRect(1,15,798,464); 247 | 248 | for (int i=0; i<250; i++) 249 | { 250 | myGLCD.setColor(random(255), random(255), random(255)); 251 | x=2+random(796); 252 | y=16+random(447); 253 | x2=2+random(796); 254 | y2=16+random(447); 255 | myGLCD.drawLine(x, y, x2, y2); 256 | } 257 | 258 | delay(2000); 259 | 260 | myGLCD.setColor(0,0,0); 261 | myGLCD.fillRect(1,15,798,464); 262 | 263 | for (int i=0; i<10000; i++) 264 | { 265 | myGLCD.setColor(random(255), random(255), random(255)); 266 | myGLCD.drawPixel(2+random(796), 16+random(447)); 267 | } 268 | 269 | delay(2000); 270 | 271 | myGLCD.fillScr(0, 0, 255); 272 | myGLCD.setColor(255, 0, 0); 273 | myGLCD.fillRoundRect(320, 190, 479, 289); 274 | 275 | myGLCD.setColor(255, 255, 255); 276 | myGLCD.setBackColor(255, 0, 0); 277 | myGLCD.print("That's it!", CENTER, 213); 278 | myGLCD.print("Restarting in a", CENTER, 239); 279 | myGLCD.print("few seconds...", CENTER, 252); 280 | 281 | myGLCD.setColor(0, 255, 0); 282 | myGLCD.setBackColor(0, 0, 255); 283 | myGLCD.print("Runtime: (msecs)", CENTER, 450); 284 | myGLCD.printNumI(millis(), CENTER, 465); 285 | 286 | delay (10000); 287 | } 288 | 289 | -------------------------------------------------------------------------------- /examples/Arduino (ARM) + Teensy/UTFT_Rotate_Bitmap/UTFT_Rotate_Bitmap.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Rotate_Bitmap (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the drawBitmap()-function. 5 | // 6 | // This program requires the UTFT library. 7 | // 8 | 9 | #include 10 | 11 | // Set the pins to the correct ones for your development shield 12 | // ------------------------------------------------------------ 13 | // Standard Arduino Mega/Due shield : ,38,39,40,41 14 | // CTE TFT LCD/SD Shield for Arduino Due : ,25,26,27,28 15 | // Teensy 3.x TFT Test Board : ,23,22, 3, 4 16 | // ElecHouse TFT LCD/SD Shield for Arduino Due : ,22,23,31,33 17 | // 18 | // Remember to change the model parameter to suit your display module! 19 | UTFT myGLCD(ITDB32S,38,39,40,41); 20 | 21 | extern unsigned short biohazard[0x1000]; 22 | 23 | void setup() 24 | { 25 | myGLCD.InitLCD(LANDSCAPE); 26 | myGLCD.fillScr(255, 255, 255); 27 | myGLCD.setColor(0, 0, 0); 28 | } 29 | 30 | void loop() 31 | { 32 | for (int i=0; i<360; i+=5) 33 | { 34 | myGLCD.drawBitmap (10, 10, 64, 64, biohazard, i, 32, 32); 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /examples/Arduino (ARM) + Teensy/UTFT_Textrotation_Demo/UTFT_Textrotation_Demo.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Textrotation_Demo (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the textrotation-functions. 5 | // 6 | // This demo was made for modules with a screen resolution 7 | // of 320x240 pixels. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | 14 | // Declare which fonts we will be using 15 | extern uint8_t BigFont[]; 16 | extern uint8_t SevenSegNumFont[]; 17 | 18 | // Set the pins to the correct ones for your development shield 19 | // ------------------------------------------------------------ 20 | // Standard Arduino Mega/Due shield : ,38,39,40,41 21 | // CTE TFT LCD/SD Shield for Arduino Due : ,25,26,27,28 22 | // Teensy 3.x TFT Test Board : ,23,22, 3, 4 23 | // ElecHouse TFT LCD/SD Shield for Arduino Due : ,22,23,31,33 24 | // 25 | // Remember to change the model parameter to suit your display module! 26 | UTFT myGLCD(ITDB32S,38,39,40,41); 27 | 28 | void setup() 29 | { 30 | myGLCD.InitLCD(); 31 | myGLCD.clrScr(); 32 | myGLCD.setFont(BigFont); 33 | } 34 | 35 | void loop() 36 | { 37 | myGLCD.print("Text rotation", 0, 0); 38 | myGLCD.setColor(0, 0, 255); 39 | myGLCD.print("0 degrees", 0, 16, 0); 40 | myGLCD.print("90 degrees", 319, 0, 90); 41 | myGLCD.print("180 degrees", 319, 239, 180); 42 | myGLCD.print("270 degrees", 0, 239, 270); 43 | 44 | myGLCD.setFont(SevenSegNumFont); 45 | myGLCD.setColor(0, 255, 0); 46 | myGLCD.print("45", 90, 100, 45); 47 | myGLCD.print("90", 200, 50, 90); 48 | myGLCD.print("180", 300, 200, 180); 49 | 50 | while (true) {}; 51 | } 52 | 53 | -------------------------------------------------------------------------------- /examples/Arduino (ARM) + Teensy/UTFT_ViewFont/UTFT_ViewFont.ino: -------------------------------------------------------------------------------- 1 | // UTFT_ViewFont (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the included fonts. 5 | // 6 | // This demo was made for modules with a screen resolution 7 | // of 320x240 pixels. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | 14 | // Declare which fonts we will be using 15 | extern uint8_t SmallFont[]; 16 | extern uint8_t BigFont[]; 17 | extern uint8_t SevenSegNumFont[]; 18 | 19 | // Set the pins to the correct ones for your development shield 20 | // ------------------------------------------------------------ 21 | // Standard Arduino Mega/Due shield : ,38,39,40,41 22 | // CTE TFT LCD/SD Shield for Arduino Due : ,25,26,27,28 23 | // Teensy 3.x TFT Test Board : ,23,22, 3, 4 24 | // ElecHouse TFT LCD/SD Shield for Arduino Due : ,22,23,31,33 25 | // 26 | // Remember to change the model parameter to suit your display module! 27 | UTFT myGLCD(ITDB32S,38,39,40,41); 28 | 29 | void setup() 30 | { 31 | myGLCD.InitLCD(); 32 | 33 | myGLCD.clrScr(); 34 | } 35 | 36 | void loop() 37 | { 38 | myGLCD.setColor(0, 255, 0); 39 | myGLCD.setBackColor(0, 0, 0); 40 | 41 | myGLCD.setFont(BigFont); 42 | myGLCD.print(" !\"#$%&'()*+,-./", CENTER, 0); 43 | myGLCD.print("0123456789:;<=>?", CENTER, 16); 44 | myGLCD.print("@ABCDEFGHIJKLMNO", CENTER, 32); 45 | myGLCD.print("PQRSTUVWXYZ[\\]^_", CENTER, 48); 46 | myGLCD.print("`abcdefghijklmno", CENTER, 64); 47 | myGLCD.print("pqrstuvwxyz{|}~ ", CENTER, 80); 48 | 49 | myGLCD.setFont(SmallFont); 50 | myGLCD.print(" !\"#$%&'()*+,-./0123456789:;<=>?", CENTER, 120); 51 | myGLCD.print("@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_", CENTER, 132); 52 | myGLCD.print("`abcdefghijklmnopqrstuvwxyz{|}~ ", CENTER, 144); 53 | 54 | myGLCD.setFont(SevenSegNumFont); 55 | myGLCD.print("0123456789", CENTER, 190); 56 | 57 | while(1) {}; 58 | } 59 | 60 | -------------------------------------------------------------------------------- /examples/Arduino (AVR)/UTFT_Bitmap/UTFT_Bitmap.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Bitmap (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the drawBitmap()-function. 5 | // 6 | // This demo was made to work on the 320x240 modules. 7 | // Any other size displays may cause strange behaviour. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | #include 14 | 15 | // Declare which fonts we will be using 16 | extern uint8_t SmallFont[]; 17 | 18 | // Set the pins to the correct ones for your development shield 19 | // ------------------------------------------------------------ 20 | // Arduino Uno / 2009: 21 | // ------------------- 22 | // Standard Arduino Uno/2009 shield : ,A5,A4,A3,A2 23 | // DisplayModule Arduino Uno TFT shield : ,A5,A4,A3,A2 24 | // 25 | // Arduino Mega: 26 | // ------------------- 27 | // Standard Arduino Mega/Due shield : ,38,39,40,41 28 | // CTE TFT LCD/SD Shield for Arduino Mega : ,38,39,40,41 29 | // 30 | // Remember to change the model parameter to suit your display module! 31 | UTFT myGLCD(ITDB32S,A5,A4,A3,A2); 32 | 33 | extern unsigned int info[0x400]; 34 | extern unsigned int icon[0x400]; 35 | extern unsigned int tux[0x400]; 36 | 37 | void setup() 38 | { 39 | myGLCD.InitLCD(); 40 | myGLCD.setFont(SmallFont); 41 | } 42 | 43 | void loop() 44 | { 45 | myGLCD.fillScr(255, 255, 255); 46 | myGLCD.setColor(255, 255, 255); 47 | myGLCD.print(" *** A 10 by 7 grid of a 32x32 icon *** ", CENTER, 228); 48 | for (int x=0; x<10; x++) 49 | for (int y=0; y<7; y++) 50 | myGLCD.drawBitmap (x*32, y*32, 32, 32, info); 51 | 52 | delay(5000); 53 | 54 | myGLCD.fillScr(255, 255, 255); 55 | myGLCD.setColor(255, 255, 255); 56 | myGLCD.print(" Two different icons in scale 1 to 4 ", CENTER, 228); 57 | int x=0; 58 | for (int s=0; s<4; s++) 59 | { 60 | x+=(s*32); 61 | myGLCD.drawBitmap (x, 0, 32, 32, tux, s+1); 62 | } 63 | x=0; 64 | for (int s=4; s>0; s--) 65 | { 66 | myGLCD.drawBitmap (x, 224-(s*32), 32, 32, icon, s); 67 | x+=(s*32); 68 | } 69 | 70 | delay(5000); 71 | } 72 | -------------------------------------------------------------------------------- /examples/Arduino (AVR)/UTFT_Bitmap_128x128/UTFT_Bitmap_128x128.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Bitmap_128x128 (C)2012 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the drawBitmap()-function. 5 | // 6 | // This demo was made to work on the 128x128 modules. 7 | // Any other size displays may cause strange behaviour. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | #include 14 | 15 | UTFT myGLCD(LPH9135,6,5,2,3,4); // Remember to change the model parameter to suit your display module! 16 | 17 | extern unsigned int icon1[0x400]; 18 | extern unsigned int icon2[0x400]; 19 | extern unsigned int tux[0x1000]; 20 | 21 | void setup() 22 | { 23 | myGLCD.InitLCD(PORTRAIT); 24 | } 25 | 26 | void loop() 27 | { 28 | // Draw a 4 by 4 grid of a 32x32 icon. 29 | myGLCD.fillScr(255, 255, 255); 30 | for (int x=0; x<4; x++) 31 | for (int y=0; y<4; y++) 32 | myGLCD.drawBitmap (x*32, y*32, 32, 32, icon1); 33 | 34 | delay(5000); 35 | 36 | // Draw a 64x64 icon in double size. 37 | myGLCD.fillScr(255, 255, 255); 38 | myGLCD.drawBitmap (0, 0, 64, 64, tux, 2); 39 | 40 | delay(5000); 41 | 42 | // Draw a 2 by 2 grid of a 32x32 icon in double size. 43 | myGLCD.fillScr(255, 255, 255); 44 | for (int x=0; x<2; x++) 45 | for (int y=0; y<2; y++) 46 | myGLCD.drawBitmap (x*64, y*64, 32, 32, icon2, 2); 47 | 48 | delay(5000); 49 | } 50 | 51 | -------------------------------------------------------------------------------- /examples/Arduino (AVR)/UTFT_CPLD_PageSwitching/UTFT_CPLD_PageSwitching.ino: -------------------------------------------------------------------------------- 1 | // UTFT_CPLD_PageSwitching (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of page switching on CPLD-based display modules.. 5 | // 6 | // This demo was made for modules with a screen resolution 7 | // of 800x480 pixels. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | // NOTE: The display will be black for 10-15 seconds during the start 12 | // 13 | 14 | #include 15 | 16 | // Declare which fonts we will be using 17 | extern uint8_t BigFont[]; 18 | extern uint8_t SevenSegNumFont[]; 19 | 20 | // Set the pins to the correct ones for your development shield 21 | // ------------------------------------------------------------ 22 | // Arduino Mega: 23 | // ------------------- 24 | // Standard Arduino Mega/Due shield : ,38,39,40,41 25 | // CTE TFT LCD/SD Shield for Arduino Mega : ,38,39,40,41 26 | // 27 | // Remember to change the model parameter to suit your display module! 28 | UTFT myGLCD(CPLD,38,39,40,41); 29 | 30 | void setup() 31 | { 32 | myGLCD.InitLCD(); 33 | } 34 | 35 | void loop() 36 | { 37 | myGLCD.setBackColor(VGA_TRANSPARENT); 38 | 39 | myGLCD.setBrightness(0); 40 | for (byte pg=0; pg<8; pg++) 41 | { 42 | myGLCD.setWritePage(pg); 43 | myGLCD.clrScr(); 44 | for (int ln=0; ln<480; ln+=2) 45 | { 46 | switch (pg) 47 | { 48 | case 0: 49 | myGLCD.setColor(ln/2, 0, 0); 50 | break; 51 | case 1: 52 | myGLCD.setColor(0, ln/2, 0); 53 | break; 54 | case 2: 55 | myGLCD.setColor(0, 0, ln/2); 56 | break; 57 | case 3: 58 | myGLCD.setColor(ln/4, ln/2, 0); 59 | break; 60 | case 4: 61 | myGLCD.setColor(0, ln/2, ln/2); 62 | break; 63 | case 5: 64 | myGLCD.setColor(ln/2, 0, ln/2); 65 | break; 66 | case 6: 67 | myGLCD.setColor(ln/2, ln/2, 0); 68 | break; 69 | case 7: 70 | myGLCD.setColor(0, ln/2, ln/4); 71 | break; 72 | } 73 | myGLCD.drawLine(0, ln, 799, ln); 74 | myGLCD.drawLine(0, ln+1, 799, ln+1); 75 | } 76 | myGLCD.setColor(VGA_WHITE); 77 | myGLCD.setFont(BigFont); 78 | myGLCD.print("This is page:", CENTER, 200); 79 | myGLCD.setFont(SevenSegNumFont); 80 | myGLCD.printNumI(pg, CENTER, 240); 81 | } 82 | myGLCD.setBrightness(16); 83 | 84 | while(1) 85 | { 86 | for (byte pg=0; pg<8; pg++) 87 | { 88 | myGLCD.setDisplayPage(pg); 89 | delay(500); 90 | } 91 | } 92 | } 93 | 94 | -------------------------------------------------------------------------------- /examples/Arduino (AVR)/UTFT_Demo_220x176_Serial/UTFT_Demo_220x176_Serial.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Demo_220x176_Serial (C)2012 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of how to use most of the functions 5 | // of the library with a supported display modules. 6 | // 7 | // This demo was made for serial modules with a screen resolution 8 | // of 220x176 pixels. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | 13 | #include 14 | 15 | // Declare which fonts we will be using 16 | extern uint8_t SmallFont[]; 17 | 18 | UTFT myGLCD(ITDB22SP,11,10,9,12); // Remember to change the model parameter to suit your display module! 19 | 20 | void setup() 21 | { 22 | randomSeed(analogRead(0)); 23 | 24 | // Setup the LCD 25 | myGLCD.InitLCD(); 26 | myGLCD.setFont(SmallFont); 27 | } 28 | 29 | void loop() 30 | { 31 | int buf[218]; 32 | int x, x2; 33 | int y, y2; 34 | int r; 35 | 36 | // Clear the screen and draw the frame 37 | myGLCD.clrScr(); 38 | 39 | myGLCD.setColor(255, 0, 0); 40 | myGLCD.fillRect(0, 0, 219, 13); 41 | myGLCD.setColor(64, 64, 64); 42 | myGLCD.fillRect(0, 162, 219, 175); 43 | myGLCD.setColor(255, 255, 255); 44 | myGLCD.setBackColor(255, 0, 0); 45 | myGLCD.print("** Universal TFT Library **", CENTER, 1); 46 | myGLCD.setBackColor(64, 64, 64); 47 | myGLCD.setColor(255,255,0); 48 | myGLCD.print("> elec.henningkarlsen.com <", CENTER, 163); 49 | 50 | myGLCD.setColor(0, 0, 255); 51 | myGLCD.drawRect(0, 14, 219, 161); 52 | 53 | // Draw crosshairs 54 | myGLCD.setColor(0, 0, 255); 55 | myGLCD.setBackColor(0, 0, 0); 56 | myGLCD.drawLine(109, 15, 109, 160); 57 | myGLCD.drawLine(1, 88, 218, 88); 58 | 59 | for (int i=9; i<210; i+=10) 60 | myGLCD.drawLine(i, 86, i, 90); 61 | for (int i=19; i<155; i+=10) 62 | myGLCD.drawLine(107, i, 111, i); 63 | 64 | // Draw sin-, cos- and tan-lines 65 | myGLCD.setColor(0,255,255); 66 | myGLCD.print("Sin", 5, 15); 67 | for (int i=1; i<218; i++) 68 | { 69 | myGLCD.drawPixel(i,88+(sin(((i*1.65)*3.14)/180)*70)); 70 | } 71 | 72 | myGLCD.setColor(255,0,0); 73 | myGLCD.print("Cos", 5, 27); 74 | for (int i=1; i<218; i++) 75 | { 76 | myGLCD.drawPixel(i,88+(cos(((i*1.65)*3.14)/180)*70)); 77 | } 78 | 79 | myGLCD.setColor(255,255,0); 80 | myGLCD.print("Tan", 5, 39); 81 | for (int i=1; i<218; i++) 82 | { 83 | myGLCD.drawPixel(i,88+(tan(((i*1.65)*3.14)/180))); 84 | } 85 | 86 | delay(2000); 87 | 88 | myGLCD.setColor(0,0,0); 89 | myGLCD.fillRect(1,15,218,160); 90 | myGLCD.setColor(0, 0, 255); 91 | myGLCD.setBackColor(0, 0, 0); 92 | myGLCD.drawLine(109, 15, 109, 160); 93 | myGLCD.drawLine(1, 88, 218, 88); 94 | 95 | // Draw a moving sinewave 96 | x=1; 97 | for (int i=1; i<(218*20); i++) 98 | { 99 | x++; 100 | if (x==219) 101 | x=1; 102 | if (i>219) 103 | { 104 | if ((x==109)||(buf[x-1]==88)) 105 | myGLCD.setColor(0,0,255); 106 | else 107 | myGLCD.setColor(0,0,0); 108 | myGLCD.drawPixel(x,buf[x-1]); 109 | } 110 | myGLCD.setColor(0,255,255); 111 | y=88+(sin(((i*1.6)*3.14)/180)*(65-(i / 100))); 112 | myGLCD.drawPixel(x,y); 113 | buf[x-1]=y; 114 | } 115 | 116 | delay(2000); 117 | 118 | myGLCD.setColor(0,0,0); 119 | myGLCD.fillRect(1,15,218,160); 120 | 121 | // Draw some filled rectangles 122 | for (int i=1; i<6; i++) 123 | { 124 | switch (i) 125 | { 126 | case 1: 127 | myGLCD.setColor(255,0,255); 128 | break; 129 | case 2: 130 | myGLCD.setColor(255,0,0); 131 | break; 132 | case 3: 133 | myGLCD.setColor(0,255,0); 134 | break; 135 | case 4: 136 | myGLCD.setColor(0,0,255); 137 | break; 138 | case 5: 139 | myGLCD.setColor(255,255,0); 140 | break; 141 | } 142 | myGLCD.fillRect(44+(i*15), 23+(i*15), 88+(i*15), 63+(i*15)); 143 | } 144 | 145 | delay(2000); 146 | 147 | myGLCD.setColor(0,0,0); 148 | myGLCD.fillRect(1,15,218,160); 149 | 150 | // Draw some filled, rounded rectangles 151 | for (int i=1; i<6; i++) 152 | { 153 | switch (i) 154 | { 155 | case 1: 156 | myGLCD.setColor(255,0,255); 157 | break; 158 | case 2: 159 | myGLCD.setColor(255,0,0); 160 | break; 161 | case 3: 162 | myGLCD.setColor(0,255,0); 163 | break; 164 | case 4: 165 | myGLCD.setColor(0,0,255); 166 | break; 167 | case 5: 168 | myGLCD.setColor(255,255,0); 169 | break; 170 | } 171 | myGLCD.fillRoundRect(132-(i*15), 23+(i*15), 172-(i*15), 63+(i*15)); 172 | } 173 | 174 | delay(2000); 175 | 176 | myGLCD.setColor(0,0,0); 177 | myGLCD.fillRect(1,15,218,160); 178 | 179 | // Draw some filled circles 180 | for (int i=1; i<6; i++) 181 | { 182 | switch (i) 183 | { 184 | case 1: 185 | myGLCD.setColor(255,0,255); 186 | break; 187 | case 2: 188 | myGLCD.setColor(255,0,0); 189 | break; 190 | case 3: 191 | myGLCD.setColor(0,255,0); 192 | break; 193 | case 4: 194 | myGLCD.setColor(0,0,255); 195 | break; 196 | case 5: 197 | myGLCD.setColor(255,255,0); 198 | break; 199 | } 200 | myGLCD.fillCircle(64+(i*15),43+(i*15), 20); 201 | } 202 | 203 | delay(2000); 204 | 205 | myGLCD.setColor(0,0,0); 206 | myGLCD.fillRect(1,15,218,160); 207 | 208 | // Draw some lines in a pattern 209 | myGLCD.setColor (255,0,0); 210 | for (int i=15; i<160; i+=5) 211 | { 212 | myGLCD.drawLine(1, i, (i*1.44)-10, 160); 213 | } 214 | myGLCD.setColor (255,0,0); 215 | for (int i=160; i>15; i-=5) 216 | { 217 | myGLCD.drawLine(218, i, (i*1.44)-12, 15); 218 | } 219 | myGLCD.setColor (0,255,255); 220 | for (int i=160; i>15; i-=5) 221 | { 222 | myGLCD.drawLine(1, i, 232-(i*1.44), 15); 223 | } 224 | myGLCD.setColor (0,255,255); 225 | for (int i=15; i<160; i+=5) 226 | { 227 | myGLCD.drawLine(218, i, 231-(i*1.44), 160); 228 | } 229 | 230 | delay(2000); 231 | 232 | myGLCD.setColor(0,0,0); 233 | myGLCD.fillRect(1,15,218,161); 234 | 235 | // Draw some random circles 236 | for (int i=0; i<100; i++) 237 | { 238 | myGLCD.setColor(random(255), random(255), random(255)); 239 | x=22+random(176); 240 | y=35+random(105); 241 | r=random(20); 242 | myGLCD.drawCircle(x, y, r); 243 | } 244 | 245 | delay(2000); 246 | 247 | myGLCD.setColor(0,0,0); 248 | myGLCD.fillRect(1,15,218,160); 249 | 250 | // Draw some random rectangles 251 | for (int i=0; i<100; i++) 252 | { 253 | myGLCD.setColor(random(255), random(255), random(255)); 254 | x=2+random(216); 255 | y=16+random(143); 256 | x2=2+random(216); 257 | y2=16+random(143); 258 | myGLCD.drawRect(x, y, x2, y2); 259 | } 260 | 261 | delay(2000); 262 | 263 | myGLCD.setColor(0,0,0); 264 | myGLCD.fillRect(1,15,218,160); 265 | 266 | // Draw some random rounded rectangles 267 | for (int i=0; i<100; i++) 268 | { 269 | myGLCD.setColor(random(255), random(255), random(255)); 270 | x=2+random(216); 271 | y=16+random(143); 272 | x2=2+random(216); 273 | y2=16+random(143); 274 | myGLCD.drawRoundRect(x, y, x2, y2); 275 | } 276 | 277 | delay(2000); 278 | 279 | myGLCD.setColor(0,0,0); 280 | myGLCD.fillRect(1,15,218,160); 281 | 282 | for (int i=0; i<100; i++) 283 | { 284 | myGLCD.setColor(random(255), random(255), random(255)); 285 | x=2+random(216); 286 | y=16+random(143); 287 | x2=2+random(216); 288 | y2=16+random(143); 289 | myGLCD.drawLine(x, y, x2, y2); 290 | } 291 | 292 | delay(2000); 293 | 294 | myGLCD.setColor(0,0,0); 295 | myGLCD.fillRect(1,15,218,160); 296 | 297 | for (int i=0; i<10000; i++) 298 | { 299 | myGLCD.setColor(random(255), random(255), random(255)); 300 | myGLCD.drawPixel(2+random(216), 16+random(143)); 301 | } 302 | 303 | delay(2000); 304 | 305 | myGLCD.fillScr(0, 0, 255); 306 | myGLCD.setColor(255, 0, 0); 307 | myGLCD.fillRoundRect(40, 57, 179, 119); 308 | 309 | myGLCD.setColor(255, 255, 255); 310 | myGLCD.setBackColor(255, 0, 0); 311 | myGLCD.print("That's it!", CENTER, 62); 312 | myGLCD.print("Restarting in a", CENTER, 88); 313 | myGLCD.print("few seconds...", CENTER, 101); 314 | 315 | myGLCD.setColor(0, 255, 0); 316 | myGLCD.setBackColor(0, 0, 255); 317 | myGLCD.print("Runtime: (msecs)", CENTER, 146); 318 | myGLCD.printNumI(millis(), CENTER, 161); 319 | 320 | delay (10000); 321 | } 322 | 323 | -------------------------------------------------------------------------------- /examples/Arduino (AVR)/UTFT_Demo_800x480/UTFT_Demo_800x480.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Demo_800x480 (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of how to use most of the functions 5 | // of the library with a supported display modules. 6 | // 7 | // This demo was made for modules with a screen resolution 8 | // of 800x480 pixels. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | 13 | #include 14 | 15 | // Declare which fonts we will be using 16 | extern uint8_t SmallFont[]; 17 | 18 | // Set the pins to the correct ones for your development shield 19 | // ------------------------------------------------------------ 20 | // Arduino Uno / 2009: 21 | // ------------------- 22 | // Standard Arduino Uno/2009 shield : ,A5,A4,A3,A2 23 | // DisplayModule Arduino Uno TFT shield : ,A5,A4,A3,A2 24 | // 25 | // Arduino Mega: 26 | // ------------------- 27 | // Standard Arduino Mega/Due shield : ,38,39,40,41 28 | // CTE TFT LCD/SD Shield for Arduino Mega : ,38,39,40,41 29 | // 30 | // Remember to change the model parameter to suit your display module! 31 | UTFT myGLCD(ITDB50,38,39,40,41); 32 | 33 | void setup() 34 | { 35 | randomSeed(analogRead(0)); 36 | 37 | // Setup the LCD 38 | myGLCD.InitLCD(); 39 | myGLCD.setFont(SmallFont); 40 | } 41 | 42 | void loop() 43 | { 44 | int buf[798]; 45 | int x, x2; 46 | int y, y2; 47 | int r; 48 | 49 | // Clear the screen and draw the frame 50 | myGLCD.clrScr(); 51 | 52 | myGLCD.setColor(255, 0, 0); 53 | myGLCD.fillRect(0, 0, 799, 13); 54 | myGLCD.setColor(64, 64, 64); 55 | myGLCD.fillRect(0, 466, 799, 479); 56 | myGLCD.setColor(255, 255, 255); 57 | myGLCD.setBackColor(255, 0, 0); 58 | myGLCD.print("* Universal Color TFT Display Library *", CENTER, 1); 59 | myGLCD.setBackColor(64, 64, 64); 60 | myGLCD.setColor(255,255,0); 61 | myGLCD.print("", CENTER, 467); 62 | 63 | myGLCD.setColor(0, 0, 255); 64 | myGLCD.drawRect(0, 14, 799, 465); 65 | 66 | // Draw crosshairs 67 | myGLCD.setColor(0, 0, 255); 68 | myGLCD.setBackColor(0, 0, 0); 69 | myGLCD.drawLine(399, 15, 399, 464); 70 | myGLCD.drawLine(1, 239, 798, 239); 71 | for (int i=9; i<790; i+=10) 72 | myGLCD.drawLine(i, 237, i, 242); 73 | for (int i=19; i<470; i+=10) 74 | myGLCD.drawLine(397, i, 402, i); 75 | 76 | // Draw sin-, cos- and tan-lines 77 | myGLCD.setColor(0,255,255); 78 | myGLCD.print("Sin", 5, 15); 79 | for (int i=1; i<798; i++) 80 | { 81 | myGLCD.drawPixel(i,239+(sin(((i*1.13)*3.14)/180)*200)); 82 | } 83 | 84 | myGLCD.setColor(255,0,0); 85 | myGLCD.print("Cos", 5, 27); 86 | for (int i=1; i<798; i++) 87 | { 88 | myGLCD.drawPixel(i,239+(cos(((i*1.13)*3.14)/180)*200)); 89 | } 90 | 91 | myGLCD.setColor(255,255,0); 92 | myGLCD.print("Tan", 5, 39); 93 | for (int i=1; i<798; i++) 94 | { 95 | myGLCD.drawPixel(i,239+(tan(((i*0.9)*3.14)/180))); 96 | } 97 | 98 | delay(2000); 99 | 100 | myGLCD.setColor(0,0,0); 101 | myGLCD.fillRect(1,15,798,464); 102 | myGLCD.setColor(0, 0, 255); 103 | myGLCD.setBackColor(0, 0, 0); 104 | myGLCD.drawLine(399, 15, 399, 464); 105 | myGLCD.drawLine(1, 239, 798, 239); 106 | 107 | // Draw a moving sinewave 108 | x=1; 109 | for (int i=1; i<(798*20); i++) 110 | { 111 | x++; 112 | if (x==799) 113 | x=1; 114 | if (i>799) 115 | { 116 | if ((x==399)||(buf[x-1]==239)) 117 | myGLCD.setColor(0,0,255); 118 | else 119 | myGLCD.setColor(0,0,0); 120 | myGLCD.drawPixel(x,buf[x-1]); 121 | } 122 | myGLCD.setColor(0,255,255); 123 | y=239+(sin(((i*1.65)*3.14)/180)*(200-(i / 100))); 124 | myGLCD.drawPixel(x,y); 125 | buf[x-1]=y; 126 | } 127 | 128 | delay(2000); 129 | 130 | myGLCD.setColor(0,0,0); 131 | myGLCD.fillRect(1,15,798,464); 132 | 133 | // Draw some random filled rectangles 134 | for (int i=0; i<50; i++) 135 | { 136 | myGLCD.setColor(random(255), random(255), random(255)); 137 | x=2+random(746); 138 | y=16+random(397); 139 | x2=x+50; 140 | y2=y+50; 141 | myGLCD.fillRect(x, y, x2, y2); 142 | } 143 | 144 | delay(2000); 145 | 146 | myGLCD.setColor(0,0,0); 147 | myGLCD.fillRect(1,15,798,464); 148 | 149 | // Draw some random filled, rounded rectangles 150 | for (int i=0; i<50; i++) 151 | { 152 | myGLCD.setColor(random(255), random(255), random(255)); 153 | x=2+random(746); 154 | y=16+random(397); 155 | x2=x+50; 156 | y2=y+50; 157 | myGLCD.fillRoundRect(x, y, x2, y2); 158 | } 159 | 160 | delay(2000); 161 | 162 | myGLCD.setColor(0,0,0); 163 | myGLCD.fillRect(1,15,798,464); 164 | 165 | // Draw some random filled circles 166 | for (int i=0; i<50; i++) 167 | { 168 | myGLCD.setColor(random(255), random(255), random(255)); 169 | x=27+random(746); 170 | y=41+random(397); 171 | myGLCD.fillCircle(x, y, 25); 172 | } 173 | 174 | delay(2000); 175 | 176 | myGLCD.setColor(0,0,0); 177 | myGLCD.fillRect(1,15,798,464); 178 | 179 | // Draw some lines in a pattern 180 | myGLCD.setColor (255,0,0); 181 | for (int i=15; i<463; i+=5) 182 | { 183 | myGLCD.drawLine(1, i, (i*1.66)-10, 463); 184 | } 185 | myGLCD.setColor (255,0,0); 186 | for (int i=463; i>15; i-=5) 187 | { 188 | myGLCD.drawLine(798, i, (i*1.66)+30, 15); 189 | } 190 | myGLCD.setColor (0,255,255); 191 | for (int i=463; i>15; i-=5) 192 | { 193 | myGLCD.drawLine(1, i, 770-(i*1.66), 15); 194 | } 195 | myGLCD.setColor (0,255,255); 196 | for (int i=15; i<463; i+=5) 197 | { 198 | myGLCD.drawLine(798, i, 810-(i*1.66), 463); 199 | } 200 | 201 | delay(2000); 202 | 203 | myGLCD.setColor(0,0,0); 204 | myGLCD.fillRect(1,15,798,464); 205 | 206 | // Draw some random circles 207 | for (int i=0; i<250; i++) 208 | { 209 | myGLCD.setColor(random(255), random(255), random(255)); 210 | x=32+random(736); 211 | y=45+random(386); 212 | r=random(30); 213 | myGLCD.drawCircle(x, y, r); 214 | } 215 | 216 | delay(2000); 217 | 218 | myGLCD.setColor(0,0,0); 219 | myGLCD.fillRect(1,15,798,464); 220 | 221 | // Draw some random rectangles 222 | for (int i=0; i<250; i++) 223 | { 224 | myGLCD.setColor(random(255), random(255), random(255)); 225 | x=2+random(796); 226 | y=16+random(447); 227 | x2=2+random(796); 228 | y2=16+random(447); 229 | myGLCD.drawRect(x, y, x2, y2); 230 | } 231 | 232 | delay(2000); 233 | 234 | myGLCD.setColor(0,0,0); 235 | myGLCD.fillRect(1,15,798,464); 236 | 237 | // Draw some random rounded rectangles 238 | for (int i=0; i<250; i++) 239 | { 240 | myGLCD.setColor(random(255), random(255), random(255)); 241 | x=2+random(796); 242 | y=16+random(447); 243 | x2=2+random(796); 244 | y2=16+random(447); 245 | myGLCD.drawRoundRect(x, y, x2, y2); 246 | } 247 | 248 | delay(2000); 249 | 250 | myGLCD.setColor(0,0,0); 251 | myGLCD.fillRect(1,15,798,464); 252 | 253 | for (int i=0; i<250; i++) 254 | { 255 | myGLCD.setColor(random(255), random(255), random(255)); 256 | x=2+random(796); 257 | y=16+random(447); 258 | x2=2+random(796); 259 | y2=16+random(447); 260 | myGLCD.drawLine(x, y, x2, y2); 261 | } 262 | 263 | delay(2000); 264 | 265 | myGLCD.setColor(0,0,0); 266 | myGLCD.fillRect(1,15,798,464); 267 | 268 | for (int i=0; i<10000; i++) 269 | { 270 | myGLCD.setColor(random(255), random(255), random(255)); 271 | myGLCD.drawPixel(2+random(796), 16+random(447)); 272 | } 273 | 274 | delay(2000); 275 | 276 | myGLCD.fillScr(0, 0, 255); 277 | myGLCD.setColor(255, 0, 0); 278 | myGLCD.fillRoundRect(320, 190, 479, 289); 279 | 280 | myGLCD.setColor(255, 255, 255); 281 | myGLCD.setBackColor(255, 0, 0); 282 | myGLCD.print("That's it!", CENTER, 213); 283 | myGLCD.print("Restarting in a", CENTER, 239); 284 | myGLCD.print("few seconds...", CENTER, 252); 285 | 286 | myGLCD.setColor(0, 255, 0); 287 | myGLCD.setBackColor(0, 0, 255); 288 | myGLCD.print("Runtime: (msecs)", CENTER, 450); 289 | myGLCD.printNumI(millis(), CENTER, 465); 290 | 291 | delay (10000); 292 | } 293 | 294 | -------------------------------------------------------------------------------- /examples/Arduino (AVR)/UTFT_Leonardo_Demo_320x240/UTFT_Leonardo_Demo_320x240.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Leonardo_Demo_320x240 (C)2013 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a reduced demo of how to use some of the functions 5 | // of the library with a supported display modules on an Arduino Leonardo. 6 | // 7 | // It has been reduced in size to fit in the limited flash memory of 8 | // the Leonardo. It has not been tested on all display modules so 9 | // some modules may still produce too large binares. 10 | // 11 | // This demo was made for modules with a screen resolution 12 | // of 320x240 pixels. 13 | // 14 | // This program requires the UTFT library. 15 | // 16 | 17 | #include 18 | 19 | // Declare which fonts we will be using 20 | extern uint8_t SmallFont[]; 21 | 22 | UTFT myGLCD(ITDB24E_8,A5,A4,A3,A2); // Remember to change the model parameter to suit your display module! 23 | 24 | void setup() 25 | { 26 | randomSeed(analogRead(0)); 27 | 28 | // Setup the LCD 29 | myGLCD.InitLCD(); 30 | myGLCD.setFont(SmallFont); 31 | } 32 | 33 | void loop() 34 | { 35 | int buf[318]; 36 | int x, x2; 37 | int y, y2; 38 | int r; 39 | 40 | // Clear the screen and draw the frame 41 | myGLCD.clrScr(); 42 | 43 | myGLCD.setColor(255, 0, 0); 44 | myGLCD.fillRect(0, 0, 319, 13); 45 | myGLCD.setColor(64, 64, 64); 46 | myGLCD.fillRect(0, 226, 319, 239); 47 | myGLCD.setColor(255, 255, 255); 48 | myGLCD.setBackColor(255, 0, 0); 49 | myGLCD.print("* Universal Color TFT Display Library *", CENTER, 1); 50 | myGLCD.setBackColor(64, 64, 64); 51 | myGLCD.setColor(255,255,0); 52 | myGLCD.print("", CENTER, 227); 53 | 54 | myGLCD.setColor(0, 0, 255); 55 | myGLCD.drawRect(0, 14, 319, 225); 56 | 57 | // Draw crosshairs 58 | myGLCD.setColor(0, 0, 255); 59 | myGLCD.setBackColor(0, 0, 0); 60 | myGLCD.drawLine(159, 15, 159, 224); 61 | myGLCD.drawLine(1, 119, 318, 119); 62 | for (int i=9; i<310; i+=10) 63 | myGLCD.drawLine(i, 117, i, 121); 64 | for (int i=19; i<220; i+=10) 65 | myGLCD.drawLine(157, i, 161, i); 66 | 67 | // Draw sin-, cos- and tan-lines 68 | myGLCD.setColor(0,255,255); 69 | myGLCD.print("Sin", 5, 15); 70 | for (int i=1; i<318; i++) 71 | { 72 | myGLCD.drawPixel(i,119+(sin(((i*1.13)*3.14)/180)*95)); 73 | } 74 | 75 | myGLCD.setColor(255,0,0); 76 | myGLCD.print("Cos", 5, 27); 77 | for (int i=1; i<318; i++) 78 | { 79 | myGLCD.drawPixel(i,119+(cos(((i*1.13)*3.14)/180)*95)); 80 | } 81 | 82 | myGLCD.setColor(255,255,0); 83 | myGLCD.print("Tan", 5, 39); 84 | for (int i=1; i<318; i++) 85 | { 86 | myGLCD.drawPixel(i,119+(tan(((i*1.13)*3.14)/180))); 87 | } 88 | 89 | delay(2000); 90 | 91 | myGLCD.setColor(0,0,0); 92 | myGLCD.fillRect(1,15,318,224); 93 | myGLCD.setColor(0, 0, 255); 94 | myGLCD.setBackColor(0, 0, 0); 95 | myGLCD.drawLine(159, 15, 159, 224); 96 | myGLCD.drawLine(1, 119, 318, 119); 97 | 98 | // Draw a moving sinewave 99 | x=1; 100 | for (int i=1; i<(318*20); i++) 101 | { 102 | x++; 103 | if (x==319) 104 | x=1; 105 | if (i>319) 106 | { 107 | if ((x==159)||(buf[x-1]==119)) 108 | myGLCD.setColor(0,0,255); 109 | else 110 | myGLCD.setColor(0,0,0); 111 | myGLCD.drawPixel(x,buf[x-1]); 112 | } 113 | myGLCD.setColor(0,255,255); 114 | y=119+(sin(((i*1.1)*3.14)/180)*(90-(i / 100))); 115 | myGLCD.drawPixel(x,y); 116 | buf[x-1]=y; 117 | } 118 | 119 | delay(2000); 120 | 121 | myGLCD.setColor(0,0,0); 122 | myGLCD.fillRect(1,15,318,224); 123 | 124 | // Draw some filled rectangles 125 | for (int i=1; i<6; i++) 126 | { 127 | switch (i) 128 | { 129 | case 1: 130 | myGLCD.setColor(255,0,255); 131 | break; 132 | case 2: 133 | myGLCD.setColor(255,0,0); 134 | break; 135 | case 3: 136 | myGLCD.setColor(0,255,0); 137 | break; 138 | case 4: 139 | myGLCD.setColor(0,0,255); 140 | break; 141 | case 5: 142 | myGLCD.setColor(255,255,0); 143 | break; 144 | } 145 | myGLCD.fillRect(70+(i*20), 30+(i*20), 130+(i*20), 90+(i*20)); 146 | } 147 | 148 | delay(2000); 149 | 150 | myGLCD.setColor(0,0,0); 151 | myGLCD.fillRect(1,15,318,224); 152 | 153 | // Draw some filled, rounded rectangles 154 | for (int i=1; i<6; i++) 155 | { 156 | switch (i) 157 | { 158 | case 1: 159 | myGLCD.setColor(255,0,255); 160 | break; 161 | case 2: 162 | myGLCD.setColor(255,0,0); 163 | break; 164 | case 3: 165 | myGLCD.setColor(0,255,0); 166 | break; 167 | case 4: 168 | myGLCD.setColor(0,0,255); 169 | break; 170 | case 5: 171 | myGLCD.setColor(255,255,0); 172 | break; 173 | } 174 | myGLCD.fillRoundRect(190-(i*20), 30+(i*20), 250-(i*20), 90+(i*20)); 175 | } 176 | 177 | delay(2000); 178 | 179 | myGLCD.setColor(0,0,0); 180 | myGLCD.fillRect(1,15,318,224); 181 | 182 | // Draw some filled circles 183 | for (int i=1; i<6; i++) 184 | { 185 | switch (i) 186 | { 187 | case 1: 188 | myGLCD.setColor(255,0,255); 189 | break; 190 | case 2: 191 | myGLCD.setColor(255,0,0); 192 | break; 193 | case 3: 194 | myGLCD.setColor(0,255,0); 195 | break; 196 | case 4: 197 | myGLCD.setColor(0,0,255); 198 | break; 199 | case 5: 200 | myGLCD.setColor(255,255,0); 201 | break; 202 | } 203 | myGLCD.fillCircle(100+(i*20),60+(i*20), 30); 204 | } 205 | 206 | delay(2000); 207 | 208 | myGLCD.setColor(0,0,0); 209 | myGLCD.fillRect(1,15,318,224); 210 | 211 | // Draw some lines in a pattern 212 | myGLCD.setColor (255,0,0); 213 | for (int i=15; i<224; i+=5) 214 | { 215 | myGLCD.drawLine(1, i, (i*1.44)-10, 224); 216 | } 217 | myGLCD.setColor (255,0,0); 218 | for (int i=224; i>15; i-=5) 219 | { 220 | myGLCD.drawLine(318, i, (i*1.44)-11, 15); 221 | } 222 | myGLCD.setColor (0,255,255); 223 | for (int i=224; i>15; i-=5) 224 | { 225 | myGLCD.drawLine(1, i, 331-(i*1.44), 15); 226 | } 227 | myGLCD.setColor (0,255,255); 228 | for (int i=15; i<224; i+=5) 229 | { 230 | myGLCD.drawLine(318, i, 330-(i*1.44), 224); 231 | } 232 | 233 | delay(2000); 234 | 235 | myGLCD.fillScr(0, 0, 255); 236 | myGLCD.setColor(255, 0, 0); 237 | myGLCD.fillRoundRect(80, 70, 239, 169); 238 | 239 | myGLCD.setColor(255, 255, 255); 240 | myGLCD.setBackColor(255, 0, 0); 241 | myGLCD.print("That's it!", CENTER, 93); 242 | myGLCD.print("Restarting in a", CENTER, 119); 243 | myGLCD.print("few seconds...", CENTER, 132); 244 | 245 | myGLCD.setColor(0, 255, 0); 246 | myGLCD.setBackColor(0, 0, 255); 247 | myGLCD.print("Runtime: (msecs)", CENTER, 210); 248 | myGLCD.printNumI(millis(), CENTER, 225); 249 | 250 | delay (10000); 251 | } 252 | 253 | -------------------------------------------------------------------------------- /examples/Arduino (AVR)/UTFT_Rotate_Bitmap/UTFT_Rotate_Bitmap.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Rotate_Bitmap (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the drawBitmap()-function. 5 | // 6 | // This program requires the UTFT library. 7 | // 8 | 9 | #include 10 | #include 11 | 12 | // Set the pins to the correct ones for your development shield 13 | // ------------------------------------------------------------ 14 | // Arduino Uno / 2009: 15 | // ------------------- 16 | // Standard Arduino Uno/2009 shield : ,A5,A4,A3,A2 17 | // DisplayModule Arduino Uno TFT shield : ,A5,A4,A3,A2 18 | // 19 | // Arduino Mega: 20 | // ------------------- 21 | // Standard Arduino Mega/Due shield : ,38,39,40,41 22 | // CTE TFT LCD/SD Shield for Arduino Mega : ,38,39,40,41 23 | // 24 | // Remember to change the model parameter to suit your display module! 25 | UTFT myGLCD(ITDB32S,38,39,40,41); 26 | 27 | extern unsigned int tux[0x400]; 28 | 29 | void setup() 30 | { 31 | myGLCD.InitLCD(LANDSCAPE); 32 | myGLCD.fillScr(255, 255, 255); 33 | myGLCD.setColor(0, 0, 0); 34 | } 35 | 36 | void loop() 37 | { 38 | for (int i=0; i<360; i+=5) 39 | { 40 | myGLCD.drawBitmap (10, 10, 32, 32, tux, i, 16, 16); 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /examples/Arduino (AVR)/UTFT_Textrotation_Demo/UTFT_Textrotation_Demo.ino: -------------------------------------------------------------------------------- 1 | // UTFT_Textrotation_Demo (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the textrotation-functions. 5 | // 6 | // This demo was made for modules with a screen resolution 7 | // of 320x240 pixels. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | 14 | // Declare which fonts we will be using 15 | extern uint8_t BigFont[]; 16 | extern uint8_t SevenSegNumFont[]; 17 | 18 | // Set the pins to the correct ones for your development shield 19 | // ------------------------------------------------------------ 20 | // Arduino Uno / 2009: 21 | // ------------------- 22 | // Standard Arduino Uno/2009 shield : ,A5,A4,A3,A2 23 | // DisplayModule Arduino Uno TFT shield : ,A5,A4,A3,A2 24 | // 25 | // Arduino Mega: 26 | // ------------------- 27 | // Standard Arduino Mega/Due shield : ,38,39,40,41 28 | // CTE TFT LCD/SD Shield for Arduino Mega : ,38,39,40,41 29 | // 30 | // Remember to change the model parameter to suit your display module! 31 | UTFT myGLCD(ITDB32S,38,39,40,41); 32 | 33 | void setup() 34 | { 35 | myGLCD.InitLCD(); 36 | myGLCD.clrScr(); 37 | myGLCD.setFont(BigFont); 38 | } 39 | 40 | void loop() 41 | { 42 | myGLCD.print("Text rotation", 0, 0); 43 | myGLCD.setColor(0, 0, 255); 44 | myGLCD.print("0 degrees", 0, 16, 0); 45 | myGLCD.print("90 degrees", 319, 0, 90); 46 | myGLCD.print("180 degrees", 319, 239, 180); 47 | myGLCD.print("270 degrees", 0, 239, 270); 48 | 49 | myGLCD.setFont(SevenSegNumFont); 50 | myGLCD.setColor(0, 255, 0); 51 | myGLCD.print("45", 90, 100, 45); 52 | myGLCD.print("90", 200, 50, 90); 53 | myGLCD.print("180", 300, 200, 180); 54 | 55 | while (true) {}; 56 | } 57 | 58 | -------------------------------------------------------------------------------- /examples/Arduino (AVR)/UTFT_ViewFont/UTFT_ViewFont.ino: -------------------------------------------------------------------------------- 1 | // UTFT_ViewFont (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the included fonts. 5 | // 6 | // This demo was made for modules with a screen resolution 7 | // of 320x240 pixels. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | 14 | // Declare which fonts we will be using 15 | extern uint8_t SmallFont[]; 16 | extern uint8_t BigFont[]; 17 | extern uint8_t SevenSegNumFont[]; 18 | 19 | // Set the pins to the correct ones for your development shield 20 | // ------------------------------------------------------------ 21 | // Arduino Uno / 2009: 22 | // ------------------- 23 | // Standard Arduino Uno/2009 shield : ,A5,A4,A3,A2 24 | // DisplayModule Arduino Uno TFT shield : ,A5,A4,A3,A2 25 | // 26 | // Arduino Mega: 27 | // ------------------- 28 | // Standard Arduino Mega/Due shield : ,38,39,40,41 29 | // CTE TFT LCD/SD Shield for Arduino Mega : ,38,39,40,41 30 | // 31 | // Remember to change the model parameter to suit your display module! 32 | UTFT myGLCD(ITDB32S,38,39,40,41); 33 | 34 | void setup() 35 | { 36 | myGLCD.InitLCD(); 37 | 38 | myGLCD.clrScr(); 39 | } 40 | 41 | void loop() 42 | { 43 | myGLCD.setColor(0, 255, 0); 44 | myGLCD.setBackColor(0, 0, 0); 45 | 46 | myGLCD.setFont(BigFont); 47 | myGLCD.print(" !\"#$%&'()*+,-./", CENTER, 0); 48 | myGLCD.print("0123456789:;<=>?", CENTER, 16); 49 | myGLCD.print("@ABCDEFGHIJKLMNO", CENTER, 32); 50 | myGLCD.print("PQRSTUVWXYZ[\\]^_", CENTER, 48); 51 | myGLCD.print("`abcdefghijklmno", CENTER, 64); 52 | myGLCD.print("pqrstuvwxyz{|}~ ", CENTER, 80); 53 | 54 | myGLCD.setFont(SmallFont); 55 | myGLCD.print(" !\"#$%&'()*+,-./0123456789:;<=>?", CENTER, 120); 56 | myGLCD.print("@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_", CENTER, 132); 57 | myGLCD.print("`abcdefghijklmnopqrstuvwxyz{|}~ ", CENTER, 144); 58 | 59 | myGLCD.setFont(SevenSegNumFont); 60 | myGLCD.print("0123456789", CENTER, 190); 61 | 62 | while(1) {}; 63 | } 64 | 65 | -------------------------------------------------------------------------------- /examples/chipKit/UTFT_Bitmap/UTFT_Bitmap.pde: -------------------------------------------------------------------------------- 1 | // UTFT_Bitmap (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the drawBitmap()-function. 5 | // 6 | // This demo was made to work on the 320x240 modules. 7 | // Any other size displays may cause strange behaviour. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | 14 | // Declare which fonts we will be using 15 | extern uint8_t SmallFont[]; 16 | 17 | // Set the pins to the correct ones for your development shield 18 | // ------------------------------------------------------------ 19 | // My chipKit Uno32/uC32 shield : ,38,39,40,41 20 | // My chipKit Max32 shield : ,82,83,84,85 21 | // AquaLEDSource All in One Super Screw Shield : ,82,83,84,85 22 | // 23 | // Remember to change the model parameter to suit your display module! 24 | UTFT myGLCD(ITDB32S,82,83,84,85); 25 | 26 | extern unsigned short info[0x400]; 27 | extern unsigned short icon[0x400]; 28 | extern unsigned short tux[0x400]; 29 | 30 | void setup() 31 | { 32 | myGLCD.InitLCD(); 33 | myGLCD.setFont(SmallFont); 34 | } 35 | 36 | void loop() 37 | { 38 | myGLCD.fillScr(255, 255, 255); 39 | myGLCD.setColor(255, 255, 255); 40 | myGLCD.print(" *** A 10 by 7 grid of a 32x32 icon *** ", CENTER, 228); 41 | for (int x=0; x<10; x++) 42 | for (int y=0; y<7; y++) 43 | myGLCD.drawBitmap (x*32, y*32, 32, 32, info); 44 | 45 | delay(5000); 46 | 47 | myGLCD.fillScr(255, 255, 255); 48 | myGLCD.setColor(255, 255, 255); 49 | myGLCD.print(" Two different icons in scale 1 to 4 ", CENTER, 228); 50 | int x=0; 51 | for (int s=0; s<4; s++) 52 | { 53 | x+=(s*32); 54 | myGLCD.drawBitmap (x, 0, 32, 32, tux, s+1); 55 | } 56 | x=0; 57 | for (int s=4; s>0; s--) 58 | { 59 | myGLCD.drawBitmap (x, 224-(s*32), 32, 32, icon, s); 60 | x+=(s*32); 61 | } 62 | 63 | delay(5000); 64 | } 65 | 66 | -------------------------------------------------------------------------------- /examples/chipKit/UTFT_Bitmap_128x128/UTFT_Bitmap_128x128.pde: -------------------------------------------------------------------------------- 1 | // UTFT_Bitmap_128x128 (C)2012 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the drawBitmap()-function. 5 | // 6 | // This demo was made to work on the 128x128 modules. 7 | // Any other size displays may cause strange behaviour. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | 14 | UTFT myGLCD(LPH9135,6,5,2,3,4); // Remember to change the model parameter to suit your display module! 15 | 16 | extern unsigned short icon1[0x400]; 17 | extern unsigned short icon2[0x400]; 18 | extern unsigned short tux[0x1000]; 19 | 20 | void setup() 21 | { 22 | myGLCD.InitLCD(PORTRAIT); 23 | } 24 | 25 | void loop() 26 | { 27 | // Draw a 4 by 4 grid of a 32x32 icon. 28 | myGLCD.fillScr(255, 255, 255); 29 | for (int x=0; x<4; x++) 30 | for (int y=0; y<4; y++) 31 | myGLCD.drawBitmap (x*32, y*32, 32, 32, icon1); 32 | 33 | delay(5000); 34 | 35 | // Draw a 64x64 icon in double size. 36 | myGLCD.fillScr(255, 255, 255); 37 | myGLCD.drawBitmap (0, 0, 64, 64, tux, 2); 38 | 39 | delay(5000); 40 | 41 | // Draw a 2 by 2 grid of a 32x32 icon in double size. 42 | myGLCD.fillScr(255, 255, 255); 43 | for (int x=0; x<2; x++) 44 | for (int y=0; y<2; y++) 45 | myGLCD.drawBitmap (x*64, y*64, 32, 32, icon2, 2); 46 | 47 | delay(5000); 48 | } 49 | 50 | -------------------------------------------------------------------------------- /examples/chipKit/UTFT_Demo_220x176_Serial/UTFT_Demo_220x176_Serial.pde: -------------------------------------------------------------------------------- 1 | // UTFT_Demo_220x176_Serial (C)2012 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of how to use most of the functions 5 | // of the library with a supported display modules. 6 | // 7 | // This demo was made for serial modules with a screen resolution 8 | // of 220x176 pixels. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | 13 | #include 14 | 15 | // Declare which fonts we will be using 16 | extern uint8_t SmallFont[]; 17 | 18 | UTFT myGLCD(ITDB22SP,11,10,9,12); // Remember to change the model parameter to suit your display module! 19 | 20 | void setup() 21 | { 22 | randomSeed(analogRead(0)); 23 | 24 | // Setup the LCD 25 | myGLCD.InitLCD(); 26 | myGLCD.setFont(SmallFont); 27 | } 28 | 29 | void loop() 30 | { 31 | int buf[218]; 32 | int x, x2; 33 | int y, y2; 34 | int r; 35 | 36 | // Clear the screen and draw the frame 37 | myGLCD.clrScr(); 38 | 39 | myGLCD.setColor(255, 0, 0); 40 | myGLCD.fillRect(0, 0, 219, 13); 41 | myGLCD.setColor(64, 64, 64); 42 | myGLCD.fillRect(0, 162, 219, 175); 43 | myGLCD.setColor(255, 255, 255); 44 | myGLCD.setBackColor(255, 0, 0); 45 | myGLCD.print("** Universal TFT Library **", CENTER, 1); 46 | myGLCD.setBackColor(64, 64, 64); 47 | myGLCD.setColor(255,255,0); 48 | myGLCD.print("> elec.henningkarlsen.com <", CENTER, 163); 49 | 50 | myGLCD.setColor(0, 0, 255); 51 | myGLCD.drawRect(0, 14, 219, 161); 52 | 53 | // Draw crosshairs 54 | myGLCD.setColor(0, 0, 255); 55 | myGLCD.setBackColor(0, 0, 0); 56 | myGLCD.drawLine(109, 15, 109, 160); 57 | myGLCD.drawLine(1, 88, 218, 88); 58 | 59 | for (int i=9; i<210; i+=10) 60 | myGLCD.drawLine(i, 86, i, 90); 61 | for (int i=19; i<155; i+=10) 62 | myGLCD.drawLine(107, i, 111, i); 63 | 64 | // Draw sin-, cos- and tan-lines 65 | myGLCD.setColor(0,255,255); 66 | myGLCD.print("Sin", 5, 15); 67 | for (int i=1; i<218; i++) 68 | { 69 | myGLCD.drawPixel(i,88+(sin(((i*1.65)*3.14)/180)*70)); 70 | } 71 | 72 | myGLCD.setColor(255,0,0); 73 | myGLCD.print("Cos", 5, 27); 74 | for (int i=1; i<218; i++) 75 | { 76 | myGLCD.drawPixel(i,88+(cos(((i*1.65)*3.14)/180)*70)); 77 | } 78 | 79 | myGLCD.setColor(255,255,0); 80 | myGLCD.print("Tan", 5, 39); 81 | for (int i=1; i<218; i++) 82 | { 83 | myGLCD.drawPixel(i,88+(tan(((i*1.65)*3.14)/180))); 84 | } 85 | 86 | delay(2000); 87 | 88 | myGLCD.setColor(0,0,0); 89 | myGLCD.fillRect(1,15,218,160); 90 | myGLCD.setColor(0, 0, 255); 91 | myGLCD.setBackColor(0, 0, 0); 92 | myGLCD.drawLine(109, 15, 109, 160); 93 | myGLCD.drawLine(1, 88, 218, 88); 94 | 95 | // Draw a moving sinewave 96 | x=1; 97 | for (int i=1; i<(218*20); i++) 98 | { 99 | x++; 100 | if (x==219) 101 | x=1; 102 | if (i>219) 103 | { 104 | if ((x==109)||(buf[x-1]==88)) 105 | myGLCD.setColor(0,0,255); 106 | else 107 | myGLCD.setColor(0,0,0); 108 | myGLCD.drawPixel(x,buf[x-1]); 109 | } 110 | myGLCD.setColor(0,255,255); 111 | y=88+(sin(((i*1.6)*3.14)/180)*(65-(i / 100))); 112 | myGLCD.drawPixel(x,y); 113 | buf[x-1]=y; 114 | } 115 | 116 | delay(2000); 117 | 118 | myGLCD.setColor(0,0,0); 119 | myGLCD.fillRect(1,15,218,160); 120 | 121 | // Draw some filled rectangles 122 | for (int i=1; i<6; i++) 123 | { 124 | switch (i) 125 | { 126 | case 1: 127 | myGLCD.setColor(255,0,255); 128 | break; 129 | case 2: 130 | myGLCD.setColor(255,0,0); 131 | break; 132 | case 3: 133 | myGLCD.setColor(0,255,0); 134 | break; 135 | case 4: 136 | myGLCD.setColor(0,0,255); 137 | break; 138 | case 5: 139 | myGLCD.setColor(255,255,0); 140 | break; 141 | } 142 | myGLCD.fillRect(44+(i*15), 23+(i*15), 88+(i*15), 63+(i*15)); 143 | } 144 | 145 | delay(2000); 146 | 147 | myGLCD.setColor(0,0,0); 148 | myGLCD.fillRect(1,15,218,160); 149 | 150 | // Draw some filled, rounded rectangles 151 | for (int i=1; i<6; i++) 152 | { 153 | switch (i) 154 | { 155 | case 1: 156 | myGLCD.setColor(255,0,255); 157 | break; 158 | case 2: 159 | myGLCD.setColor(255,0,0); 160 | break; 161 | case 3: 162 | myGLCD.setColor(0,255,0); 163 | break; 164 | case 4: 165 | myGLCD.setColor(0,0,255); 166 | break; 167 | case 5: 168 | myGLCD.setColor(255,255,0); 169 | break; 170 | } 171 | myGLCD.fillRoundRect(132-(i*15), 23+(i*15), 172-(i*15), 63+(i*15)); 172 | } 173 | 174 | delay(2000); 175 | 176 | myGLCD.setColor(0,0,0); 177 | myGLCD.fillRect(1,15,218,160); 178 | 179 | // Draw some filled circles 180 | for (int i=1; i<6; i++) 181 | { 182 | switch (i) 183 | { 184 | case 1: 185 | myGLCD.setColor(255,0,255); 186 | break; 187 | case 2: 188 | myGLCD.setColor(255,0,0); 189 | break; 190 | case 3: 191 | myGLCD.setColor(0,255,0); 192 | break; 193 | case 4: 194 | myGLCD.setColor(0,0,255); 195 | break; 196 | case 5: 197 | myGLCD.setColor(255,255,0); 198 | break; 199 | } 200 | myGLCD.fillCircle(64+(i*15),43+(i*15), 20); 201 | } 202 | 203 | delay(2000); 204 | 205 | myGLCD.setColor(0,0,0); 206 | myGLCD.fillRect(1,15,218,160); 207 | 208 | // Draw some lines in a pattern 209 | myGLCD.setColor (255,0,0); 210 | for (int i=15; i<160; i+=5) 211 | { 212 | myGLCD.drawLine(1, i, (i*1.44)-10, 160); 213 | } 214 | myGLCD.setColor (255,0,0); 215 | for (int i=160; i>15; i-=5) 216 | { 217 | myGLCD.drawLine(218, i, (i*1.44)-12, 15); 218 | } 219 | myGLCD.setColor (0,255,255); 220 | for (int i=160; i>15; i-=5) 221 | { 222 | myGLCD.drawLine(1, i, 232-(i*1.44), 15); 223 | } 224 | myGLCD.setColor (0,255,255); 225 | for (int i=15; i<160; i+=5) 226 | { 227 | myGLCD.drawLine(218, i, 231-(i*1.44), 160); 228 | } 229 | 230 | delay(2000); 231 | 232 | myGLCD.setColor(0,0,0); 233 | myGLCD.fillRect(1,15,218,161); 234 | 235 | // Draw some random circles 236 | for (int i=0; i<100; i++) 237 | { 238 | myGLCD.setColor(random(255), random(255), random(255)); 239 | x=22+random(176); 240 | y=35+random(105); 241 | r=random(20); 242 | myGLCD.drawCircle(x, y, r); 243 | } 244 | 245 | delay(2000); 246 | 247 | myGLCD.setColor(0,0,0); 248 | myGLCD.fillRect(1,15,218,160); 249 | 250 | // Draw some random rectangles 251 | for (int i=0; i<100; i++) 252 | { 253 | myGLCD.setColor(random(255), random(255), random(255)); 254 | x=2+random(216); 255 | y=16+random(143); 256 | x2=2+random(216); 257 | y2=16+random(143); 258 | myGLCD.drawRect(x, y, x2, y2); 259 | } 260 | 261 | delay(2000); 262 | 263 | myGLCD.setColor(0,0,0); 264 | myGLCD.fillRect(1,15,218,160); 265 | 266 | // Draw some random rounded rectangles 267 | for (int i=0; i<100; i++) 268 | { 269 | myGLCD.setColor(random(255), random(255), random(255)); 270 | x=2+random(216); 271 | y=16+random(143); 272 | x2=2+random(216); 273 | y2=16+random(143); 274 | myGLCD.drawRoundRect(x, y, x2, y2); 275 | } 276 | 277 | delay(2000); 278 | 279 | myGLCD.setColor(0,0,0); 280 | myGLCD.fillRect(1,15,218,160); 281 | 282 | for (int i=0; i<100; i++) 283 | { 284 | myGLCD.setColor(random(255), random(255), random(255)); 285 | x=2+random(216); 286 | y=16+random(143); 287 | x2=2+random(216); 288 | y2=16+random(143); 289 | myGLCD.drawLine(x, y, x2, y2); 290 | } 291 | 292 | delay(2000); 293 | 294 | myGLCD.setColor(0,0,0); 295 | myGLCD.fillRect(1,15,218,160); 296 | 297 | for (int i=0; i<10000; i++) 298 | { 299 | myGLCD.setColor(random(255), random(255), random(255)); 300 | myGLCD.drawPixel(2+random(216), 16+random(143)); 301 | } 302 | 303 | delay(2000); 304 | 305 | myGLCD.fillScr(0, 0, 255); 306 | myGLCD.setColor(255, 0, 0); 307 | myGLCD.fillRoundRect(40, 57, 179, 119); 308 | 309 | myGLCD.setColor(255, 255, 255); 310 | myGLCD.setBackColor(255, 0, 0); 311 | myGLCD.print("That's it!", CENTER, 62); 312 | myGLCD.print("Restarting in a", CENTER, 88); 313 | myGLCD.print("few seconds...", CENTER, 101); 314 | 315 | myGLCD.setColor(0, 255, 0); 316 | myGLCD.setBackColor(0, 0, 255); 317 | myGLCD.print("Runtime: (msecs)", CENTER, 146); 318 | myGLCD.printNumI(millis(), CENTER, 161); 319 | 320 | delay (10000); 321 | } 322 | 323 | -------------------------------------------------------------------------------- /examples/chipKit/UTFT_Demo_800x480/UTFT_Demo_800x480.pde: -------------------------------------------------------------------------------- 1 | // UTFT_Demo_800x480 (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of how to use most of the functions 5 | // of the library with a supported display modules. 6 | // 7 | // This demo was made for modules with a screen resolution 8 | // of 800x480 pixels. 9 | // 10 | // This program requires the UTFT library. 11 | // 12 | 13 | #include 14 | 15 | // Declare which fonts we will be using 16 | extern uint8_t SmallFont[]; 17 | 18 | // Set the pins to the correct ones for your development shield 19 | // ------------------------------------------------------------ 20 | // My chipKit Uno32/uC32 shield : ,38,39,40,41 21 | // My chipKit Max32 shield : ,82,83,84,85 22 | // AquaLEDSource All in One Super Screw Shield : ,82,83,84,85 23 | // 24 | // Remember to change the model parameter to suit your display module! 25 | UTFT myGLCD(ITDB50,82,83,84,85); 26 | 27 | void setup() 28 | { 29 | randomSeed(analogRead(0)); 30 | 31 | // Setup the LCD 32 | myGLCD.InitLCD(); 33 | myGLCD.setFont(SmallFont); 34 | } 35 | 36 | void loop() 37 | { 38 | int buf[798]; 39 | int x, x2; 40 | int y, y2; 41 | int r; 42 | 43 | // Clear the screen and draw the frame 44 | myGLCD.clrScr(); 45 | 46 | myGLCD.setColor(255, 0, 0); 47 | myGLCD.fillRect(0, 0, 799, 13); 48 | myGLCD.setColor(64, 64, 64); 49 | myGLCD.fillRect(0, 466, 799, 479); 50 | myGLCD.setColor(255, 255, 255); 51 | myGLCD.setBackColor(255, 0, 0); 52 | myGLCD.print("* Universal Color TFT Display Library *", CENTER, 1); 53 | myGLCD.setBackColor(64, 64, 64); 54 | myGLCD.setColor(255,255,0); 55 | myGLCD.print("", CENTER, 467); 56 | 57 | myGLCD.setColor(0, 0, 255); 58 | myGLCD.drawRect(0, 14, 799, 465); 59 | 60 | // Draw crosshairs 61 | myGLCD.setColor(0, 0, 255); 62 | myGLCD.setBackColor(0, 0, 0); 63 | myGLCD.drawLine(399, 15, 399, 464); 64 | myGLCD.drawLine(1, 239, 798, 239); 65 | for (int i=9; i<790; i+=10) 66 | myGLCD.drawLine(i, 237, i, 242); 67 | for (int i=19; i<470; i+=10) 68 | myGLCD.drawLine(397, i, 402, i); 69 | 70 | // Draw sin-, cos- and tan-lines 71 | myGLCD.setColor(0,255,255); 72 | myGLCD.print("Sin", 5, 15); 73 | for (int i=1; i<798; i++) 74 | { 75 | myGLCD.drawPixel(i,239+(sin(((i*1.13)*3.14)/180)*200)); 76 | } 77 | 78 | myGLCD.setColor(255,0,0); 79 | myGLCD.print("Cos", 5, 27); 80 | for (int i=1; i<798; i++) 81 | { 82 | myGLCD.drawPixel(i,239+(cos(((i*1.13)*3.14)/180)*200)); 83 | } 84 | 85 | myGLCD.setColor(255,255,0); 86 | myGLCD.print("Tan", 5, 39); 87 | for (int i=1; i<798; i++) 88 | { 89 | myGLCD.drawPixel(i,239+(tan(((i*0.9)*3.14)/180))); 90 | } 91 | 92 | delay(2000); 93 | 94 | myGLCD.setColor(0,0,0); 95 | myGLCD.fillRect(1,15,798,464); 96 | myGLCD.setColor(0, 0, 255); 97 | myGLCD.setBackColor(0, 0, 0); 98 | myGLCD.drawLine(399, 15, 399, 464); 99 | myGLCD.drawLine(1, 239, 798, 239); 100 | 101 | // Draw a moving sinewave 102 | x=1; 103 | for (int i=1; i<(798*20); i++) 104 | { 105 | x++; 106 | if (x==799) 107 | x=1; 108 | if (i>799) 109 | { 110 | if ((x==399)||(buf[x-1]==239)) 111 | myGLCD.setColor(0,0,255); 112 | else 113 | myGLCD.setColor(0,0,0); 114 | myGLCD.drawPixel(x,buf[x-1]); 115 | } 116 | myGLCD.setColor(0,255,255); 117 | y=239+(sin(((i*1.65)*3.14)/180)*(200-(i / 100))); 118 | myGLCD.drawPixel(x,y); 119 | buf[x-1]=y; 120 | } 121 | 122 | delay(2000); 123 | 124 | myGLCD.setColor(0,0,0); 125 | myGLCD.fillRect(1,15,798,464); 126 | 127 | // Draw some random filled rectangles 128 | for (int i=0; i<50; i++) 129 | { 130 | myGLCD.setColor(random(255), random(255), random(255)); 131 | x=2+random(746); 132 | y=16+random(397); 133 | x2=x+50; 134 | y2=y+50; 135 | myGLCD.fillRect(x, y, x2, y2); 136 | } 137 | 138 | delay(2000); 139 | 140 | myGLCD.setColor(0,0,0); 141 | myGLCD.fillRect(1,15,798,464); 142 | 143 | // Draw some random filled, rounded rectangles 144 | for (int i=0; i<50; i++) 145 | { 146 | myGLCD.setColor(random(255), random(255), random(255)); 147 | x=2+random(746); 148 | y=16+random(397); 149 | x2=x+50; 150 | y2=y+50; 151 | myGLCD.fillRoundRect(x, y, x2, y2); 152 | } 153 | 154 | delay(2000); 155 | 156 | myGLCD.setColor(0,0,0); 157 | myGLCD.fillRect(1,15,798,464); 158 | 159 | // Draw some random filled circles 160 | for (int i=0; i<50; i++) 161 | { 162 | myGLCD.setColor(random(255), random(255), random(255)); 163 | x=27+random(746); 164 | y=41+random(397); 165 | myGLCD.fillCircle(x, y, 25); 166 | } 167 | 168 | delay(2000); 169 | 170 | myGLCD.setColor(0,0,0); 171 | myGLCD.fillRect(1,15,798,464); 172 | 173 | // Draw some lines in a pattern 174 | myGLCD.setColor (255,0,0); 175 | for (int i=15; i<463; i+=5) 176 | { 177 | myGLCD.drawLine(1, i, (i*1.66)-10, 463); 178 | } 179 | myGLCD.setColor (255,0,0); 180 | for (int i=463; i>15; i-=5) 181 | { 182 | myGLCD.drawLine(798, i, (i*1.66)+30, 15); 183 | } 184 | myGLCD.setColor (0,255,255); 185 | for (int i=463; i>15; i-=5) 186 | { 187 | myGLCD.drawLine(1, i, 770-(i*1.66), 15); 188 | } 189 | myGLCD.setColor (0,255,255); 190 | for (int i=15; i<463; i+=5) 191 | { 192 | myGLCD.drawLine(798, i, 810-(i*1.66), 463); 193 | } 194 | 195 | delay(2000); 196 | 197 | myGLCD.setColor(0,0,0); 198 | myGLCD.fillRect(1,15,798,464); 199 | 200 | // Draw some random circles 201 | for (int i=0; i<250; i++) 202 | { 203 | myGLCD.setColor(random(255), random(255), random(255)); 204 | x=32+random(736); 205 | y=45+random(386); 206 | r=random(30); 207 | myGLCD.drawCircle(x, y, r); 208 | } 209 | 210 | delay(2000); 211 | 212 | myGLCD.setColor(0,0,0); 213 | myGLCD.fillRect(1,15,798,464); 214 | 215 | // Draw some random rectangles 216 | for (int i=0; i<250; i++) 217 | { 218 | myGLCD.setColor(random(255), random(255), random(255)); 219 | x=2+random(796); 220 | y=16+random(447); 221 | x2=2+random(796); 222 | y2=16+random(447); 223 | myGLCD.drawRect(x, y, x2, y2); 224 | } 225 | 226 | delay(2000); 227 | 228 | myGLCD.setColor(0,0,0); 229 | myGLCD.fillRect(1,15,798,464); 230 | 231 | // Draw some random rounded rectangles 232 | for (int i=0; i<250; i++) 233 | { 234 | myGLCD.setColor(random(255), random(255), random(255)); 235 | x=2+random(796); 236 | y=16+random(447); 237 | x2=2+random(796); 238 | y2=16+random(447); 239 | myGLCD.drawRoundRect(x, y, x2, y2); 240 | } 241 | 242 | delay(2000); 243 | 244 | myGLCD.setColor(0,0,0); 245 | myGLCD.fillRect(1,15,798,464); 246 | 247 | for (int i=0; i<250; i++) 248 | { 249 | myGLCD.setColor(random(255), random(255), random(255)); 250 | x=2+random(796); 251 | y=16+random(447); 252 | x2=2+random(796); 253 | y2=16+random(447); 254 | myGLCD.drawLine(x, y, x2, y2); 255 | } 256 | 257 | delay(2000); 258 | 259 | myGLCD.setColor(0,0,0); 260 | myGLCD.fillRect(1,15,798,464); 261 | 262 | for (int i=0; i<10000; i++) 263 | { 264 | myGLCD.setColor(random(255), random(255), random(255)); 265 | myGLCD.drawPixel(2+random(796), 16+random(447)); 266 | } 267 | 268 | delay(2000); 269 | 270 | myGLCD.fillScr(0, 0, 255); 271 | myGLCD.setColor(255, 0, 0); 272 | myGLCD.fillRoundRect(320, 190, 479, 289); 273 | 274 | myGLCD.setColor(255, 255, 255); 275 | myGLCD.setBackColor(255, 0, 0); 276 | myGLCD.print("That's it!", CENTER, 213); 277 | myGLCD.print("Restarting in a", CENTER, 239); 278 | myGLCD.print("few seconds...", CENTER, 252); 279 | 280 | myGLCD.setColor(0, 255, 0); 281 | myGLCD.setBackColor(0, 0, 255); 282 | myGLCD.print("Runtime: (msecs)", CENTER, 450); 283 | myGLCD.printNumI(millis(), CENTER, 465); 284 | 285 | delay (10000); 286 | } 287 | 288 | -------------------------------------------------------------------------------- /examples/chipKit/UTFT_Rotate_Bitmap/UTFT_Rotate_Bitmap.pde: -------------------------------------------------------------------------------- 1 | // UTFT_Rotate_Bitmap (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the drawBitmap()-function. 5 | // 6 | // This program requires the UTFT library. 7 | // 8 | 9 | #include 10 | 11 | // Set the pins to the correct ones for your development shield 12 | // ------------------------------------------------------------ 13 | // My chipKit Uno32/uC32 shield : ,38,39,40,41 14 | // My chipKit Max32 shield : ,82,83,84,85 15 | // AquaLEDSource All in One Super Screw Shield : ,82,83,84,85 16 | // 17 | // Remember to change the model parameter to suit your display module! 18 | UTFT myGLCD(ITDB32S,82,83,84,85); 19 | 20 | extern unsigned short biohazard[0x1000]; 21 | 22 | void setup() 23 | { 24 | myGLCD.InitLCD(LANDSCAPE); 25 | myGLCD.fillScr(255, 255, 255); 26 | myGLCD.setColor(0, 0, 0); 27 | } 28 | 29 | void loop() 30 | { 31 | for (int i=0; i<360; i+=5) 32 | { 33 | myGLCD.drawBitmap (10, 10, 64, 64, biohazard, i, 32, 32); 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /examples/chipKit/UTFT_Textrotation_Demo/UTFT_Textrotation_Demo.pde: -------------------------------------------------------------------------------- 1 | // UTFT_Textrotation_Demo (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the textrotation-functions. 5 | // 6 | // This demo was made for modules with a screen resolution 7 | // of 320x240 pixels. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | 14 | // Declare which fonts we will be using 15 | extern uint8_t BigFont[]; 16 | extern uint8_t SevenSegNumFont[]; 17 | 18 | // Set the pins to the correct ones for your development shield 19 | // ------------------------------------------------------------ 20 | // My chipKit Uno32/uC32 shield : ,38,39,40,41 21 | // My chipKit Max32 shield : ,82,83,84,85 22 | // AquaLEDSource All in One Super Screw Shield : ,82,83,84,85 23 | // 24 | // Remember to change the model parameter to suit your display module! 25 | UTFT myGLCD(ITDB32S,82,83,84,85); 26 | 27 | void setup() 28 | { 29 | myGLCD.InitLCD(); 30 | myGLCD.clrScr(); 31 | myGLCD.setFont(BigFont); 32 | } 33 | 34 | void loop() 35 | { 36 | myGLCD.print("Text rotation", 0, 0); 37 | myGLCD.setColor(0, 0, 255); 38 | myGLCD.print("0 degrees", 0, 16, 0); 39 | myGLCD.print("90 degrees", 319, 0, 90); 40 | myGLCD.print("180 degrees", 319, 239, 180); 41 | myGLCD.print("270 degrees", 0, 239, 270); 42 | 43 | myGLCD.setFont(SevenSegNumFont); 44 | myGLCD.setColor(0, 255, 0); 45 | myGLCD.print("45", 90, 100, 45); 46 | myGLCD.print("90", 200, 50, 90); 47 | myGLCD.print("180", 300, 200, 180); 48 | 49 | while (true) {}; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /examples/chipKit/UTFT_ViewFont/UTFT_ViewFont.pde: -------------------------------------------------------------------------------- 1 | // UTFT_ViewFont (C)2014 Henning Karlsen 2 | // web: http://www.henningkarlsen.com/electronics 3 | // 4 | // This program is a demo of the included fonts. 5 | // 6 | // This demo was made for modules with a screen resolution 7 | // of 320x240 pixels. 8 | // 9 | // This program requires the UTFT library. 10 | // 11 | 12 | #include 13 | 14 | // Declare which fonts we will be using 15 | extern uint8_t SmallFont[]; 16 | extern uint8_t BigFont[]; 17 | extern uint8_t SevenSegNumFont[]; 18 | 19 | // Set the pins to the correct ones for your development shield 20 | // ------------------------------------------------------------ 21 | // My chipKit Uno32/uC32 shield : ,38,39,40,41 22 | // My chipKit Max32 shield : ,82,83,84,85 23 | // AquaLEDSource All in One Super Screw Shield : ,82,83,84,85 24 | // 25 | // Remember to change the model parameter to suit your display module! 26 | UTFT myGLCD(ITDB32S,82,83,84,85); 27 | 28 | void setup() 29 | { 30 | myGLCD.InitLCD(); 31 | 32 | myGLCD.clrScr(); 33 | } 34 | 35 | void loop() 36 | { 37 | myGLCD.setColor(0, 255, 0); 38 | myGLCD.setBackColor(0, 0, 0); 39 | 40 | myGLCD.setFont(BigFont); 41 | myGLCD.print(" !\"#$%&'()*+,-./", CENTER, 0); 42 | myGLCD.print("0123456789:;<=>?", CENTER, 16); 43 | myGLCD.print("@ABCDEFGHIJKLMNO", CENTER, 32); 44 | myGLCD.print("PQRSTUVWXYZ[\\]^_", CENTER, 48); 45 | myGLCD.print("`abcdefghijklmno", CENTER, 64); 46 | myGLCD.print("pqrstuvwxyz{|}~ ", CENTER, 80); 47 | 48 | myGLCD.setFont(SmallFont); 49 | myGLCD.print(" !\"#$%&'()*+,-./0123456789:;<=>?", CENTER, 120); 50 | myGLCD.print("@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_", CENTER, 132); 51 | myGLCD.print("`abcdefghijklmnopqrstuvwxyz{|}~ ", CENTER, 144); 52 | 53 | myGLCD.setFont(SevenSegNumFont); 54 | myGLCD.print("0123456789", CENTER, 190); 55 | 56 | while(1) {}; 57 | } 58 | 59 | -------------------------------------------------------------------------------- /hardware/arm/HW_ARM.h: -------------------------------------------------------------------------------- 1 | void UTFT::_convert_float(char *buf, double num, int width, byte prec) 2 | { 3 | char format[10]; 4 | 5 | sprintf(format, "%%%i.%if", width, prec); 6 | sprintf(buf, format, num); 7 | } 8 | -------------------------------------------------------------------------------- /hardware/arm/HW_ARM_defines.h: -------------------------------------------------------------------------------- 1 | // CTE TFT LCD/SD Shield for Arduino Due 2 | // ------------------------------------- 3 | // Uncomment the following line if you are using this shield 4 | //#define CTE_DUE_SHIELD 1 5 | // 6 | // For this shield: RS=25, WR=26, CS=27, RST=28 7 | //******************************************************************** 8 | 9 | // ElecHouse TFT LCD/SD Shield for Arduino Due 10 | // ------------------------------------- 11 | // Uncomment the following line if you are using this shield 12 | //#define EHOUSE_DUE_SHIELD 1 13 | // 14 | // For this shield: RS=22, WR=23, CS=31, RST=33 15 | //******************************************************************** 16 | 17 | // *** Hardwarespecific defines *** 18 | #define cbi(reg, bitmask) *reg &= ~bitmask 19 | #define sbi(reg, bitmask) *reg |= bitmask 20 | #define pulse_high(reg, bitmask) sbi(reg, bitmask); cbi(reg, bitmask); 21 | #define pulse_low(reg, bitmask) cbi(reg, bitmask); sbi(reg, bitmask); 22 | 23 | #define cport(port, data) port &= data 24 | #define sport(port, data) port |= data 25 | 26 | #define swap(type, i, j) {type t = i; i = j; j = t;} 27 | 28 | #define fontbyte(x) cfont.font[x] 29 | 30 | #define pgm_read_word(data) *data 31 | #define pgm_read_byte(data) *data 32 | #define bitmapdatatype unsigned short* 33 | 34 | #if defined(TEENSYDUINO) && TEENSYDUINO >= 117 35 | #define regtype volatile uint8_t 36 | #define regsize uint8_t 37 | #else 38 | #define regtype volatile uint32_t 39 | #define regsize uint32_t 40 | #endif 41 | -------------------------------------------------------------------------------- /hardware/arm/HW_MX20DX256.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * This file is a modified version of the HW_Teensy3.h created by Paul Stoffregen. 4 | * 5 | * Teensy 3.x pin definitions created by Dawnmist 6 | * http://forum.pjrc.com/threads/18002-Teensy-3-0-driving-an-SSD1289-with-utft?p=34719&viewfull=1#post34719 7 | * 8 | * This file only supports the B and D ports as defined by Dawnmist for 8-bit and 16-bit display modules. 9 | * Serial display modules are also supported. 10 | * 11 | * NOTE: This file has only been tested on a Teensy 3.1 12 | * 13 | **/ 14 | 15 | // *** Hardware specific functions *** 16 | void UTFT::_hw_special_init() 17 | { 18 | } 19 | 20 | void UTFT::LCD_Writ_Bus(char VH,char VL, byte mode) 21 | { 22 | switch (mode) 23 | { 24 | case 1: 25 | if (display_serial_mode==SERIAL_4PIN) 26 | { 27 | if (VH==1) 28 | sbi(P_SDA, B_SDA); 29 | else 30 | cbi(P_SDA, B_SDA); 31 | pulse_low(P_SCL, B_SCL); 32 | } 33 | else 34 | { 35 | if (VH==1) 36 | sbi(P_RS, B_RS); 37 | else 38 | cbi(P_RS, B_RS); 39 | } 40 | 41 | if (VL & 0x80) 42 | sbi(P_SDA, B_SDA); 43 | else 44 | cbi(P_SDA, B_SDA); 45 | pulse_low(P_SCL, B_SCL); 46 | if (VL & 0x40) 47 | sbi(P_SDA, B_SDA); 48 | else 49 | cbi(P_SDA, B_SDA); 50 | pulse_low(P_SCL, B_SCL); 51 | if (VL & 0x20) 52 | sbi(P_SDA, B_SDA); 53 | else 54 | cbi(P_SDA, B_SDA); 55 | pulse_low(P_SCL, B_SCL); 56 | if (VL & 0x10) 57 | sbi(P_SDA, B_SDA); 58 | else 59 | cbi(P_SDA, B_SDA); 60 | pulse_low(P_SCL, B_SCL); 61 | if (VL & 0x08) 62 | sbi(P_SDA, B_SDA); 63 | else 64 | cbi(P_SDA, B_SDA); 65 | pulse_low(P_SCL, B_SCL); 66 | if (VL & 0x04) 67 | sbi(P_SDA, B_SDA); 68 | else 69 | cbi(P_SDA, B_SDA); 70 | pulse_low(P_SCL, B_SCL); 71 | if (VL & 0x02) 72 | sbi(P_SDA, B_SDA); 73 | else 74 | cbi(P_SDA, B_SDA); 75 | pulse_low(P_SCL, B_SCL); 76 | if (VL & 0x01) 77 | sbi(P_SDA, B_SDA); 78 | else 79 | cbi(P_SDA, B_SDA); 80 | pulse_low(P_SCL, B_SCL); 81 | break; 82 | case 8: 83 | *(volatile uint8_t *)(&GPIOD_PDOR) = VH; 84 | pulse_low(P_WR, B_WR); 85 | *(volatile uint8_t *)(&GPIOD_PDOR) = VL; 86 | pulse_low(P_WR, B_WR); 87 | break; 88 | case 16: 89 | *(volatile uint8_t *)(&GPIOD_PDOR) = VH; 90 | GPIOB_PCOR = 0x000F000F; // clear data lines B0-3,B16-19 91 | GPIOB_PSOR = (0x0F & VL) | ((VL >> 4) << 16); // set data lines 0-3,16-19 if set in cl 92 | pulse_low(P_WR, B_WR); 93 | break; 94 | } 95 | } 96 | 97 | void UTFT::_set_direction_registers(byte mode) 98 | { 99 | GPIOD_PDDR |= 0xFF; 100 | PORTD_PCR0 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); 101 | PORTD_PCR1 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); 102 | PORTD_PCR2 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); 103 | PORTD_PCR3 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); 104 | PORTD_PCR4 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); 105 | PORTD_PCR5 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); 106 | PORTD_PCR6 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); 107 | PORTD_PCR7 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); 108 | 109 | if (mode == 16) 110 | { 111 | GPIOB_PDDR |= 0x000F000F; 112 | PORTB_PCR0 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); 113 | PORTB_PCR1 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); 114 | PORTB_PCR2 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); 115 | PORTB_PCR3 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); 116 | PORTB_PCR16 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); 117 | PORTB_PCR17 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); 118 | PORTB_PCR18 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); 119 | PORTB_PCR19 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); 120 | } 121 | } 122 | void UTFT::_fast_fill_16(int ch, int cl, long pix) 123 | { 124 | long blocks; 125 | 126 | *(volatile uint8_t *)(&GPIOD_PDOR) = ch; 127 | GPIOB_PCOR = 0x000F000F; // clear data lines B0-3,B16-19 128 | GPIOB_PSOR = (0x0F & cl) | ((cl >> 4) << 16); // set data lines 0-3,16-19 if set in cl 129 | 130 | blocks = pix/16; 131 | for (int i=0; i>3) | ((VH & 0x80)>>1); 85 | pulse_low(P_WR, B_WR); 86 | 87 | REG_PIOA_CODR=0x0000C000; 88 | REG_PIOD_CODR=0x0000064F; 89 | REG_PIOA_SODR=(VL & 0x06)<<13; 90 | (VL & 0x01) ? REG_PIOB_SODR = 0x4000000 : REG_PIOB_CODR = 0x4000000; 91 | REG_PIOD_SODR=((VL & 0x78)>>3) | ((VL & 0x80)>>1); 92 | pulse_low(P_WR, B_WR); 93 | #endif 94 | break; 95 | case 16: 96 | #if defined(CTE_DUE_SHIELD) 97 | REG_PIOC_CODR=0xFF1FE; 98 | REG_PIOC_SODR=(VL<<1) & 0x1FE; 99 | REG_PIOC_SODR=(VH<<12) & 0xFF000; 100 | #elif defined(EHOUSE_DUE_SHIELD) 101 | PIOC->PIO_ODSR = ((PIOC->PIO_ODSR&(~0x000FF3FC)) | ((((uint32_t)VL)<<2) | (((uint32_t)VH)<<12))); 102 | #else 103 | REG_PIOA_CODR=0x0000C080; 104 | REG_PIOC_CODR=0x0000003E; 105 | REG_PIOD_CODR=0x0000064F; 106 | REG_PIOA_SODR=((VH & 0x06)<<13) | ((VL & 0x40)<<1); 107 | (VH & 0x01) ? REG_PIOB_SODR = 0x4000000 : REG_PIOB_CODR = 0x4000000; 108 | REG_PIOC_SODR=((VL & 0x01)<<5) | ((VL & 0x02)<<3) | ((VL & 0x04)<<1) | ((VL & 0x08)>>1) | ((VL & 0x10)>>3); 109 | REG_PIOD_SODR=((VH & 0x78)>>3) | ((VH & 0x80)>>1) | ((VL & 0x20)<<5) | ((VL & 0x80)<<2); 110 | #endif 111 | pulse_low(P_WR, B_WR); 112 | break; 113 | case LATCHED_16: 114 | asm("nop"); // Mode is unsupported 115 | break; 116 | } 117 | } 118 | 119 | void UTFT::_set_direction_registers(byte mode) 120 | { 121 | if (mode!=LATCHED_16) 122 | { 123 | #if defined(CTE_DUE_SHIELD) 124 | if (mode==16) 125 | { 126 | REG_PIOC_OER=0x000FF1FE; 127 | } 128 | else 129 | REG_PIOC_OER=0x000FF000; 130 | #elif defined(EHOUSE_DUE_SHIELD) 131 | if (mode==16) 132 | { 133 | REG_PIOC_OER=0x000FF3FC; 134 | REG_PIOC_OWER=0x000FF3FC; 135 | } 136 | else 137 | REG_PIOC_OER=0x000FF000; 138 | #else 139 | REG_PIOA_OER=0x0000c000; //PA14,PA15 enable 140 | REG_PIOB_OER=0x04000000; //PB26 enable 141 | REG_PIOD_OER=0x0000064f; //PD0-3,PD6,PD9-10 enable 142 | if (mode==16) 143 | { 144 | REG_PIOA_OER=0x00000080; //PA7 enable 145 | REG_PIOC_OER=0x0000003e; //PC1 - PC5 enable 146 | } 147 | #endif 148 | } 149 | else 150 | { 151 | asm("nop"); // Mode is unsupported 152 | } 153 | } 154 | 155 | void UTFT::_fast_fill_16(int ch, int cl, long pix) 156 | { 157 | long blocks; 158 | 159 | #if defined(CTE_DUE_SHIELD) 160 | REG_PIOC_CODR=0xFF1FE; 161 | REG_PIOC_SODR=(cl<<1) & 0x1FE; 162 | REG_PIOC_SODR=(ch<<12) & 0xFF000; 163 | #elif defined(EHOUSE_DUE_SHIELD) 164 | PIOC->PIO_ODSR = ((PIOC->PIO_ODSR&(~0x000FF3FC)) | ((((uint32_t)cl)<<2) | (((uint32_t)ch)<<12))); 165 | #else 166 | REG_PIOA_CODR=0x0000C080; 167 | REG_PIOC_CODR=0x0000003E; 168 | REG_PIOD_CODR=0x0000064F; 169 | REG_PIOA_SODR=((ch & 0x06)<<13) | ((cl & 0x40)<<1); 170 | (ch & 0x01) ? REG_PIOB_SODR = 0x4000000 : REG_PIOB_CODR = 0x4000000; 171 | REG_PIOC_SODR=((cl & 0x01)<<5) | ((cl & 0x02)<<3) | ((cl & 0x04)<<1) | ((cl & 0x08)>>1) | ((cl & 0x10)>>3); 172 | REG_PIOD_SODR=((ch & 0x78)>>3) | ((ch & 0x80)>>1) | ((cl & 0x20)<<5) | ((cl & 0x80)<<2); 173 | #endif 174 | 175 | blocks = pix/16; 176 | for (int i=0; i>3) | ((ch & 0x80)>>1); 215 | #endif 216 | 217 | blocks = pix/16; 218 | for (int i=0; i>4); 73 | pulse_low(P_WR, B_WR); 74 | cport (PORTD, 0xF0); 75 | sport (PORTD, (VL & 0x0F)); 76 | cport (PORTB, 0xF0); 77 | sport (PORTB, (VL & 0xF0)>>4); 78 | pulse_low(P_WR, B_WR); 79 | break; 80 | case 16: 81 | cport (PORTD, 0x90); 82 | sport (PORTD, (VH & 0x0F) | ((VL & 0x03)<<5)); 83 | PORTB = ((VH & 0xF0)>>4) | ((VL & 0x3C)<<2); 84 | cport (PORTA, 0x3F); 85 | sport (PORTA, ((VL & 0x40)<<1) | ((VL & 0x80)>>1)); 86 | pulse_low(P_WR, B_WR); 87 | break; 88 | case LATCHED_16: 89 | cport (PORTD, 0xF0); 90 | sport (PORTD, (VH & 0x0F)); 91 | cport (PORTB, 0xF0); 92 | sport (PORTB, (VH & 0xF0)>>4); 93 | cbi(P_ALE, B_ALE); 94 | pulse_high(P_ALE, B_ALE); 95 | cbi(P_CS, B_CS); 96 | cport (PORTD, 0xF0); 97 | sport (PORTD, (VL & 0x0F)); 98 | cport (PORTB, 0xF0); 99 | sport (PORTB, (VL & 0xF0)>>4); 100 | pulse_low(P_WR, B_WR); 101 | sbi(P_CS, B_CS); 102 | break; 103 | } 104 | } 105 | 106 | void UTFT::_set_direction_registers(byte mode) 107 | { 108 | DDRB |= 0x0F; 109 | DDRD |= 0x0F; 110 | if (mode==16) 111 | { 112 | DDRB = 0xFF; 113 | DDRD |= 0x6F; 114 | DDRA |= 0xC0; 115 | } 116 | 117 | } 118 | 119 | void UTFT::_fast_fill_16(int ch, int cl, long pix) 120 | { 121 | long blocks; 122 | 123 | cport (PORTD, 0x90); 124 | sport (PORTD, (ch & 0x0F) | ((cl & 0x03)<<5)); 125 | PORTB = ((ch & 0xF0)>>4) | ((cl & 0x3C)<<2); 126 | cport (PORTA, 0x3F); 127 | sport (PORTA, ((cl & 0x40)<<1) | ((cl & 0x80)>>1)); 128 | 129 | blocks = pix/16; 130 | for (int i=0; i>4); 164 | 165 | blocks = pix/16; 166 | for (int i=0; i>6) & 0x03); 82 | PORTB = VL & 0x3F; 83 | pulse_low(P_WR, B_WR); 84 | break; 85 | case LATCHED_16: 86 | PORTD = VH; 87 | cbi(P_ALE, B_ALE); 88 | pulse_high(P_ALE, B_ALE); 89 | cbi(P_CS, B_CS); 90 | PORTD = VL; 91 | pulse_low(P_WR, B_WR); 92 | sbi(P_CS, B_CS); 93 | break; 94 | } 95 | } 96 | 97 | void UTFT::LCD_Writ_Bus16(char VH,char VL, byte mode) 98 | { 99 | switch (mode) 100 | { 101 | case 1: 102 | if (display_serial_mode==SERIAL_4PIN) 103 | { 104 | if (VH==1) 105 | sbi(P_SDA, B_SDA); 106 | else 107 | cbi(P_SDA, B_SDA); 108 | pulse_low(P_SCL, B_SCL); 109 | } 110 | else //SERIAL_5PIN 111 | { 112 | if (VH==1) 113 | sbi(P_RS, B_RS); 114 | else 115 | cbi(P_RS, B_RS); 116 | } 117 | 118 | if (VL & 0x80) 119 | sbi(P_SDA, B_SDA); 120 | else 121 | cbi(P_SDA, B_SDA); 122 | pulse_low(P_SCL, B_SCL); 123 | if (VL & 0x40) 124 | sbi(P_SDA, B_SDA); 125 | else 126 | cbi(P_SDA, B_SDA); 127 | pulse_low(P_SCL, B_SCL); 128 | if (VL & 0x20) 129 | sbi(P_SDA, B_SDA); 130 | else 131 | cbi(P_SDA, B_SDA); 132 | pulse_low(P_SCL, B_SCL); 133 | if (VL & 0x10) 134 | sbi(P_SDA, B_SDA); 135 | else 136 | cbi(P_SDA, B_SDA); 137 | pulse_low(P_SCL, B_SCL); 138 | if (VL & 0x08) 139 | sbi(P_SDA, B_SDA); 140 | else 141 | cbi(P_SDA, B_SDA); 142 | pulse_low(P_SCL, B_SCL); 143 | if (VL & 0x04) 144 | sbi(P_SDA, B_SDA); 145 | else 146 | cbi(P_SDA, B_SDA); 147 | pulse_low(P_SCL, B_SCL); 148 | if (VL & 0x02) 149 | sbi(P_SDA, B_SDA); 150 | else 151 | cbi(P_SDA, B_SDA); 152 | pulse_low(P_SCL, B_SCL); 153 | if (VL & 0x01) 154 | sbi(P_SDA, B_SDA); 155 | else 156 | cbi(P_SDA, B_SDA); 157 | pulse_low(P_SCL, B_SCL); 158 | break; 159 | case 8: 160 | // PORTD = VH; 161 | // pulse_low(P_WR, B_WR); 162 | // PORTD = VL; 163 | // pulse_low(P_WR, B_WR); 164 | PORTB = VH & 0x3; 165 | PORTD = VH & 0xFD; 166 | pulse_low(P_WR, B_WR); 167 | 168 | PORTB = VL & 0x3; 169 | PORTD = VL & 0xFD; 170 | pulse_low(P_WR, B_WR); 171 | break; 172 | case 16: 173 | PORTD = VH; 174 | cport(PORTC, 0xFC); 175 | sport(PORTC, (VL>>6) & 0x03); 176 | PORTB = VL & 0x3F; 177 | pulse_low(P_WR, B_WR); 178 | break; 179 | case LATCHED_16: 180 | PORTD = VH; 181 | cbi(P_ALE, B_ALE); 182 | pulse_high(P_ALE, B_ALE); 183 | cbi(P_CS, B_CS); 184 | PORTD = VL; 185 | pulse_low(P_WR, B_WR); 186 | sbi(P_CS, B_CS); 187 | break; 188 | } 189 | } 190 | 191 | void UTFT::_set_direction_registers(byte mode) 192 | { 193 | // DDRD = 0xFF; 194 | // if (mode==16) 195 | // { 196 | // DDRB |= 0x3F; 197 | // DDRC |= 0x03; 198 | // } 199 | for(int p=2;p<10;p++) 200 | { 201 | pinMode(p,OUTPUT); 202 | } 203 | 204 | } 205 | 206 | void UTFT::_fast_fill_16(int ch, int cl, long pix) 207 | { 208 | long blocks; 209 | 210 | PORTD = ch; 211 | cport(PORTC, 0xFC); 212 | sport(PORTC, (cl>>6) & 0x03); 213 | PORTB = cl & 0x3F; 214 | 215 | blocks = pix/16; 216 | for (int i=0; i>3) + ((VH & 0x04)>>1) + ((VH & 0x03)<<2); 74 | PORTE += ((VH & 0x80)>>1); 75 | pulse_low(P_WR, B_WR); 76 | 77 | cport(PORTC, 0xBF); 78 | cport(PORTD, 0x60); 79 | cport(PORTE, 0xBF); 80 | PORTC += ((VL & 0x20)<<1); 81 | PORTD += ((VL & 0x40)<<1) + (VL & 0x10) + ((VL & 0x08)>>3) + ((VL & 0x04)>>1) + ((VL & 0x03)<<2); 82 | PORTE += ((VL & 0x80)>>1); 83 | pulse_low(P_WR, B_WR); 84 | break; 85 | case 16: 86 | cport(PORTB, 0x0F); 87 | cport(PORTC, 0x3F); 88 | cport(PORTD, 0x20); 89 | cport(PORTE, 0xBF); 90 | cport(PORTF, 0x3F); 91 | 92 | PORTB |= ((VL & 0x0F)<<4); 93 | PORTC |= ((VL & 0x20)<<2) + ((VH & 0x20)<<1); 94 | PORTD |= ((VH & 0x40)<<1) + (VH & 0x10) + ((VH & 0x08)>>3) + ((VH & 0x04)>>1) + ((VH & 0x03)<<2) + ((VL & 0x10)<<2); 95 | PORTE |= ((VH & 0x80)>>1); 96 | PORTF |= ((VL & 0x80)>>1) + ((VL & 0x40)<<1); 97 | 98 | pulse_low(P_WR, B_WR); 99 | break; 100 | case LATCHED_16: 101 | cport(PORTC, 0xBF); 102 | cport(PORTD, 0x60); 103 | cport(PORTE, 0xBF); 104 | PORTC += ((VH & 0x20)<<1); 105 | PORTD += ((VH & 0x40)<<1) + (VH & 0x10) + ((VH & 0x08)>>3) + ((VH & 0x04)>>1) + ((VH & 0x03)<<2); 106 | PORTE += ((VH & 0x80)>>1); 107 | cbi(P_ALE, B_ALE); 108 | pulse_high(P_ALE, B_ALE); 109 | cbi(P_CS, B_CS); 110 | cport(PORTC, 0xBF); 111 | cport(PORTD, 0x60); 112 | cport(PORTE, 0xBF); 113 | PORTC += ((VL & 0x20)<<1); 114 | PORTD += ((VL & 0x40)<<1) + (VL & 0x10) + ((VL & 0x08)>>3) + ((VL & 0x04)>>1) + ((VL & 0x03)<<2); 115 | PORTE += ((VL & 0x80)>>1); 116 | pulse_low(P_WR, B_WR); 117 | sbi(P_CS, B_CS); 118 | break; 119 | } 120 | } 121 | 122 | void UTFT::_set_direction_registers(byte mode) 123 | { 124 | switch (mode) 125 | { 126 | case 8: 127 | case LATCHED_16: 128 | DDRC |= 0x40; 129 | DDRD |= 0x9F; 130 | DDRE |= 0x40; 131 | break; 132 | case 16: 133 | DDRB |= 0xF0; 134 | DDRC |= 0xC0; 135 | DDRD |= 0xDF; 136 | DDRE |= 0x40; 137 | DDRF |= 0xC0; 138 | break; 139 | } 140 | } 141 | 142 | void UTFT::_fast_fill_16(int ch, int cl, long pix) 143 | { 144 | long blocks; 145 | 146 | cport(PORTB, 0x0F); 147 | cport(PORTC, 0x3F); 148 | cport(PORTD, 0x20); 149 | cport(PORTE, 0xBF); 150 | cport(PORTF, 0x3F); 151 | 152 | PORTB |= ((cl & 0x0F)<<4); 153 | PORTC |= ((cl & 0x20)<<2) + ((ch & 0x20)<<1); 154 | PORTD |= ((ch & 0x40)<<1) + (ch & 0x10) + ((ch & 0x08)>>3) + ((ch & 0x04)>>1) + ((ch & 0x03)<<2) + ((cl & 0x10)<<2); 155 | PORTE |= ((ch & 0x80)>>1); 156 | PORTF |= ((cl & 0x80)>>1) + ((cl & 0x40)<<1); 157 | 158 | blocks = pix/16; 159 | for (int i=0; i>3) + ((ch & 0x04)>>1) + ((ch & 0x03)<<2); 195 | PORTE |= ((ch & 0x80)>>1); 196 | 197 | blocks = pix/16; 198 | for (int i=0; i>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2b); 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2c); 13 | break; 14 | -------------------------------------------------------------------------------- /tft_drivers/hx8347a/initlcd.h: -------------------------------------------------------------------------------- 1 | case HX8347A: 2 | LCD_Write_COM_DATA(0x46,0x00A4); 3 | LCD_Write_COM_DATA(0x47,0x0053); 4 | LCD_Write_COM_DATA(0x48,0x0000); 5 | LCD_Write_COM_DATA(0x49,0x0044); 6 | LCD_Write_COM_DATA(0x4a,0x0004); 7 | LCD_Write_COM_DATA(0x4b,0x0067); 8 | LCD_Write_COM_DATA(0x4c,0x0033); 9 | LCD_Write_COM_DATA(0x4d,0x0077); 10 | LCD_Write_COM_DATA(0x4e,0x0012); 11 | LCD_Write_COM_DATA(0x4f,0x004C); 12 | LCD_Write_COM_DATA(0x50,0x0046); 13 | LCD_Write_COM_DATA(0x51,0x0044); 14 | 15 | //240x320 window setting 16 | LCD_Write_COM_DATA(0x02,0x0000); // Column address start2 17 | LCD_Write_COM_DATA(0x03,0x0000); // Column address start1 18 | LCD_Write_COM_DATA(0x04,0x0000); // Column address end2 19 | LCD_Write_COM_DATA(0x05,0x00ef); // Column address end1 20 | LCD_Write_COM_DATA(0x06,0x0000); // Row address start2 21 | LCD_Write_COM_DATA(0x07,0x0000); // Row address start1 22 | LCD_Write_COM_DATA(0x08,0x0001); // Row address end2 23 | LCD_Write_COM_DATA(0x09,0x003f); // Row address end1 24 | 25 | // Display Setting 26 | LCD_Write_COM_DATA(0x01,0x0006); // IDMON=0, INVON=1, NORON=1, PTLON=0 27 | LCD_Write_COM_DATA(0x16,0x00C8); // MY=0, MX=0, MV=0, ML=1, BGR=0, TEON=0 0048 28 | LCD_Write_COM_DATA(0x23,0x0095); // N_DC=1001 0101 29 | LCD_Write_COM_DATA(0x24,0x0095); // PI_DC=1001 0101 30 | LCD_Write_COM_DATA(0x25,0x00FF); // I_DC=1111 1111 31 | 32 | LCD_Write_COM_DATA(0x27,0x0002); // N_BP=0000 0010 33 | LCD_Write_COM_DATA(0x28,0x0002); // N_FP=0000 0010 34 | LCD_Write_COM_DATA(0x29,0x0002); // PI_BP=0000 0010 35 | LCD_Write_COM_DATA(0x2a,0x0002); // PI_FP=0000 0010 36 | LCD_Write_COM_DATA(0x2C,0x0002); // I_BP=0000 0010 37 | LCD_Write_COM_DATA(0x2d,0x0002); // I_FP=0000 0010 38 | 39 | LCD_Write_COM_DATA(0x3a,0x0001); // N_RTN=0000, N_NW=001 0001 40 | LCD_Write_COM_DATA(0x3b,0x0000); // P_RTN=0000, P_NW=001 41 | LCD_Write_COM_DATA(0x3c,0x00f0); // I_RTN=1111, I_NW=000 42 | LCD_Write_COM_DATA(0x3d,0x0000); // DIV=00 43 | delay(1); 44 | LCD_Write_COM_DATA(0x35,0x0038); // EQS=38h 45 | LCD_Write_COM_DATA(0x36,0x0078); // EQP=78h 46 | LCD_Write_COM_DATA(0x3E,0x0038); // SON=38h 47 | LCD_Write_COM_DATA(0x40,0x000F); // GDON=0Fh 48 | LCD_Write_COM_DATA(0x41,0x00F0); // GDOFF 49 | 50 | // Power Supply Setting 51 | LCD_Write_COM_DATA(0x19,0x0049); // CADJ=0100, CUADJ=100, OSD_EN=1 ,60Hz 52 | LCD_Write_COM_DATA(0x93,0x000F); // RADJ=1111, 100% 53 | delay(1); 54 | LCD_Write_COM_DATA(0x20,0x0040); // BT=0100 55 | LCD_Write_COM_DATA(0x1D,0x0007); // VC1=111 0007 56 | LCD_Write_COM_DATA(0x1E,0x0000); // VC3=000 57 | LCD_Write_COM_DATA(0x1F,0x0004); // VRH=0011 58 | 59 | //VCOM SETTING 60 | LCD_Write_COM_DATA(0x44,0x004D); // VCM=101 0000 4D 61 | LCD_Write_COM_DATA(0x45,0x000E); // VDV=1 0001 0011 62 | delay(1); 63 | LCD_Write_COM_DATA(0x1C,0x0004); // AP=100 64 | delay(2); 65 | 66 | LCD_Write_COM_DATA(0x1B,0x0018); // GASENB=0, PON=0, DK=1, XDK=0, VLCD_TRI=0, STB=0 67 | delay(1); 68 | LCD_Write_COM_DATA(0x1B,0x0010); // GASENB=0, PON=1, DK=0, XDK=0, VLCD_TRI=0, STB=0 69 | delay(1); 70 | LCD_Write_COM_DATA(0x43,0x0080); //set VCOMG=1 71 | delay(2); 72 | 73 | // Display ON Setting 74 | LCD_Write_COM_DATA(0x90,0x007F); // SAP=0111 1111 75 | LCD_Write_COM_DATA(0x26,0x0004); //GON=0, DTE=0, D=01 76 | delay(1); 77 | LCD_Write_COM_DATA(0x26,0x0024); //GON=1, DTE=0, D=01 78 | LCD_Write_COM_DATA(0x26,0x002C); //GON=1, DTE=0, D=11 79 | delay(1); 80 | LCD_Write_COM_DATA(0x26,0x003C); //GON=1, DTE=1, D=11 81 | 82 | // INTERNAL REGISTER SETTING 83 | LCD_Write_COM_DATA(0x57,0x0002); // TEST_Mode=1: into TEST mode 84 | LCD_Write_COM_DATA(0x95,0x0001); // SET DISPLAY CLOCK AND PUMPING CLOCK TO SYNCHRONIZE 85 | LCD_Write_COM_DATA(0x57,0x0000); // TEST_Mode=0: exit TEST mode 86 | //LCD_Write_COM_DATA(0x21,0x0000); 87 | LCD_Write_COM(0x22); 88 | break; 89 | -------------------------------------------------------------------------------- /tft_drivers/hx8347a/setxy.h: -------------------------------------------------------------------------------- 1 | case HX8347A: 2 | LCD_Write_COM_DATA(0x02,x1>>8); 3 | LCD_Write_COM_DATA(0x03,x1); 4 | LCD_Write_COM_DATA(0x04,x2>>8); 5 | LCD_Write_COM_DATA(0x05,x2); 6 | LCD_Write_COM_DATA(0x06,y1>>8); 7 | LCD_Write_COM_DATA(0x07,y1); 8 | LCD_Write_COM_DATA(0x08,y2>>8); 9 | LCD_Write_COM_DATA(0x09,y2); 10 | LCD_Write_COM(0x22); 11 | break; 12 | -------------------------------------------------------------------------------- /tft_drivers/hx8352a/initlcd.h: -------------------------------------------------------------------------------- 1 | case HX8352A: 2 | LCD_Write_COM(0x83); 3 | LCD_Write_DATA(0x02); //TESTM=1 4 | 5 | LCD_Write_COM(0x85); 6 | LCD_Write_DATA(0x03); //VDC_SEL=011 7 | LCD_Write_COM(0x8B); 8 | LCD_Write_DATA(0x01); 9 | LCD_Write_COM(0x8C); 10 | LCD_Write_DATA(0x93); //STBA[7]=1,STBA[5:4]=01,STBA[1:0]=11 11 | 12 | LCD_Write_COM(0x91); 13 | LCD_Write_DATA(0x01); //DCDC_SYNC=1 14 | 15 | LCD_Write_COM(0x83); 16 | LCD_Write_DATA(0x00); //TESTM=0 17 | //Gamma Setting 18 | 19 | LCD_Write_COM(0x3E); 20 | LCD_Write_DATA(0xB0); 21 | LCD_Write_COM(0x3F); 22 | LCD_Write_DATA(0x03); 23 | LCD_Write_COM(0x40); 24 | LCD_Write_DATA(0x10); 25 | LCD_Write_COM(0x41); 26 | LCD_Write_DATA(0x56); 27 | LCD_Write_COM(0x42); 28 | LCD_Write_DATA(0x13); 29 | LCD_Write_COM(0x43); 30 | LCD_Write_DATA(0x46); 31 | LCD_Write_COM(0x44); 32 | LCD_Write_DATA(0x23); 33 | LCD_Write_COM(0x45); 34 | LCD_Write_DATA(0x76); 35 | LCD_Write_COM(0x46); 36 | LCD_Write_DATA(0x00); 37 | LCD_Write_COM(0x47); 38 | LCD_Write_DATA(0x5E); 39 | LCD_Write_COM(0x48); 40 | LCD_Write_DATA(0x4F); 41 | LCD_Write_COM(0x49); 42 | LCD_Write_DATA(0x40); 43 | //**********Power On sequence************ 44 | 45 | LCD_Write_COM(0x17); 46 | LCD_Write_DATA(0x91); 47 | 48 | LCD_Write_COM(0x2B); 49 | LCD_Write_DATA(0xF9); 50 | delay(10); 51 | 52 | LCD_Write_COM(0x1B); 53 | LCD_Write_DATA(0x14); 54 | 55 | LCD_Write_COM(0x1A); 56 | LCD_Write_DATA(0x11); 57 | 58 | LCD_Write_COM(0x1C); 59 | LCD_Write_DATA(0x06); 60 | 61 | LCD_Write_COM(0x1F); 62 | LCD_Write_DATA(0x42); 63 | delay(20); 64 | 65 | LCD_Write_COM(0x19); 66 | LCD_Write_DATA(0x0A); 67 | 68 | LCD_Write_COM(0x19); 69 | LCD_Write_DATA(0x1A); 70 | delay(40); 71 | 72 | 73 | LCD_Write_COM(0x19); 74 | LCD_Write_DATA(0x12); 75 | delay(40); 76 | 77 | LCD_Write_COM(0x1E); 78 | LCD_Write_DATA(0x27); 79 | delay(100); 80 | 81 | 82 | //**********DISPLAY ON SETTING*********** 83 | 84 | LCD_Write_COM(0x24); 85 | LCD_Write_DATA(0x60); 86 | 87 | LCD_Write_COM(0x3D); 88 | LCD_Write_DATA(0x40); 89 | 90 | LCD_Write_COM(0x34); 91 | LCD_Write_DATA(0x38); 92 | 93 | LCD_Write_COM(0x35); 94 | LCD_Write_DATA(0x38); 95 | 96 | LCD_Write_COM(0x24); 97 | LCD_Write_DATA(0x38); 98 | delay(40); 99 | 100 | LCD_Write_COM(0x24); 101 | LCD_Write_DATA(0x3C); 102 | 103 | LCD_Write_COM(0x16); 104 | LCD_Write_DATA(0x1C); 105 | 106 | LCD_Write_COM(0x01); 107 | LCD_Write_DATA(0x06); 108 | 109 | LCD_Write_COM(0x55); 110 | LCD_Write_DATA(0x00); 111 | 112 | LCD_Write_COM(0x02); 113 | LCD_Write_DATA(0x00); 114 | LCD_Write_COM(0x03); 115 | LCD_Write_DATA(0x00); 116 | LCD_Write_COM(0x04); 117 | LCD_Write_DATA(0x00); 118 | LCD_Write_COM(0x05); 119 | LCD_Write_DATA(0xef); 120 | 121 | LCD_Write_COM(0x06); 122 | LCD_Write_DATA(0x00); 123 | LCD_Write_COM(0x07); 124 | LCD_Write_DATA(0x00); 125 | LCD_Write_COM(0x08); 126 | LCD_Write_DATA(0x01); 127 | LCD_Write_COM(0x09); 128 | LCD_Write_DATA(0x8f); 129 | 130 | LCD_Write_COM(0x22); 131 | break; 132 | -------------------------------------------------------------------------------- /tft_drivers/hx8352a/setxy.h: -------------------------------------------------------------------------------- 1 | case HX8352A: 2 | LCD_Write_COM_DATA(0x02,x1>>8); 3 | LCD_Write_COM_DATA(0x03,x1); 4 | LCD_Write_COM_DATA(0x04,x2>>8); 5 | LCD_Write_COM_DATA(0x05,x2); 6 | LCD_Write_COM_DATA(0x06,y1>>8); 7 | LCD_Write_COM_DATA(0x07,y1); 8 | LCD_Write_COM_DATA(0x08,y2>>8); 9 | LCD_Write_COM_DATA(0x09,y2); 10 | LCD_Write_COM(0x22); 11 | break; 12 | -------------------------------------------------------------------------------- /tft_drivers/hx8353c/initlcd.h: -------------------------------------------------------------------------------- 1 | case HX8353C: 2 | LCD_Write_COM(0xB9);//SETEXTC 3 | LCD_Write_DATA(0xFF); 4 | LCD_Write_DATA(0x83); 5 | LCD_Write_DATA(0x53); 6 | 7 | LCD_Write_COM(0xB0);//RADJ 8 | LCD_Write_DATA(0x3C); 9 | LCD_Write_DATA(0x01); 10 | 11 | LCD_Write_COM(0xB6);//VCOM 12 | LCD_Write_DATA(0x94); 13 | LCD_Write_DATA(0x6C); 14 | LCD_Write_DATA(0x50); 15 | 16 | LCD_Write_COM(0xB1);//PWR 17 | LCD_Write_DATA(0x00); 18 | LCD_Write_DATA(0x01); 19 | LCD_Write_DATA(0x1B); 20 | LCD_Write_DATA(0x03); 21 | LCD_Write_DATA(0x01); 22 | LCD_Write_DATA(0x08); 23 | LCD_Write_DATA(0x77); 24 | LCD_Write_DATA(0x89); 25 | 26 | LCD_Write_COM(0xE0); //Gamma setting for tpo Panel 27 | LCD_Write_DATA(0x50); 28 | LCD_Write_DATA(0x77); 29 | LCD_Write_DATA(0x40); 30 | LCD_Write_DATA(0x08); 31 | LCD_Write_DATA(0xBF); 32 | LCD_Write_DATA(0x00); 33 | LCD_Write_DATA(0x03); 34 | LCD_Write_DATA(0x0F); 35 | LCD_Write_DATA(0x00); 36 | LCD_Write_DATA(0x01); 37 | LCD_Write_DATA(0x73); 38 | LCD_Write_DATA(0x00); 39 | LCD_Write_DATA(0x72); 40 | LCD_Write_DATA(0x03); 41 | LCD_Write_DATA(0xB0); 42 | LCD_Write_DATA(0x0F); 43 | LCD_Write_DATA(0x08); 44 | LCD_Write_DATA(0x00); 45 | LCD_Write_DATA(0x0F); 46 | 47 | LCD_Write_COM(0x3A); 48 | LCD_Write_DATA(0x05); //05 49 | LCD_Write_COM(0x36); 50 | LCD_Write_DATA(0xC0); //83 //0B 51 | 52 | LCD_Write_COM(0x11); // SLPOUT 53 | delay(150); 54 | 55 | LCD_Write_COM(0x29); // display on 56 | 57 | delay(150); 58 | LCD_Write_COM(0x2D); //Look up table 59 | 60 | for(int j=0;j<32;j++) 61 | { LCD_Write_DATA(2*j); } //Red 62 | for(int j=0;j<64;j++) 63 | { LCD_Write_DATA(1*j); } //Green 64 | for(int j=0;j<32;j++) 65 | { LCD_Write_DATA(2*j); } //Blue 66 | 67 | LCD_Write_COM(0x2c); 68 | delay(150); 69 | break; 70 | -------------------------------------------------------------------------------- /tft_drivers/hx8353c/setxy.h: -------------------------------------------------------------------------------- 1 | case HX8353C: 2 | LCD_Write_COM(0x2a); 3 | LCD_Write_DATA(x1>>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2b); 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2c); 13 | break; 14 | -------------------------------------------------------------------------------- /tft_drivers/ili9320/initlcd.h: -------------------------------------------------------------------------------- 1 | case ILI9320_8: 2 | case ILI9320_16: 3 | LCD_Write_COM_DATA(0xe5, 0x8000); 4 | LCD_Write_COM_DATA(0x00, 0x0001); 5 | LCD_Write_COM_DATA(0x01, 0x0100); 6 | LCD_Write_COM_DATA(0x02, 0x0700); 7 | LCD_Write_COM_DATA(0x03, 0x1030); 8 | LCD_Write_COM_DATA(0x04, 0x0000); 9 | LCD_Write_COM_DATA(0x08, 0x0202); 10 | LCD_Write_COM_DATA(0x09, 0x0000); 11 | LCD_Write_COM_DATA(0x0A, 0x0000); 12 | LCD_Write_COM_DATA(0x0C, 0x0000); 13 | LCD_Write_COM_DATA(0x0D, 0x0000); 14 | LCD_Write_COM_DATA(0x0F, 0x0000); 15 | //-----Power On sequence----------------------- 16 | LCD_Write_COM_DATA(0x10, 0x0000); 17 | LCD_Write_COM_DATA(0x11, 0x0007); 18 | LCD_Write_COM_DATA(0x12, 0x0000); 19 | LCD_Write_COM_DATA(0x13, 0x0000); 20 | delay(50); 21 | LCD_Write_COM_DATA(0x10, 0x17B0); 22 | LCD_Write_COM_DATA(0x11, 0x0007); 23 | delay(10); 24 | LCD_Write_COM_DATA(0x12, 0x013A); 25 | delay(10); 26 | LCD_Write_COM_DATA(0x13, 0x1A00); 27 | LCD_Write_COM_DATA(0x29, 0x000c); 28 | delay(10); 29 | //-----Gamma control----------------------- 30 | LCD_Write_COM_DATA(0x30, 0x0000); 31 | LCD_Write_COM_DATA(0x31, 0x0505); 32 | LCD_Write_COM_DATA(0x32, 0x0004); 33 | LCD_Write_COM_DATA(0x35, 0x0006); 34 | LCD_Write_COM_DATA(0x36, 0x0707); 35 | LCD_Write_COM_DATA(0x37, 0x0105); 36 | LCD_Write_COM_DATA(0x38, 0x0002); 37 | LCD_Write_COM_DATA(0x39, 0x0707); 38 | LCD_Write_COM_DATA(0x3C, 0x0704); 39 | LCD_Write_COM_DATA(0x3D, 0x0807); 40 | //-----Set RAM area----------------------- 41 | LCD_Write_COM_DATA(0x50, 0x0000); 42 | LCD_Write_COM_DATA(0x51, 0x00EF); 43 | LCD_Write_COM_DATA(0x52, 0x0000); 44 | LCD_Write_COM_DATA(0x53, 0x013F); 45 | LCD_Write_COM_DATA(0x60, 0x2700); 46 | LCD_Write_COM_DATA(0x61, 0x0001); 47 | LCD_Write_COM_DATA(0x6A, 0x0000); 48 | LCD_Write_COM_DATA(0x21, 0x0000); 49 | LCD_Write_COM_DATA(0x20, 0x0000); 50 | //-----Partial Display Control------------ 51 | LCD_Write_COM_DATA(0x80, 0x0000); 52 | LCD_Write_COM_DATA(0x81, 0x0000); 53 | LCD_Write_COM_DATA(0x82, 0x0000); 54 | LCD_Write_COM_DATA(0x83, 0x0000); 55 | LCD_Write_COM_DATA(0x84, 0x0000); 56 | LCD_Write_COM_DATA(0x85, 0x0000); 57 | //-----Panel Control---------------------- 58 | LCD_Write_COM_DATA(0x90, 0x0010); 59 | LCD_Write_COM_DATA(0x92, 0x0000); 60 | LCD_Write_COM_DATA(0x93, 0x0003); 61 | LCD_Write_COM_DATA(0x95, 0x0110); 62 | LCD_Write_COM_DATA(0x97, 0x0000); 63 | LCD_Write_COM_DATA(0x98, 0x0000); 64 | //-----Display on----------------------- 65 | LCD_Write_COM_DATA(0x07, 0x0173); 66 | delay(50); 67 | break; 68 | -------------------------------------------------------------------------------- /tft_drivers/ili9320/setxy.h: -------------------------------------------------------------------------------- 1 | case ILI9320_8: 2 | case ILI9320_16: 3 | LCD_Write_COM_DATA(0x20,x1); 4 | LCD_Write_COM_DATA(0x21,y1); 5 | LCD_Write_COM_DATA(0x50,x1); 6 | LCD_Write_COM_DATA(0x52,y1); 7 | LCD_Write_COM_DATA(0x51,x2); 8 | LCD_Write_COM_DATA(0x53,y2); 9 | LCD_Write_COM(0x22); 10 | break; 11 | -------------------------------------------------------------------------------- /tft_drivers/ili9325c/initlcd.h: -------------------------------------------------------------------------------- 1 | case ILI9325C: 2 | LCD_Write_COM_DATA(0xE5, 0x78F0); // set SRAM internal timing 3 | LCD_Write_COM_DATA(0x01, 0x0100); // set Driver Output Control 4 | LCD_Write_COM_DATA(0x02, 0x0700); // set 1 line inversion 5 | LCD_Write_COM_DATA(0x03, 0x1030); // set GRAM write direction and BGR=1. 6 | LCD_Write_COM_DATA(0x04, 0x0000); // Resize register 7 | LCD_Write_COM_DATA(0x08, 0x0207); // set the back porch and front porch 8 | LCD_Write_COM_DATA(0x09, 0x0000); // set non-display area refresh cycle ISC[3:0] 9 | LCD_Write_COM_DATA(0x0A, 0x0000); // FMARK function 10 | LCD_Write_COM_DATA(0x0C, 0x0000); // RGB interface setting 11 | LCD_Write_COM_DATA(0x0D, 0x0000); // Frame marker Position 12 | LCD_Write_COM_DATA(0x0F, 0x0000); // RGB interface polarity 13 | //*************Power On sequence ****************// 14 | LCD_Write_COM_DATA(0x10, 0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB 15 | LCD_Write_COM_DATA(0x11, 0x0007); // DC1[2:0], DC0[2:0], VC[2:0] 16 | LCD_Write_COM_DATA(0x12, 0x0000); // VREG1OUT voltage 17 | LCD_Write_COM_DATA(0x13, 0x0000); // VDV[4:0] for VCOM amplitude 18 | LCD_Write_COM_DATA(0x07, 0x0001); 19 | delay(200); // Dis-charge capacitor power voltage 20 | LCD_Write_COM_DATA(0x10, 0x1090); // SAP, BT[3:0], AP, DSTB, SLP, STB 21 | LCD_Write_COM_DATA(0x11, 0x0227); // Set DC1[2:0], DC0[2:0], VC[2:0] 22 | delay(50); // Delay 50ms 23 | LCD_Write_COM_DATA(0x12, 0x001F); // 0012 24 | delay(50); // Delay 50ms 25 | LCD_Write_COM_DATA(0x13, 0x1500); // VDV[4:0] for VCOM amplitude 26 | LCD_Write_COM_DATA(0x29, 0x0027); // 04 VCM[5:0] for VCOMH 27 | LCD_Write_COM_DATA(0x2B, 0x000D); // Set Frame Rate 28 | delay(50); // Delay 50ms 29 | LCD_Write_COM_DATA(0x20, 0x0000); // GRAM horizontal Address 30 | LCD_Write_COM_DATA(0x21, 0x0000); // GRAM Vertical Address 31 | // ----------- Adjust the Gamma Curve ----------// 32 | LCD_Write_COM_DATA(0x30, 0x0000); 33 | LCD_Write_COM_DATA(0x31, 0x0707); 34 | LCD_Write_COM_DATA(0x32, 0x0307); 35 | LCD_Write_COM_DATA(0x35, 0x0200); 36 | LCD_Write_COM_DATA(0x36, 0x0008); 37 | LCD_Write_COM_DATA(0x37, 0x0004); 38 | LCD_Write_COM_DATA(0x38, 0x0000); 39 | LCD_Write_COM_DATA(0x39, 0x0707); 40 | LCD_Write_COM_DATA(0x3C, 0x0002); 41 | LCD_Write_COM_DATA(0x3D, 0x1D04); 42 | //------------------ Set GRAM area ---------------// 43 | LCD_Write_COM_DATA(0x50, 0x0000); // Horizontal GRAM Start Address 44 | LCD_Write_COM_DATA(0x51, 0x00EF); // Horizontal GRAM End Address 45 | LCD_Write_COM_DATA(0x52, 0x0000); // Vertical GRAM Start Address 46 | LCD_Write_COM_DATA(0x53, 0x013F); // Vertical GRAM Start Address 47 | LCD_Write_COM_DATA(0x60, 0xA700); // Gate Scan Line 48 | LCD_Write_COM_DATA(0x61, 0x0001); // NDL,VLE, REV 49 | LCD_Write_COM_DATA(0x6A, 0x0000); // set scrolling line 50 | //-------------- Partial Display Control ---------// 51 | LCD_Write_COM_DATA(0x80, 0x0000); 52 | LCD_Write_COM_DATA(0x81, 0x0000); 53 | LCD_Write_COM_DATA(0x82, 0x0000); 54 | LCD_Write_COM_DATA(0x83, 0x0000); 55 | LCD_Write_COM_DATA(0x84, 0x0000); 56 | LCD_Write_COM_DATA(0x85, 0x0000); 57 | //-------------- Panel Control -------------------// 58 | LCD_Write_COM_DATA(0x90, 0x0010); 59 | LCD_Write_COM_DATA(0x92, 0x0600); 60 | LCD_Write_COM_DATA(0x07, 0x0133); // 262K color and display ON 61 | break; 62 | -------------------------------------------------------------------------------- /tft_drivers/ili9325c/setxy.h: -------------------------------------------------------------------------------- 1 | case ILI9325C: 2 | LCD_Write_COM_DATA(0x20,x1); 3 | LCD_Write_COM_DATA(0x21,y1); 4 | LCD_Write_COM_DATA(0x50,x1); 5 | LCD_Write_COM_DATA(0x52,y1); 6 | LCD_Write_COM_DATA(0x51,x2); 7 | LCD_Write_COM_DATA(0x53,y2); 8 | LCD_Write_COM(0x22); 9 | break; 10 | -------------------------------------------------------------------------------- /tft_drivers/ili9325d/alt/initlcd.h: -------------------------------------------------------------------------------- 1 | case ILI9325D_16ALT: 2 | LCD_Write_COM_DATA(0xE5, 0x78F0); // set SRAM internal timing 3 | LCD_Write_COM_DATA(0x01, 0x0100); // set Driver Output Control 4 | LCD_Write_COM_DATA(0x02, 0x0700); // set 1 line inversion 5 | LCD_Write_COM_DATA(0x03, 0x1030); // set GRAM write direction and BGR=1. 6 | LCD_Write_COM_DATA(0x04, 0x0000); // Resize register 7 | LCD_Write_COM_DATA(0x08, 0x0207); // set the back porch and front porch 8 | LCD_Write_COM_DATA(0x09, 0x0000); // set non-display area refresh cycle ISC[3:0] 9 | LCD_Write_COM_DATA(0x0A, 0x0000); // FMARK function 10 | LCD_Write_COM_DATA(0x0C, 0x0000); // RGB interface setting 11 | LCD_Write_COM_DATA(0x0D, 0x0000); // Frame marker Position 12 | LCD_Write_COM_DATA(0x0F, 0x0000); // RGB interface polarity 13 | //*************Power On sequence ****************// 14 | LCD_Write_COM_DATA(0x10, 0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB 15 | LCD_Write_COM_DATA(0x11, 0x0007); // DC1[2:0], DC0[2:0], VC[2:0] 16 | LCD_Write_COM_DATA(0x12, 0x0000); // VREG1OUT voltage 17 | LCD_Write_COM_DATA(0x13, 0x0000); // VDV[4:0] for VCOM amplitude 18 | LCD_Write_COM_DATA(0x07, 0x0001); 19 | delay(200); // Dis-charge capacitor power voltage 20 | LCD_Write_COM_DATA(0x10, 0x1590); // SAP, BT[3:0], AP, DSTB, SLP, STB 21 | LCD_Write_COM_DATA(0x11, 0x0227); // Set DC1[2:0], DC0[2:0], VC[2:0] 22 | delay(50); // Delay 50ms 23 | LCD_Write_COM_DATA(0x12, 0x009C); // 0012 24 | delay(50); // Delay 50ms 25 | LCD_Write_COM_DATA(0x13, 0x1900); // VDV[4:0] for VCOM amplitude 26 | LCD_Write_COM_DATA(0x29, 0x0023); // 04 VCM[5:0] for VCOMH 27 | LCD_Write_COM_DATA(0x2B, 0x000E); // Set Frame Rate 28 | delay(50); // Delay 50ms 29 | LCD_Write_COM_DATA(0x20, 0x0000); // GRAM horizontal Address 30 | LCD_Write_COM_DATA(0x21, 0x0000); // GRAM Vertical Address 31 | // ----------- Adjust the Gamma Curve ----------// 32 | LCD_Write_COM_DATA(0x30, 0x0000); 33 | LCD_Write_COM_DATA(0x31, 0x0404); 34 | LCD_Write_COM_DATA(0x32, 0x0003); 35 | LCD_Write_COM_DATA(0x35, 0x0405); 36 | LCD_Write_COM_DATA(0x36, 0x0808); 37 | LCD_Write_COM_DATA(0x37, 0x0407); 38 | LCD_Write_COM_DATA(0x38, 0x0303); 39 | LCD_Write_COM_DATA(0x39, 0x0707); 40 | LCD_Write_COM_DATA(0x3C, 0x0504); 41 | LCD_Write_COM_DATA(0x3D, 0x0808); 42 | //------------------ Set GRAM area ---------------// 43 | LCD_Write_COM_DATA(0x50, 0x0000); // Horizontal GRAM Start Address 44 | LCD_Write_COM_DATA(0x51, 0x00EF); // Horizontal GRAM End Address 45 | LCD_Write_COM_DATA(0x52, 0x0000); // Vertical GRAM Start Address 46 | LCD_Write_COM_DATA(0x53, 0x013F); // Vertical GRAM Start Address 47 | LCD_Write_COM_DATA(0x60, 0xA700); // Gate Scan Line 48 | LCD_Write_COM_DATA(0x61, 0x0001); // NDL,VLE, REV 49 | LCD_Write_COM_DATA(0x6A, 0x0000); // set scrolling line 50 | //-------------- Partial Display Control ---------// 51 | LCD_Write_COM_DATA(0x80, 0x0000); 52 | LCD_Write_COM_DATA(0x81, 0x0000); 53 | LCD_Write_COM_DATA(0x82, 0x0000); 54 | LCD_Write_COM_DATA(0x83, 0x0000); 55 | LCD_Write_COM_DATA(0x84, 0x0000); 56 | LCD_Write_COM_DATA(0x85, 0x0000); 57 | //-------------- Panel Control -------------------// 58 | LCD_Write_COM_DATA(0x90, 0x0010); 59 | LCD_Write_COM_DATA(0x92, 0x0000); 60 | LCD_Write_COM_DATA(0x07, 0x0133); // 262K color and display ON 61 | break; 62 | -------------------------------------------------------------------------------- /tft_drivers/ili9325d/alt/setxy.h: -------------------------------------------------------------------------------- 1 | case ILI9325D_16ALT: 2 | LCD_Write_COM_DATA(0x20,x1); 3 | LCD_Write_COM_DATA(0x21,y1); 4 | LCD_Write_COM_DATA(0x50,x1); 5 | LCD_Write_COM_DATA(0x52,y1); 6 | LCD_Write_COM_DATA(0x51,x2); 7 | LCD_Write_COM_DATA(0x53,y2); 8 | LCD_Write_COM(0x22); 9 | break; 10 | -------------------------------------------------------------------------------- /tft_drivers/ili9325d/default/initlcd.h: -------------------------------------------------------------------------------- 1 | case ILI9325D_8: 2 | case ILI9325D_16: 3 | LCD_Write_COM_DATA(0xE5, 0x78F0); // set SRAM internal timing 4 | LCD_Write_COM_DATA(0x01, 0x0100); // set Driver Output Control 5 | LCD_Write_COM_DATA(0x02, 0x0200); // set 1 line inversion 6 | LCD_Write_COM_DATA(0x03, 0x1030); // set GRAM write direction and BGR=1. 7 | LCD_Write_COM_DATA(0x04, 0x0000); // Resize register 8 | LCD_Write_COM_DATA(0x08, 0x0207); // set the back porch and front porch 9 | LCD_Write_COM_DATA(0x09, 0x0000); // set non-display area refresh cycle ISC[3:0] 10 | LCD_Write_COM_DATA(0x0A, 0x0000); // FMARK function 11 | LCD_Write_COM_DATA(0x0C, 0x0000); // RGB interface setting 12 | LCD_Write_COM_DATA(0x0D, 0x0000); // Frame marker Position 13 | LCD_Write_COM_DATA(0x0F, 0x0000); // RGB interface polarity 14 | //*************Power On sequence ****************// 15 | LCD_Write_COM_DATA(0x10, 0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB 16 | LCD_Write_COM_DATA(0x11, 0x0007); // DC1[2:0], DC0[2:0], VC[2:0] 17 | LCD_Write_COM_DATA(0x12, 0x0000); // VREG1OUT voltage 18 | LCD_Write_COM_DATA(0x13, 0x0000); // VDV[4:0] for VCOM amplitude 19 | LCD_Write_COM_DATA(0x07, 0x0001); 20 | delay(200); // Dis-charge capacitor power voltage 21 | LCD_Write_COM_DATA(0x10, 0x1690); // SAP, BT[3:0], AP, DSTB, SLP, STB 22 | LCD_Write_COM_DATA(0x11, 0x0227); // Set DC1[2:0], DC0[2:0], VC[2:0] 23 | delay(50); // Delay 50ms 24 | LCD_Write_COM_DATA(0x12, 0x000D); // 0012 25 | delay(50); // Delay 50ms 26 | LCD_Write_COM_DATA(0x13, 0x1200); // VDV[4:0] for VCOM amplitude 27 | LCD_Write_COM_DATA(0x29, 0x000A); // 04 VCM[5:0] for VCOMH 28 | LCD_Write_COM_DATA(0x2B, 0x000D); // Set Frame Rate 29 | delay(50); // Delay 50ms 30 | LCD_Write_COM_DATA(0x20, 0x0000); // GRAM horizontal Address 31 | LCD_Write_COM_DATA(0x21, 0x0000); // GRAM Vertical Address 32 | // ----------- Adjust the Gamma Curve ----------// 33 | LCD_Write_COM_DATA(0x30, 0x0000); 34 | LCD_Write_COM_DATA(0x31, 0x0404); 35 | LCD_Write_COM_DATA(0x32, 0x0003); 36 | LCD_Write_COM_DATA(0x35, 0x0405); 37 | LCD_Write_COM_DATA(0x36, 0x0808); 38 | LCD_Write_COM_DATA(0x37, 0x0407); 39 | LCD_Write_COM_DATA(0x38, 0x0303); 40 | LCD_Write_COM_DATA(0x39, 0x0707); 41 | LCD_Write_COM_DATA(0x3C, 0x0504); 42 | LCD_Write_COM_DATA(0x3D, 0x0808); 43 | //------------------ Set GRAM area ---------------// 44 | LCD_Write_COM_DATA(0x50, 0x0000); // Horizontal GRAM Start Address 45 | LCD_Write_COM_DATA(0x51, 0x00EF); // Horizontal GRAM End Address 46 | LCD_Write_COM_DATA(0x52, 0x0000); // Vertical GRAM Start Address 47 | LCD_Write_COM_DATA(0x53, 0x013F); // Vertical GRAM Start Address 48 | LCD_Write_COM_DATA(0x60, 0xA700); // Gate Scan Line 49 | LCD_Write_COM_DATA(0x61, 0x0001); // NDL,VLE, REV 50 | LCD_Write_COM_DATA(0x6A, 0x0000); // set scrolling line 51 | //-------------- Partial Display Control ---------// 52 | LCD_Write_COM_DATA(0x80, 0x0000); 53 | LCD_Write_COM_DATA(0x81, 0x0000); 54 | LCD_Write_COM_DATA(0x82, 0x0000); 55 | LCD_Write_COM_DATA(0x83, 0x0000); 56 | LCD_Write_COM_DATA(0x84, 0x0000); 57 | LCD_Write_COM_DATA(0x85, 0x0000); 58 | //-------------- Panel Control -------------------// 59 | LCD_Write_COM_DATA(0x90, 0x0010); 60 | LCD_Write_COM_DATA(0x92, 0x0000); 61 | LCD_Write_COM_DATA(0x07, 0x0133); // 262K color and display ON 62 | break; 63 | -------------------------------------------------------------------------------- /tft_drivers/ili9325d/default/setxy.h: -------------------------------------------------------------------------------- 1 | case ILI9325D_8: 2 | case ILI9325D_16: 3 | LCD_Write_COM_DATA(0x20,x1); 4 | LCD_Write_COM_DATA(0x21,y1); 5 | LCD_Write_COM_DATA(0x50,x1); 6 | LCD_Write_COM_DATA(0x52,y1); 7 | LCD_Write_COM_DATA(0x51,x2); 8 | LCD_Write_COM_DATA(0x53,y2); 9 | LCD_Write_COM(0x22); 10 | break; 11 | -------------------------------------------------------------------------------- /tft_drivers/ili9327/initlcd.h: -------------------------------------------------------------------------------- 1 | case ILI9327: 2 | LCD_Write_COM(0xE9); 3 | LCD_Write_DATA(0x00, 0x20); 4 | LCD_Write_COM(0x11); //Exit Sleep 5 | delay(100); 6 | LCD_Write_COM(0xD1);//VCOM Control 7 | LCD_Write_DATA(0x00, 0x00); 8 | LCD_Write_DATA(0x00, 0x71); 9 | LCD_Write_DATA(0x00, 0x19); 10 | 11 | LCD_Write_COM(0xD0);//Power_Setting 12 | LCD_Write_DATA(0x00, 0x07); 13 | LCD_Write_DATA(0x00, 0x01); 14 | LCD_Write_DATA(0x00, 0x08); 15 | 16 | LCD_Write_COM(0x36);//set_address_mode 17 | LCD_Write_DATA(0x00, 0x48);//Page Address Order:Top to Bottom,Column Address Order:Right to Left,Page/Column Order:Normal Mode,Line Address Order:LCD Refresh Top to Bottom 18 | //RGB/BGR Order:Pixels sent in BGR order, Display Data Latch Data Order:Not supported, Horizontal Flip:Normal display, Vertical Flip: Normal display 19 | 20 | LCD_Write_COM(0x3A);//set_pixel_format 21 | LCD_Write_DATA(0x00, 0x05);//DBI:16bit/pixel (65,536 colors) 22 | 23 | LCD_Write_COM(0xC1);//Display_Timing_Setting for Normal/Partial Mode 24 | LCD_Write_DATA(0x00, 0x10); 25 | LCD_Write_DATA(0x00, 0x10); 26 | LCD_Write_DATA(0x00, 0x02); 27 | LCD_Write_DATA(0x00, 0x02); 28 | 29 | LCD_Write_COM(0xC0); //Panel Driving Setting / Set Default Gamma 30 | LCD_Write_DATA(0x00, 0x00); 31 | LCD_Write_DATA(0x00, 0x35); 32 | LCD_Write_DATA(0x00, 0x00); 33 | LCD_Write_DATA(0x00, 0x00); 34 | LCD_Write_DATA(0x00, 0x01); 35 | LCD_Write_DATA(0x00, 0x02); 36 | 37 | LCD_Write_COM(0xC5); //Frame Rate Control / Set frame rate 38 | LCD_Write_DATA(0x00, 0x04);//72Hz 39 | 40 | LCD_Write_COM(0xD2); //Power_Setting for Normal Mode / power setting 41 | LCD_Write_DATA(0x00, 0x01);//Gamma Driver Amplifier:1.00, Source Driver Amplifier: 1.00 42 | LCD_Write_DATA(0x00, 0x44); 43 | 44 | LCD_Write_COM(0xC8); //Gamma Setting / Set Gamma 45 | LCD_Write_DATA(0x00, 0x04); 46 | LCD_Write_DATA(0x00, 0x67); 47 | LCD_Write_DATA(0x00, 0x35); 48 | LCD_Write_DATA(0x00, 0x04); 49 | LCD_Write_DATA(0x00, 0x08); 50 | LCD_Write_DATA(0x00, 0x06); 51 | LCD_Write_DATA(0x00, 0x24); 52 | LCD_Write_DATA(0x00, 0x01); 53 | LCD_Write_DATA(0x00, 0x37); 54 | LCD_Write_DATA(0x00, 0x40); 55 | LCD_Write_DATA(0x00, 0x03); 56 | LCD_Write_DATA(0x00, 0x10); 57 | LCD_Write_DATA(0x00, 0x08); 58 | LCD_Write_DATA(0x00, 0x80); 59 | LCD_Write_DATA(0x00, 0x00); 60 | 61 | LCD_Write_COM(0x2A); //set_column_address 62 | LCD_Write_DATA(0x00, 0x00); 63 | LCD_Write_DATA(0x00, 0x00); 64 | LCD_Write_DATA(0x00, 0x00); 65 | LCD_Write_DATA(0x00, 0xeF); 66 | 67 | LCD_Write_COM(0x2B); //set_page_address 68 | LCD_Write_DATA(0x00, 0x00); 69 | LCD_Write_DATA(0x00, 0x00); 70 | LCD_Write_DATA(0x00, 0x01); 71 | LCD_Write_DATA(0x00, 0x8F); 72 | 73 | LCD_Write_COM(0x29); //set_display_on / display on 74 | 75 | LCD_Write_COM(0x2C); //write_memory_start / display on 76 | break; 77 | -------------------------------------------------------------------------------- /tft_drivers/ili9327/setxy.h: -------------------------------------------------------------------------------- 1 | case ILI9327: 2 | LCD_Write_COM(0x2a);//Set_column_address 3 | LCD_Write_DATA(0x00, x1>>8); 4 | LCD_Write_DATA(0x00, x1); 5 | LCD_Write_DATA(0x00, x2>>8); 6 | LCD_Write_DATA(0x00, x2); 7 | LCD_Write_COM(0x2b);//Set_page_address 8 | LCD_Write_DATA(0x00, y1>>8); 9 | LCD_Write_DATA(0x00, y1); 10 | LCD_Write_DATA(0x00, y2>>8); 11 | LCD_Write_DATA(0x00, y2); 12 | LCD_Write_COM(0x2c); //Write_memory_start 13 | break; 14 | -------------------------------------------------------------------------------- /tft_drivers/ili9327_8/initlcd.h: -------------------------------------------------------------------------------- 1 | case ILI9327_8: 2 | LCD_Write_COM(0xE9); 3 | LCD_Write_DATA(0x20); 4 | LCD_Write_COM(0x11); //Exit Sleep 5 | delay(100); 6 | LCD_Write_COM(0xD1);//VCOM Control 7 | LCD_Write_DATA(0x00); 8 | LCD_Write_DATA(0x71); 9 | LCD_Write_DATA(0x19); 10 | 11 | LCD_Write_COM(0xD0);//Power_Setting 12 | LCD_Write_DATA(0x07); 13 | LCD_Write_DATA(0x01); 14 | LCD_Write_DATA(0x08); 15 | 16 | LCD_Write_COM(0x36);//set_address_mode 17 | LCD_Write_DATA(0x48);//Page Address Order:Top to Bottom,Column Address Order:Right to Left,Page/Column Order:Normal Mode,Line Address Order:LCD Refresh Top to Bottom 18 | //RGB/BGR Order:Pixels sent in BGR order, Display Data Latch Data Order:Not supported, Horizontal Flip:Normal display, Vertical Flip: Normal display 19 | 20 | 21 | LCD_Write_COM(0x3A);//set_pixel_format 22 | LCD_Write_DATA(0x05);//DBI:16bit/pixel (65,536 colors) 23 | 24 | LCD_Write_COM(0xC1);//Display_Timing_Setting for Normal/Partial Mode 25 | LCD_Write_DATA(0x10); 26 | LCD_Write_DATA(0x10); 27 | LCD_Write_DATA(0x02); 28 | LCD_Write_DATA(0x02); 29 | 30 | LCD_Write_COM(0xC0); //Panel Driving Setting / Set Default Gamma 31 | LCD_Write_DATA(0x00); 32 | LCD_Write_DATA(0x35); 33 | LCD_Write_DATA(0x00); 34 | LCD_Write_DATA(0x00); 35 | LCD_Write_DATA(0x01); 36 | LCD_Write_DATA(0x02); 37 | 38 | LCD_Write_COM(0xC5); //Frame Rate Control / Set frame rate 39 | LCD_Write_DATA(0x04);//72Hz 40 | 41 | LCD_Write_COM(0xD2); //Power_Setting for Normal Mode / power setting 42 | LCD_Write_DATA(0x01);//Gamma Driver Amplifier:1.00, Source Driver Amplifier: 1.00 43 | #ifdef MCUFRIEND_35_TFTLCD_FOR_ARDUINO_2560_INIT_LCD2 44 | LCD_Write_COM(0x44);//to chyba drugi parametr do 0xD2 - powinno być LCD_write_DATA a nie set_tear_scanline 45 | #else 46 | LCD_Write_DATA(0x44); 47 | #endif 48 | LCD_Write_COM(0xC8); //Gamma Setting / Set Gamma 49 | LCD_Write_DATA(0x04); 50 | LCD_Write_DATA(0x67); 51 | LCD_Write_DATA(0x35); 52 | LCD_Write_DATA(0x04); 53 | LCD_Write_DATA(0x08); 54 | LCD_Write_DATA(0x06); 55 | LCD_Write_DATA(0x24); 56 | LCD_Write_DATA(0x01); 57 | LCD_Write_DATA(0x37); 58 | LCD_Write_DATA(0x40); 59 | LCD_Write_DATA(0x03); 60 | LCD_Write_DATA(0x10); 61 | LCD_Write_DATA(0x08); 62 | LCD_Write_DATA(0x80); 63 | LCD_Write_DATA(0x00); 64 | 65 | LCD_Write_COM(0x2A); //set_column_address 66 | LCD_Write_DATA(0x00); 67 | LCD_Write_DATA(0x00); 68 | LCD_Write_DATA(0x00); 69 | LCD_Write_DATA(0xeF); 70 | 71 | LCD_Write_COM(0x2B); //set_page_address 72 | LCD_Write_DATA(0x00); 73 | LCD_Write_DATA(0x00); 74 | LCD_Write_DATA(0x01); 75 | #ifdef MCUFRIEND_35_TFTLCD_FOR_ARDUINO_2560_INIT_LCD2 76 | LCD_Write_DATA(0x3F);// czasem tu jest 0x8F 77 | #else 78 | LCD_Write_DATA(0x8F); 79 | #endif 80 | LCD_Write_COM(0x29); //set_display_on / display on 81 | LCD_Write_COM(0x2C); //write_memory_start / display on 82 | break; 83 | -------------------------------------------------------------------------------- /tft_drivers/ili9327_8/setxy.h: -------------------------------------------------------------------------------- 1 | case ILI9327_8: 2 | LCD_Write_COM(0x2a);//Set_column_address 3 | LCD_Write_DATA(x1>>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2b);//Set_page_address 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2c); //Write_memory_start 13 | break; 14 | -------------------------------------------------------------------------------- /tft_drivers/ili9341/s4p/initlcd.h: -------------------------------------------------------------------------------- 1 | case ILI9341_S4P: 2 | LCD_Write_COM(0x11);//sleep out 3 | delay(20); 4 | //LCD_Write_COM(0x01); //reset 5 | //delay(15); 6 | LCD_Write_COM(0x28); //display off 7 | delay(5); 8 | LCD_Write_COM(0xCF); //power control b 9 | LCD_Write_DATA(0x00); 10 | LCD_Write_DATA(0x83); //83 81 AA 11 | LCD_Write_DATA(0x30); 12 | LCD_Write_COM(0xED); //power on seq control 13 | LCD_Write_DATA(0x64); //64 67 14 | LCD_Write_DATA(0x03); 15 | LCD_Write_DATA(0x12); 16 | LCD_Write_DATA(0x81); 17 | LCD_Write_COM(0xE8); //timing control a 18 | LCD_Write_DATA(0x85); 19 | LCD_Write_DATA(0x01); 20 | LCD_Write_DATA(0x79); //79 78 21 | LCD_Write_COM(0xCB); //power control a 22 | LCD_Write_DATA(0x39); 23 | LCD_Write_DATA(0X2C); 24 | LCD_Write_DATA(0x00); 25 | LCD_Write_DATA(0x34); 26 | LCD_Write_DATA(0x02); 27 | LCD_Write_COM(0xF7); //pump ratio control 28 | LCD_Write_DATA(0x20); 29 | LCD_Write_COM(0xEA); //timing control b 30 | LCD_Write_DATA(0x00); 31 | LCD_Write_DATA(0x00); 32 | LCD_Write_COM(0xC0); //power control 2 33 | LCD_Write_DATA(0x26); //26 25 34 | LCD_Write_COM(0xC1); //power control 2 35 | LCD_Write_DATA(0x11); 36 | LCD_Write_COM(0xC5); //vcom control 1 37 | LCD_Write_DATA(0x35); 38 | LCD_Write_DATA(0x3E); 39 | LCD_Write_COM(0xC7); //vcom control 2 40 | LCD_Write_DATA(0xBE); //BE 94 41 | LCD_Write_COM(0xB1); //frame control 42 | LCD_Write_DATA(0x00); 43 | LCD_Write_DATA(0x1B); //1B 70 44 | LCD_Write_COM(0xB6); //display control 45 | LCD_Write_DATA(0x0A); 46 | LCD_Write_DATA(0x82); 47 | LCD_Write_DATA(0x27); 48 | LCD_Write_DATA(0x00); 49 | LCD_Write_COM(0xB7); //emtry mode 50 | LCD_Write_DATA(0x07); 51 | LCD_Write_COM(0x3A); //pixel format 52 | LCD_Write_DATA(0x55); //16bit 53 | LCD_Write_COM(0x36); //mem access 54 | LCD_Write_DATA((1<<3)|(1<<6)); 55 | //LCD_Write_DATA((1<<3)|(1<<7)); //rotate 180 56 | LCD_Write_COM(0x29); //display on 57 | delay(5); 58 | break; 59 | -------------------------------------------------------------------------------- /tft_drivers/ili9341/s4p/setxy.h: -------------------------------------------------------------------------------- 1 | case ILI9341_S4P: 2 | LCD_Write_COM(0x2A); //column 3 | LCD_Write_DATA(x1>>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2B); //page 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2C); //write 13 | break; 14 | -------------------------------------------------------------------------------- /tft_drivers/ili9341/s5p/initlcd.h: -------------------------------------------------------------------------------- 1 | case ILI9341_S5P: 2 | LCD_Write_COM(0xCB); 3 | LCD_Write_DATA(0x39); 4 | LCD_Write_DATA(0x2C); 5 | LCD_Write_DATA(0x00); 6 | LCD_Write_DATA(0x34); 7 | LCD_Write_DATA(0x02); 8 | 9 | LCD_Write_COM(0xCF); 10 | LCD_Write_DATA(0x00); 11 | LCD_Write_DATA(0XC1); 12 | LCD_Write_DATA(0X30); 13 | 14 | LCD_Write_COM(0xE8); 15 | LCD_Write_DATA(0x85); 16 | LCD_Write_DATA(0x00); 17 | LCD_Write_DATA(0x78); 18 | 19 | LCD_Write_COM(0xEA); 20 | LCD_Write_DATA(0x00); 21 | LCD_Write_DATA(0x00); 22 | 23 | LCD_Write_COM(0xED); 24 | LCD_Write_DATA(0x64); 25 | LCD_Write_DATA(0x03); 26 | LCD_Write_DATA(0X12); 27 | LCD_Write_DATA(0X81); 28 | 29 | LCD_Write_COM(0xF7); 30 | LCD_Write_DATA(0x20); 31 | 32 | LCD_Write_COM(0xC0); //Power control 33 | LCD_Write_DATA(0x23); //VRH[5:0] 34 | 35 | LCD_Write_COM(0xC1); //Power control 36 | LCD_Write_DATA(0x10); //SAP[2:0];BT[3:0] 37 | 38 | LCD_Write_COM(0xC5); //VCM control 39 | LCD_Write_DATA(0x3e); //Contrast 40 | LCD_Write_DATA(0x28); 41 | 42 | LCD_Write_COM(0xC7); //VCM control2 43 | LCD_Write_DATA(0x86); //-- 44 | 45 | LCD_Write_COM(0x36); // Memory Access Control 46 | LCD_Write_DATA(0x48); 47 | 48 | LCD_Write_COM(0x3A); 49 | LCD_Write_DATA(0x55); 50 | 51 | LCD_Write_COM(0xB1); 52 | LCD_Write_DATA(0x00); 53 | LCD_Write_DATA(0x18); 54 | 55 | LCD_Write_COM(0xB6); // Display Function Control 56 | LCD_Write_DATA(0x08); 57 | LCD_Write_DATA(0x82); 58 | LCD_Write_DATA(0x27); 59 | /* 60 | LCD_Write_COM(0xF2); // 3Gamma Function Disable 61 | LCD_Write_DATA(0x00); 62 | 63 | LCD_Write_COM(0x26); //Gamma curve selected 64 | LCD_Write_DATA(0x01); 65 | 66 | LCD_Write_COM(0xE0); //Set Gamma 67 | LCD_Write_DATA(0x0F); 68 | LCD_Write_DATA(0x31); 69 | LCD_Write_DATA(0x2B); 70 | LCD_Write_DATA(0x0C); 71 | LCD_Write_DATA(0x0E); 72 | LCD_Write_DATA(0x08); 73 | LCD_Write_DATA(0x4E); 74 | LCD_Write_DATA(0xF1); 75 | LCD_Write_DATA(0x37); 76 | LCD_Write_DATA(0x07); 77 | LCD_Write_DATA(0x10); 78 | LCD_Write_DATA(0x03); 79 | LCD_Write_DATA(0x0E); 80 | LCD_Write_DATA(0x09); 81 | LCD_Write_DATA(0x00); 82 | 83 | LCD_Write_COM(0XE1); //Set Gamma 84 | LCD_Write_DATA(0x00); 85 | LCD_Write_DATA(0x0E); 86 | LCD_Write_DATA(0x14); 87 | LCD_Write_DATA(0x03); 88 | LCD_Write_DATA(0x11); 89 | LCD_Write_DATA(0x07); 90 | LCD_Write_DATA(0x31); 91 | LCD_Write_DATA(0xC1); 92 | LCD_Write_DATA(0x48); 93 | LCD_Write_DATA(0x08); 94 | LCD_Write_DATA(0x0F); 95 | LCD_Write_DATA(0x0C); 96 | LCD_Write_DATA(0x31); 97 | LCD_Write_DATA(0x36); 98 | LCD_Write_DATA(0x0F); 99 | */ 100 | LCD_Write_COM(0x11); //Exit Sleep 101 | delay(120); 102 | 103 | LCD_Write_COM(0x29); //Display on 104 | LCD_Write_COM(0x2c); 105 | break; 106 | -------------------------------------------------------------------------------- /tft_drivers/ili9341/s5p/setxy.h: -------------------------------------------------------------------------------- 1 | case ILI9341_S5P: 2 | LCD_Write_COM(0x2a); 3 | LCD_Write_DATA(x1>>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2b); 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2c); 13 | break; 14 | -------------------------------------------------------------------------------- /tft_drivers/ili9481/initlcd.h: -------------------------------------------------------------------------------- 1 | case ILI9481: 2 | LCD_Write_COM(0x11); 3 | delay(20); 4 | LCD_Write_COM(0xD0); 5 | LCD_Write_DATA(0x07); 6 | LCD_Write_DATA(0x42); 7 | LCD_Write_DATA(0x18); 8 | 9 | LCD_Write_COM(0xD1); 10 | LCD_Write_DATA(0x00); 11 | LCD_Write_DATA(0x07); 12 | LCD_Write_DATA(0x10); 13 | 14 | LCD_Write_COM(0xD2); 15 | LCD_Write_DATA(0x01); 16 | LCD_Write_DATA(0x02); 17 | 18 | LCD_Write_COM(0xC0); 19 | LCD_Write_DATA(0x10); 20 | LCD_Write_DATA(0x3B); 21 | LCD_Write_DATA(0x00); 22 | LCD_Write_DATA(0x02); 23 | LCD_Write_DATA(0x11); 24 | 25 | LCD_Write_COM(0xC5); 26 | LCD_Write_DATA(0x03); 27 | 28 | LCD_Write_COM(0xC8); 29 | LCD_Write_DATA(0x00); 30 | LCD_Write_DATA(0x32); 31 | LCD_Write_DATA(0x36); 32 | LCD_Write_DATA(0x45); 33 | LCD_Write_DATA(0x06); 34 | LCD_Write_DATA(0x16); 35 | LCD_Write_DATA(0x37); 36 | LCD_Write_DATA(0x75); 37 | LCD_Write_DATA(0x77); 38 | LCD_Write_DATA(0x54); 39 | LCD_Write_DATA(0x0C); 40 | LCD_Write_DATA(0x00); 41 | 42 | LCD_Write_COM(0x36); 43 | LCD_Write_DATA(0x0A); 44 | 45 | 46 | LCD_Write_COM(0x3A); 47 | LCD_Write_DATA(0x55); 48 | 49 | LCD_Write_COM(0x2A); 50 | LCD_Write_DATA(0x00); 51 | LCD_Write_DATA(0x00); 52 | LCD_Write_DATA(0x01); 53 | LCD_Write_DATA(0x3F); 54 | 55 | LCD_Write_COM(0x2B); 56 | LCD_Write_DATA(0x00); 57 | LCD_Write_DATA(0x00); 58 | LCD_Write_DATA(0x01); 59 | LCD_Write_DATA(0xE0); 60 | delay(120); 61 | LCD_Write_COM(0x29); 62 | break; 63 | -------------------------------------------------------------------------------- /tft_drivers/ili9481/setxy.h: -------------------------------------------------------------------------------- 1 | case ILI9481: 2 | LCD_Write_COM(0x2a); 3 | LCD_Write_DATA(x1>>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2b); 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2c); 13 | break; 14 | -------------------------------------------------------------------------------- /tft_drivers/ili9486/initlcd.h: -------------------------------------------------------------------------------- 1 | case ILI9486: 2 | LCD_Write_COM(0x11); // Sleep OUT 3 | delay(50); 4 | 5 | LCD_Write_COM(0xF2); // ????? 6 | LCD_Write_DATA(0x1C); 7 | LCD_Write_DATA(0xA3); 8 | LCD_Write_DATA(0x32); 9 | LCD_Write_DATA(0x02); 10 | LCD_Write_DATA(0xb2); 11 | LCD_Write_DATA(0x12); 12 | LCD_Write_DATA(0xFF); 13 | LCD_Write_DATA(0x12); 14 | LCD_Write_DATA(0x00); 15 | 16 | LCD_Write_COM(0xF1); // ????? 17 | LCD_Write_DATA(0x36); 18 | LCD_Write_DATA(0xA4); 19 | 20 | LCD_Write_COM(0xF8); // ????? 21 | LCD_Write_DATA(0x21); 22 | LCD_Write_DATA(0x04); 23 | 24 | LCD_Write_COM(0xF9); // ????? 25 | LCD_Write_DATA(0x00); 26 | LCD_Write_DATA(0x08); 27 | 28 | LCD_Write_COM(0xC0); // Power Control 1 29 | LCD_Write_DATA(0x0d); 30 | LCD_Write_DATA(0x0d); 31 | 32 | LCD_Write_COM(0xC1); // Power Control 2 33 | LCD_Write_DATA(0x43); 34 | LCD_Write_DATA(0x00); 35 | 36 | LCD_Write_COM(0xC2); // Power Control 3 37 | LCD_Write_DATA(0x00); 38 | 39 | LCD_Write_COM(0xC5); // VCOM Control 40 | LCD_Write_DATA(0x00); 41 | LCD_Write_DATA(0x48); 42 | 43 | LCD_Write_COM(0xB6); // Display Function Control 44 | LCD_Write_DATA(0x00); 45 | LCD_Write_DATA(0x22); // 0x42 = Rotate display 180 deg. 46 | LCD_Write_DATA(0x3B); 47 | 48 | LCD_Write_COM(0xE0); // PGAMCTRL (Positive Gamma Control) 49 | LCD_Write_DATA(0x0f); 50 | LCD_Write_DATA(0x24); 51 | LCD_Write_DATA(0x1c); 52 | LCD_Write_DATA(0x0a); 53 | LCD_Write_DATA(0x0f); 54 | LCD_Write_DATA(0x08); 55 | LCD_Write_DATA(0x43); 56 | LCD_Write_DATA(0x88); 57 | LCD_Write_DATA(0x32); 58 | LCD_Write_DATA(0x0f); 59 | LCD_Write_DATA(0x10); 60 | LCD_Write_DATA(0x06); 61 | LCD_Write_DATA(0x0f); 62 | LCD_Write_DATA(0x07); 63 | LCD_Write_DATA(0x00); 64 | 65 | LCD_Write_COM(0xE1); // NGAMCTRL (Negative Gamma Control) 66 | LCD_Write_DATA(0x0F); 67 | LCD_Write_DATA(0x38); 68 | LCD_Write_DATA(0x30); 69 | LCD_Write_DATA(0x09); 70 | LCD_Write_DATA(0x0f); 71 | LCD_Write_DATA(0x0f); 72 | LCD_Write_DATA(0x4e); 73 | LCD_Write_DATA(0x77); 74 | LCD_Write_DATA(0x3c); 75 | LCD_Write_DATA(0x07); 76 | LCD_Write_DATA(0x10); 77 | LCD_Write_DATA(0x05); 78 | LCD_Write_DATA(0x23); 79 | LCD_Write_DATA(0x1b); 80 | LCD_Write_DATA(0x00); 81 | 82 | LCD_Write_COM(0x20); // Display Inversion OFF 83 | LCD_Write_DATA(0x00);//C8 84 | 85 | LCD_Write_COM(0x36); // Memory Access Control 86 | LCD_Write_DATA(0x0A); 87 | 88 | LCD_Write_COM(0x3A); // Interface Pixel Format 89 | LCD_Write_DATA(0x55); 90 | 91 | LCD_Write_COM(0x2A); // Column Addess Set 92 | LCD_Write_DATA(0x00); 93 | LCD_Write_DATA(0x00); 94 | LCD_Write_DATA(0x01); 95 | LCD_Write_DATA(0xDF); 96 | 97 | LCD_Write_COM(0x002B); // Page Address Set 98 | LCD_Write_DATA(0x00); 99 | LCD_Write_DATA(0x00); 100 | LCD_Write_DATA(0x01); 101 | LCD_Write_DATA(0x3f); 102 | delay(50); 103 | LCD_Write_COM(0x0029); // Display ON 104 | LCD_Write_COM(0x002C); // Memory Write 105 | break; 106 | -------------------------------------------------------------------------------- /tft_drivers/ili9486/setxy.h: -------------------------------------------------------------------------------- 1 | case ILI9486: 2 | LCD_Write_COM(0x2a); 3 | LCD_Write_DATA(x1>>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2b); 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2c); 13 | break; 14 | -------------------------------------------------------------------------------- /tft_drivers/pcf8833/initlcd.h: -------------------------------------------------------------------------------- 1 | case PCF8833: 2 | LCD_Write_COM(0x01); 3 | LCD_Write_COM(0x25); 4 | LCD_Write_DATA(0x40); 5 | LCD_Write_COM(0x11); 6 | delay(10); 7 | LCD_Write_COM(0x20); 8 | LCD_Write_COM(0x38); 9 | LCD_Write_COM(0x29); 10 | LCD_Write_COM(0x13); 11 | LCD_Write_COM(0x36); 12 | LCD_Write_DATA(0x60); 13 | LCD_Write_COM(0x3A); 14 | LCD_Write_DATA(0x05); 15 | LCD_Write_COM(0x2A); 16 | LCD_Write_DATA(0x00); 17 | LCD_Write_DATA(0x7F); 18 | LCD_Write_COM(0xB4); 19 | LCD_Write_DATA(0x03); 20 | LCD_Write_DATA(0x08); 21 | LCD_Write_DATA(0x0b); 22 | LCD_Write_DATA(0x0e); 23 | LCD_Write_COM(0xBA); 24 | LCD_Write_DATA(0x07); 25 | LCD_Write_DATA(0x0D); 26 | LCD_Write_COM(0x2B); 27 | LCD_Write_DATA(0x00); 28 | LCD_Write_DATA(0x7F); 29 | LCD_Write_COM(0x2C); 30 | break; 31 | -------------------------------------------------------------------------------- /tft_drivers/pcf8833/setxy.h: -------------------------------------------------------------------------------- 1 | case PCF8833: 2 | LCD_Write_COM(0x2a); 3 | LCD_Write_DATA(x1); 4 | LCD_Write_DATA(x2); 5 | LCD_Write_COM(0x2b); 6 | LCD_Write_DATA(y1); 7 | LCD_Write_DATA(y2); 8 | LCD_Write_COM(0x2c); 9 | break; 10 | -------------------------------------------------------------------------------- /tft_drivers/r61581/initlcd.h: -------------------------------------------------------------------------------- 1 | case R61581: 2 | LCD_Write_COM(0xB0); 3 | LCD_Write_DATA(0x1E); 4 | 5 | LCD_Write_COM(0xB0); 6 | LCD_Write_DATA(0x00); 7 | 8 | LCD_Write_COM(0xB3); 9 | LCD_Write_DATA(0x02); 10 | LCD_Write_DATA(0x00); 11 | LCD_Write_DATA(0x00); 12 | LCD_Write_DATA(0x10); 13 | 14 | LCD_Write_COM(0xB4); 15 | LCD_Write_DATA(0x00);//0X10 16 | 17 | // LCD_Write_COM(0xB9); //PWM Settings for Brightness Control 18 | // LCD_Write_DATA(0x01);// Disabled by default. 19 | // LCD_Write_DATA(0xFF); //0xFF = Max brightness 20 | // LCD_Write_DATA(0xFF); 21 | // LCD_Write_DATA(0x18); 22 | 23 | LCD_Write_COM(0xC0); 24 | LCD_Write_DATA(0x03); 25 | LCD_Write_DATA(0x3B);// 26 | LCD_Write_DATA(0x00); 27 | LCD_Write_DATA(0x00); 28 | LCD_Write_DATA(0x00); 29 | LCD_Write_DATA(0x01); 30 | LCD_Write_DATA(0x00);//NW 31 | LCD_Write_DATA(0x43); 32 | 33 | LCD_Write_COM(0xC1); 34 | LCD_Write_DATA(0x08); 35 | LCD_Write_DATA(0x15);//CLOCK 36 | LCD_Write_DATA(0x08); 37 | LCD_Write_DATA(0x08); 38 | 39 | LCD_Write_COM(0xC4); 40 | LCD_Write_DATA(0x15); 41 | LCD_Write_DATA(0x03); 42 | LCD_Write_DATA(0x03); 43 | LCD_Write_DATA(0x01); 44 | 45 | LCD_Write_COM(0xC6); 46 | LCD_Write_DATA(0x02); 47 | 48 | LCD_Write_COM(0xC8); 49 | LCD_Write_DATA(0x0c); 50 | LCD_Write_DATA(0x05); 51 | LCD_Write_DATA(0x0A);//0X12 52 | LCD_Write_DATA(0x6B);//0x7D 53 | LCD_Write_DATA(0x04); 54 | LCD_Write_DATA(0x06);//0x08 55 | LCD_Write_DATA(0x15);//0x0A 56 | LCD_Write_DATA(0x10); 57 | LCD_Write_DATA(0x00); 58 | LCD_Write_DATA(0x60);//0x23 59 | 60 | LCD_Write_COM(0x36); 61 | LCD_Write_DATA(0x0A); 62 | 63 | LCD_Write_COM(0x0C); 64 | LCD_Write_DATA(0x55); 65 | 66 | LCD_Write_COM(0x3A); 67 | LCD_Write_DATA(0x55); 68 | 69 | LCD_Write_COM(0x38); 70 | 71 | LCD_Write_COM(0xD0); 72 | LCD_Write_DATA(0x07); 73 | LCD_Write_DATA(0x07);//VCI1 74 | LCD_Write_DATA(0x14);//VRH 0x1D 75 | LCD_Write_DATA(0xA2);//BT 0x06 76 | 77 | LCD_Write_COM(0xD1); 78 | LCD_Write_DATA(0x03); 79 | LCD_Write_DATA(0x5A);//VCM 0x5A 80 | LCD_Write_DATA(0x10);//VDV 81 | 82 | LCD_Write_COM(0xD2); 83 | LCD_Write_DATA(0x03); 84 | LCD_Write_DATA(0x04);//0x24 85 | LCD_Write_DATA(0x04); 86 | 87 | LCD_Write_COM(0x11); 88 | delay(150); 89 | 90 | LCD_Write_COM(0x2A); 91 | LCD_Write_DATA(0x00); 92 | LCD_Write_DATA(0x00); 93 | LCD_Write_DATA(0x01); 94 | LCD_Write_DATA(0xDF);//320 95 | 96 | LCD_Write_COM(0x2B); 97 | LCD_Write_DATA(0x00); 98 | LCD_Write_DATA(0x00); 99 | LCD_Write_DATA(0x01); 100 | LCD_Write_DATA(0x3F);//480 101 | 102 | 103 | delay(100); 104 | 105 | LCD_Write_COM(0x29); 106 | delay(30); 107 | 108 | LCD_Write_COM(0x2C); 109 | delay(30); 110 | break; 111 | -------------------------------------------------------------------------------- /tft_drivers/r61581/setxy.h: -------------------------------------------------------------------------------- 1 | case R61581: 2 | LCD_Write_COM(0x2a); 3 | LCD_Write_DATA(x1>>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2b); 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2c); 13 | break; 14 | -------------------------------------------------------------------------------- /tft_drivers/s1d19122/initlcd.h: -------------------------------------------------------------------------------- 1 | case S1D19122: 2 | //************* Start Initial Sequence **********// 3 | 4 | int i,R,G,B; 5 | LCD_Write_COM(0x11); 6 | LCD_Write_COM(0x13); 7 | LCD_Write_COM(0x29); 8 | 9 | //-------------- Display Control ---------// 10 | LCD_Write_COM(0xB0); 11 | 12 | LCD_Write_DATA(0x05); 13 | LCD_Write_DATA(0x00); 14 | LCD_Write_DATA(0xF0); 15 | LCD_Write_DATA(0x0A); 16 | LCD_Write_DATA(0x41); 17 | LCD_Write_DATA(0x02); 18 | LCD_Write_DATA(0x0A); 19 | LCD_Write_DATA(0x30); 20 | LCD_Write_DATA(0x31); 21 | LCD_Write_DATA(0x36); 22 | LCD_Write_DATA(0x37); 23 | LCD_Write_DATA(0x40); 24 | LCD_Write_DATA(0x02); 25 | LCD_Write_DATA(0x3F); 26 | LCD_Write_DATA(0x40); 27 | LCD_Write_DATA(0x02); 28 | LCD_Write_DATA(0x81); 29 | LCD_Write_DATA(0x04); 30 | LCD_Write_DATA(0x05); 31 | LCD_Write_DATA(0x64); 32 | 33 | // ----------- Gamma Curve Set3 Postive----------// 34 | LCD_Write_COM(0xFC); 35 | 36 | LCD_Write_DATA(0x88); 37 | LCD_Write_DATA(0x00); 38 | LCD_Write_DATA(0x10); 39 | LCD_Write_DATA(0x01); 40 | LCD_Write_DATA(0x01); 41 | LCD_Write_DATA(0x10); 42 | LCD_Write_DATA(0x42); 43 | LCD_Write_DATA(0x42); 44 | LCD_Write_DATA(0x22); 45 | LCD_Write_DATA(0x11); 46 | LCD_Write_DATA(0x11); 47 | LCD_Write_DATA(0x22); 48 | LCD_Write_DATA(0x99); 49 | LCD_Write_DATA(0xAA); 50 | LCD_Write_DATA(0xAA); 51 | LCD_Write_DATA(0xAA); 52 | LCD_Write_DATA(0xBB); 53 | LCD_Write_DATA(0xBB); 54 | LCD_Write_DATA(0xAA); 55 | LCD_Write_DATA(0x33); 56 | LCD_Write_DATA(0x33); 57 | LCD_Write_DATA(0x11); 58 | LCD_Write_DATA(0x01); 59 | LCD_Write_DATA(0x01); 60 | LCD_Write_DATA(0x01); 61 | LCD_Write_DATA(0x00); 62 | LCD_Write_DATA(0x00); 63 | LCD_Write_DATA(0xC0); 64 | LCD_Write_DATA(0x00); 65 | LCD_Write_DATA(0x00); 66 | LCD_Write_DATA(0x00); 67 | LCD_Write_DATA(0x00); 68 | 69 | // ----------- Gamma Curve Set3 Negative----------// 70 | LCD_Write_COM(0xFD); 71 | 72 | LCD_Write_DATA(0x88); 73 | LCD_Write_DATA(0x00); 74 | LCD_Write_DATA(0x10); 75 | LCD_Write_DATA(0x01); 76 | LCD_Write_DATA(0x01); 77 | LCD_Write_DATA(0x10); 78 | LCD_Write_DATA(0x42); 79 | LCD_Write_DATA(0x42); 80 | LCD_Write_DATA(0x22); 81 | LCD_Write_DATA(0x11); 82 | LCD_Write_DATA(0x11); 83 | LCD_Write_DATA(0x22); 84 | LCD_Write_DATA(0x99); 85 | LCD_Write_DATA(0xAA); 86 | LCD_Write_DATA(0xAA); 87 | LCD_Write_DATA(0xAA); 88 | LCD_Write_DATA(0xBB); 89 | LCD_Write_DATA(0xBB); 90 | LCD_Write_DATA(0xAA); 91 | LCD_Write_DATA(0x33); 92 | LCD_Write_DATA(0x33); 93 | LCD_Write_DATA(0x11); 94 | LCD_Write_DATA(0x01); 95 | LCD_Write_DATA(0x01); 96 | LCD_Write_DATA(0x01); 97 | LCD_Write_DATA(0x00); 98 | LCD_Write_DATA(0x00); 99 | LCD_Write_DATA(0x00); 100 | LCD_Write_DATA(0x00); 101 | LCD_Write_DATA(0x00); 102 | LCD_Write_DATA(0x00); 103 | LCD_Write_DATA(0x03); 104 | 105 | // ----------- EVRSER Regulator Voltage Setting---------// 106 | LCD_Write_COM(0xBE); 107 | 108 | LCD_Write_DATA(0x00); 109 | LCD_Write_DATA(0x15); 110 | LCD_Write_DATA(0x16); 111 | LCD_Write_DATA(0x08); 112 | LCD_Write_DATA(0x09); 113 | LCD_Write_DATA(0x15); 114 | LCD_Write_DATA(0x10); 115 | LCD_Write_DATA(0x00); 116 | LCD_Write_DATA(0x00); 117 | LCD_Write_DATA(0x00); 118 | 119 | // -----------Module Definiton Setting---------// 120 | LCD_Write_COM(0xC0); 121 | 122 | LCD_Write_DATA(0x0E); 123 | LCD_Write_DATA(0x01); 124 | LCD_Write_DATA(0x00); 125 | LCD_Write_DATA(0x00); 126 | LCD_Write_DATA(0x00); 127 | 128 | // -----------PWRDEF Power Ability Ddfinition----------// 129 | LCD_Write_COM(0xC1); 130 | 131 | LCD_Write_DATA(0x2F); 132 | LCD_Write_DATA(0x23); 133 | LCD_Write_DATA(0xB4); 134 | LCD_Write_DATA(0xFF); 135 | LCD_Write_DATA(0x24); 136 | LCD_Write_DATA(0x03); 137 | LCD_Write_DATA(0x20); 138 | LCD_Write_DATA(0x02); 139 | LCD_Write_DATA(0x02); 140 | LCD_Write_DATA(0x02); 141 | LCD_Write_DATA(0x20); 142 | LCD_Write_DATA(0x20); 143 | LCD_Write_DATA(0x00); 144 | 145 | // -----------Other Setting----------// 146 | LCD_Write_COM(0xC2); 147 | LCD_Write_DATA(0x03); 148 | LCD_Write_COM(0x26); 149 | LCD_Write_DATA(0x08); 150 | LCD_Write_COM(0x35); 151 | 152 | LCD_Write_COM(0x36); 153 | LCD_Write_DATA(0x64); 154 | LCD_Write_COM(0x3A); 155 | LCD_Write_DATA(0x05); 156 | LCD_Write_COM(0x2A); 157 | LCD_Write_DATA(0x01,0x3f); 158 | LCD_Write_COM(0x2B); 159 | LCD_Write_DATA(0xEF); 160 | LCD_Write_COM(0x2c); 161 | 162 | // -----------RGB Setting----------// 163 | LCD_Write_COM(0x2D); 164 | R=0; 165 | G=0; 166 | B=0; 167 | 168 | for(i=0;i<32;i++) 169 | { 170 | LCD_Write_DATA(R); 171 | R=R+2; 172 | } 173 | for(i=0;i<64;i++) 174 | { 175 | LCD_Write_DATA(G); 176 | G=G+1; 177 | } 178 | for(i=0;i<32;i++) 179 | { 180 | LCD_Write_DATA(B); 181 | B=B+2; 182 | } 183 | break; 184 | -------------------------------------------------------------------------------- /tft_drivers/s1d19122/setxy.h: -------------------------------------------------------------------------------- 1 | case S1D19122: 2 | LCD_Write_COM(0x2a); 3 | LCD_Write_DATA(x1>>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2b); 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2c); 13 | break; 14 | -------------------------------------------------------------------------------- /tft_drivers/s6d0164/initlcd.h: -------------------------------------------------------------------------------- 1 | case S6D0164: 2 | LCD_Write_COM_DATA(0x11,0x001A); 3 | LCD_Write_COM_DATA(0x12,0x3121); 4 | LCD_Write_COM_DATA(0x13,0x006C); 5 | LCD_Write_COM_DATA(0x14,0x4249); 6 | 7 | LCD_Write_COM_DATA(0x10,0x0800); 8 | delay(10); 9 | LCD_Write_COM_DATA(0x11,0x011A); 10 | delay(10); 11 | LCD_Write_COM_DATA(0x11,0x031A); 12 | delay(10); 13 | LCD_Write_COM_DATA(0x11,0x071A); 14 | delay(10); 15 | LCD_Write_COM_DATA(0x11,0x0F1A); 16 | delay(10); 17 | LCD_Write_COM_DATA(0x11,0x0F3A); 18 | delay(30); 19 | 20 | LCD_Write_COM_DATA(0x01,0x011C); 21 | LCD_Write_COM_DATA(0x02,0x0100); 22 | LCD_Write_COM_DATA(0x03,0x1030); 23 | LCD_Write_COM_DATA(0x07,0x0000); 24 | LCD_Write_COM_DATA(0x08,0x0808); 25 | LCD_Write_COM_DATA(0x0B,0x1100); 26 | LCD_Write_COM_DATA(0x0C,0x0000); 27 | 28 | LCD_Write_COM_DATA(0x0F,0x1401); 29 | LCD_Write_COM_DATA(0x15,0x0000); 30 | LCD_Write_COM_DATA(0x20,0x0000); 31 | LCD_Write_COM_DATA(0x21,0x0000); 32 | 33 | 34 | LCD_Write_COM_DATA(0x36,0x00AF); 35 | LCD_Write_COM_DATA(0x37,0x0000); 36 | LCD_Write_COM_DATA(0x38,0x00DB); 37 | LCD_Write_COM_DATA(0x39,0x0000); 38 | 39 | LCD_Write_COM_DATA(0x0F,0x0B01); 40 | LCD_Write_COM_DATA(0x07,0x0016); 41 | LCD_Write_COM_DATA(0x07,0x0017); 42 | 43 | LCD_Write_COM(0x22); 44 | break; 45 | -------------------------------------------------------------------------------- /tft_drivers/s6d0164/setxy.h: -------------------------------------------------------------------------------- 1 | case S6D0164: 2 | LCD_Write_COM_DATA(0x36,x2); 3 | LCD_Write_COM_DATA(0x37,x1); 4 | LCD_Write_COM_DATA(0x38,y2); 5 | LCD_Write_COM_DATA(0x39,y1); 6 | LCD_Write_COM_DATA(0x20,x1); 7 | LCD_Write_COM_DATA(0x21,y1); 8 | LCD_Write_COM(0x22); 9 | break; 10 | -------------------------------------------------------------------------------- /tft_drivers/s6d1121/initlcd.h: -------------------------------------------------------------------------------- 1 | case S6D1121_8: 2 | case S6D1121_16: 3 | LCD_Write_COM_DATA(0x11,0x2004); 4 | LCD_Write_COM_DATA(0x13,0xCC00); 5 | LCD_Write_COM_DATA(0x15,0x2600); 6 | LCD_Write_COM_DATA(0x14,0x252A); 7 | LCD_Write_COM_DATA(0x12,0x0033); 8 | LCD_Write_COM_DATA(0x13,0xCC04); 9 | LCD_Write_COM_DATA(0x13,0xCC06); 10 | LCD_Write_COM_DATA(0x13,0xCC4F); 11 | LCD_Write_COM_DATA(0x13,0x674F); 12 | LCD_Write_COM_DATA(0x11,0x2003); 13 | LCD_Write_COM_DATA(0x30,0x2609); 14 | LCD_Write_COM_DATA(0x31,0x242C); 15 | LCD_Write_COM_DATA(0x32,0x1F23); 16 | LCD_Write_COM_DATA(0x33,0x2425); 17 | LCD_Write_COM_DATA(0x34,0x2226); 18 | LCD_Write_COM_DATA(0x35,0x2523); 19 | LCD_Write_COM_DATA(0x36,0x1C1A); 20 | LCD_Write_COM_DATA(0x37,0x131D); 21 | LCD_Write_COM_DATA(0x38,0x0B11); 22 | LCD_Write_COM_DATA(0x39,0x1210); 23 | LCD_Write_COM_DATA(0x3A,0x1315); 24 | LCD_Write_COM_DATA(0x3B,0x3619); 25 | LCD_Write_COM_DATA(0x3C,0x0D00); 26 | LCD_Write_COM_DATA(0x3D,0x000D); 27 | LCD_Write_COM_DATA(0x16,0x0007); 28 | LCD_Write_COM_DATA(0x02,0x0013); 29 | LCD_Write_COM_DATA(0x03,0x0003); 30 | LCD_Write_COM_DATA(0x01,0x0127); 31 | LCD_Write_COM_DATA(0x08,0x0303); 32 | LCD_Write_COM_DATA(0x0A,0x000B); 33 | LCD_Write_COM_DATA(0x0B,0x0003); 34 | LCD_Write_COM_DATA(0x0C,0x0000); 35 | LCD_Write_COM_DATA(0x41,0x0000); 36 | LCD_Write_COM_DATA(0x50,0x0000); 37 | LCD_Write_COM_DATA(0x60,0x0005); 38 | LCD_Write_COM_DATA(0x70,0x000B); 39 | LCD_Write_COM_DATA(0x71,0x0000); 40 | LCD_Write_COM_DATA(0x78,0x0000); 41 | LCD_Write_COM_DATA(0x7A,0x0000); 42 | LCD_Write_COM_DATA(0x79,0x0007); 43 | LCD_Write_COM_DATA(0x07,0x0051); 44 | LCD_Write_COM_DATA(0x07,0x0053); 45 | LCD_Write_COM_DATA(0x79,0x0000); 46 | LCD_Write_COM(0x22); 47 | break; 48 | -------------------------------------------------------------------------------- /tft_drivers/s6d1121/setxy.h: -------------------------------------------------------------------------------- 1 | case S6D1121_8: 2 | case S6D1121_16: 3 | LCD_Write_COM_DATA(0x46,(x2 << 8) | x1); 4 | LCD_Write_COM_DATA(0x47,y2); 5 | LCD_Write_COM_DATA(0x48,y1); 6 | LCD_Write_COM_DATA(0x20,x1); 7 | LCD_Write_COM_DATA(0x21,y1); 8 | LCD_Write_COM(0x22); 9 | break; 10 | -------------------------------------------------------------------------------- /tft_drivers/ssd1289/initlcd.h: -------------------------------------------------------------------------------- 1 | case SSD1289: 2 | case SSD1289_8: 3 | case SSD1289LATCHED: 4 | LCD_Write_COM_DATA(0x00,0x0001); 5 | LCD_Write_COM_DATA(0x03,0xA8A4); 6 | LCD_Write_COM_DATA(0x0C,0x0000); 7 | LCD_Write_COM_DATA(0x0D,0x080C); 8 | LCD_Write_COM_DATA(0x0E,0x2B00); 9 | LCD_Write_COM_DATA(0x1E,0x00B7); 10 | LCD_Write_COM_DATA(0x01,0x2B3F); 11 | LCD_Write_COM_DATA(0x02,0x0600); 12 | LCD_Write_COM_DATA(0x10,0x0000); 13 | LCD_Write_COM_DATA(0x11,0x6070); 14 | LCD_Write_COM_DATA(0x05,0x0000); 15 | LCD_Write_COM_DATA(0x06,0x0000); 16 | LCD_Write_COM_DATA(0x16,0xEF1C); 17 | LCD_Write_COM_DATA(0x17,0x0003); 18 | LCD_Write_COM_DATA(0x07,0x0233); 19 | LCD_Write_COM_DATA(0x0B,0x0000); 20 | LCD_Write_COM_DATA(0x0F,0x0000); 21 | LCD_Write_COM_DATA(0x41,0x0000); 22 | LCD_Write_COM_DATA(0x42,0x0000); 23 | LCD_Write_COM_DATA(0x48,0x0000); 24 | LCD_Write_COM_DATA(0x49,0x013F); 25 | LCD_Write_COM_DATA(0x4A,0x0000); 26 | LCD_Write_COM_DATA(0x4B,0x0000); 27 | LCD_Write_COM_DATA(0x44,0xEF00); 28 | LCD_Write_COM_DATA(0x45,0x0000); 29 | LCD_Write_COM_DATA(0x46,0x013F); 30 | LCD_Write_COM_DATA(0x30,0x0707); 31 | LCD_Write_COM_DATA(0x31,0x0204); 32 | LCD_Write_COM_DATA(0x32,0x0204); 33 | LCD_Write_COM_DATA(0x33,0x0502); 34 | LCD_Write_COM_DATA(0x34,0x0507); 35 | LCD_Write_COM_DATA(0x35,0x0204); 36 | LCD_Write_COM_DATA(0x36,0x0204); 37 | LCD_Write_COM_DATA(0x37,0x0502); 38 | LCD_Write_COM_DATA(0x3A,0x0302); 39 | LCD_Write_COM_DATA(0x3B,0x0302); 40 | LCD_Write_COM_DATA(0x23,0x0000); 41 | LCD_Write_COM_DATA(0x24,0x0000); 42 | LCD_Write_COM_DATA(0x25,0x8000); 43 | LCD_Write_COM_DATA(0x4f,0x0000); 44 | LCD_Write_COM_DATA(0x4e,0x0000); 45 | LCD_Write_COM(0x22); 46 | break; 47 | -------------------------------------------------------------------------------- /tft_drivers/ssd1289/setxy.h: -------------------------------------------------------------------------------- 1 | case SSD1289: 2 | case SSD1289_8: 3 | case SSD1289LATCHED: 4 | LCD_Write_COM_DATA(0x44,(x2<<8)+x1); 5 | LCD_Write_COM_DATA(0x45,y1); 6 | LCD_Write_COM_DATA(0x46,y2); 7 | LCD_Write_COM_DATA(0x4e,x1); 8 | LCD_Write_COM_DATA(0x4f,y1); 9 | LCD_Write_COM(0x22); 10 | break; 11 | -------------------------------------------------------------------------------- /tft_drivers/ssd1963/480/initlcd.h: -------------------------------------------------------------------------------- 1 | case SSD1963_480: 2 | LCD_Write_COM(0xE2); //PLL multiplier, set PLL clock to 120M 3 | LCD_Write_DATA(0x23); //N=0x36 for 6.5M, 0x23 for 10M crystal 4 | LCD_Write_DATA(0x02); 5 | LCD_Write_DATA(0x54); 6 | LCD_Write_COM(0xE0); // PLL enable 7 | LCD_Write_DATA(0x01); 8 | delay(10); 9 | LCD_Write_COM(0xE0); 10 | LCD_Write_DATA(0x03); 11 | delay(10); 12 | LCD_Write_COM(0x01); // software reset 13 | delay(100); 14 | LCD_Write_COM(0xE6); //PLL setting for PCLK, depends on resolution 15 | LCD_Write_DATA(0x01); 16 | LCD_Write_DATA(0x1F); 17 | LCD_Write_DATA(0xFF); 18 | 19 | LCD_Write_COM(0xB0); //LCD SPECIFICATION 20 | LCD_Write_DATA(0x20); 21 | LCD_Write_DATA(0x00); 22 | LCD_Write_DATA(0x01); //Set HDP 479 23 | LCD_Write_DATA(0xDF); 24 | LCD_Write_DATA(0x01); //Set VDP 271 25 | LCD_Write_DATA(0x0F); 26 | LCD_Write_DATA(0x00); 27 | 28 | LCD_Write_COM(0xB4); //HSYNC 29 | LCD_Write_DATA(0x02); //Set HT 531 30 | LCD_Write_DATA(0x13); 31 | LCD_Write_DATA(0x00); //Set HPS 8 32 | LCD_Write_DATA(0x08); 33 | LCD_Write_DATA(0x2B); //Set HPW 43 34 | LCD_Write_DATA(0x00); //Set LPS 2 35 | LCD_Write_DATA(0x02); 36 | LCD_Write_DATA(0x00); 37 | 38 | LCD_Write_COM(0xB6); //VSYNC 39 | LCD_Write_DATA(0x01); //Set VT 288 40 | LCD_Write_DATA(0x20); 41 | LCD_Write_DATA(0x00); //Set VPS 4 42 | LCD_Write_DATA(0x04); 43 | LCD_Write_DATA(0x0c); //Set VPW 12 44 | LCD_Write_DATA(0x00); //Set FPS 2 45 | LCD_Write_DATA(0x02); 46 | 47 | LCD_Write_COM(0xBA); 48 | LCD_Write_DATA(0x0F); //GPIO[3:0] out 1 49 | 50 | LCD_Write_COM(0xB8); 51 | LCD_Write_DATA(0x07); //GPIO3=input, GPIO[2:0]=output 52 | LCD_Write_DATA(0x01); //GPIO0 normal 53 | 54 | LCD_Write_COM(0x36); //rotation 55 | LCD_Write_DATA(0x22); 56 | 57 | LCD_Write_COM(0xF0); //pixel data interface 58 | LCD_Write_DATA(0x03); 59 | 60 | 61 | delay(1); 62 | 63 | setXY(0, 0, 479, 271); 64 | LCD_Write_COM(0x29); //display on 65 | 66 | LCD_Write_COM(0xBE); //set PWM for B/L 67 | LCD_Write_DATA(0x06); 68 | LCD_Write_DATA(0xf0); 69 | LCD_Write_DATA(0x01); 70 | LCD_Write_DATA(0xf0); 71 | LCD_Write_DATA(0x00); 72 | LCD_Write_DATA(0x00); 73 | 74 | LCD_Write_COM(0xd0); 75 | LCD_Write_DATA(0x0d); 76 | 77 | LCD_Write_COM(0x2C); 78 | break; 79 | -------------------------------------------------------------------------------- /tft_drivers/ssd1963/480/setxy.h: -------------------------------------------------------------------------------- 1 | case SSD1963_480: 2 | swap(word, x1, y1); 3 | swap(word, x2, y2); 4 | LCD_Write_COM(0x2a); 5 | LCD_Write_DATA(x1>>8); 6 | LCD_Write_DATA(x1); 7 | LCD_Write_DATA(x2>>8); 8 | LCD_Write_DATA(x2); 9 | LCD_Write_COM(0x2b); 10 | LCD_Write_DATA(y1>>8); 11 | LCD_Write_DATA(y1); 12 | LCD_Write_DATA(y2>>8); 13 | LCD_Write_DATA(y2); 14 | LCD_Write_COM(0x2c); 15 | break; 16 | -------------------------------------------------------------------------------- /tft_drivers/ssd1963/800/initlcd.h: -------------------------------------------------------------------------------- 1 | case SSD1963_800: 2 | LCD_Write_COM(0xE2); //PLL multiplier, set PLL clock to 120M 3 | LCD_Write_DATA(0x1E); //N=0x36 for 6.5M, 0x23 for 10M crystal 4 | LCD_Write_DATA(0x02); 5 | LCD_Write_DATA(0x54); 6 | LCD_Write_COM(0xE0); // PLL enable 7 | LCD_Write_DATA(0x01); 8 | delay(10); 9 | LCD_Write_COM(0xE0); 10 | LCD_Write_DATA(0x03); 11 | delay(10); 12 | LCD_Write_COM(0x01); // software reset 13 | delay(100); 14 | LCD_Write_COM(0xE6); //PLL setting for PCLK, depends on resolution 15 | LCD_Write_DATA(0x03); 16 | LCD_Write_DATA(0xFF); 17 | LCD_Write_DATA(0xFF); 18 | 19 | LCD_Write_COM(0xB0); //LCD SPECIFICATION 20 | LCD_Write_DATA(0x24); 21 | LCD_Write_DATA(0x00); 22 | LCD_Write_DATA(0x03); //Set HDP 799 23 | LCD_Write_DATA(0x1F); 24 | LCD_Write_DATA(0x01); //Set VDP 479 25 | LCD_Write_DATA(0xDF); 26 | LCD_Write_DATA(0x00); 27 | 28 | LCD_Write_COM(0xB4); //HSYNC 29 | LCD_Write_DATA(0x03); //Set HT 928 30 | LCD_Write_DATA(0xA0); 31 | LCD_Write_DATA(0x00); //Set HPS 46 32 | LCD_Write_DATA(0x2E); 33 | LCD_Write_DATA(0x30); //Set HPW 48 34 | LCD_Write_DATA(0x00); //Set LPS 15 35 | LCD_Write_DATA(0x0F); 36 | LCD_Write_DATA(0x00); 37 | 38 | LCD_Write_COM(0xB6); //VSYNC 39 | LCD_Write_DATA(0x02); //Set VT 525 40 | LCD_Write_DATA(0x0D); 41 | LCD_Write_DATA(0x00); //Set VPS 16 42 | LCD_Write_DATA(0x10); 43 | LCD_Write_DATA(0x10); //Set VPW 16 44 | LCD_Write_DATA(0x00); //Set FPS 8 45 | LCD_Write_DATA(0x08); 46 | 47 | LCD_Write_COM(0xBA); 48 | LCD_Write_DATA(0x0F); //GPIO[3:0] out 1 49 | 50 | LCD_Write_COM(0xB8); 51 | LCD_Write_DATA(0x07); //GPIO3=input, GPIO[2:0]=output 52 | LCD_Write_DATA(0x01); //GPIO0 normal 53 | 54 | LCD_Write_COM(0x36); //rotation 55 | LCD_Write_DATA(0x22); 56 | 57 | LCD_Write_COM(0xF0); //pixel data interface 58 | LCD_Write_DATA(0x03); 59 | 60 | 61 | delay(1); 62 | 63 | setXY(0, 0, 799, 479); 64 | LCD_Write_COM(0x29); //display on 65 | 66 | LCD_Write_COM(0xBE); //set PWM for B/L 67 | LCD_Write_DATA(0x06); 68 | LCD_Write_DATA(0xf0); 69 | LCD_Write_DATA(0x01); 70 | LCD_Write_DATA(0xf0); 71 | LCD_Write_DATA(0x00); 72 | LCD_Write_DATA(0x00); 73 | 74 | LCD_Write_COM(0xd0); 75 | LCD_Write_DATA(0x0d); 76 | 77 | LCD_Write_COM(0x2C); 78 | break; 79 | -------------------------------------------------------------------------------- /tft_drivers/ssd1963/800/setxy.h: -------------------------------------------------------------------------------- 1 | case SSD1963_800: 2 | swap(word, x1, y1); 3 | swap(word, x2, y2); 4 | LCD_Write_COM(0x2a); 5 | LCD_Write_DATA(x1>>8); 6 | LCD_Write_DATA(x1); 7 | LCD_Write_DATA(x2>>8); 8 | LCD_Write_DATA(x2); 9 | LCD_Write_COM(0x2b); 10 | LCD_Write_DATA(y1>>8); 11 | LCD_Write_DATA(y1); 12 | LCD_Write_DATA(y2>>8); 13 | LCD_Write_DATA(y2); 14 | LCD_Write_COM(0x2c); 15 | break; 16 | -------------------------------------------------------------------------------- /tft_drivers/ssd1963/800alt/initlcd.h: -------------------------------------------------------------------------------- 1 | case SSD1963_800ALT: 2 | LCD_Write_COM(0xE2); //PLL multiplier, set PLL clock to 120M 3 | LCD_Write_DATA(0x23); //N=0x36 for 6.5M, 0x23 for 10M crystal 4 | LCD_Write_DATA(0x02); 5 | LCD_Write_DATA(0x04); 6 | LCD_Write_COM(0xE0); // PLL enable 7 | LCD_Write_DATA(0x01); 8 | delay(10); 9 | LCD_Write_COM(0xE0); 10 | LCD_Write_DATA(0x03); 11 | delay(10); 12 | LCD_Write_COM(0x01); // software reset 13 | delay(100); 14 | LCD_Write_COM(0xE6); //PLL setting for PCLK, depends on resolution 15 | LCD_Write_DATA(0x04); 16 | LCD_Write_DATA(0x93); 17 | LCD_Write_DATA(0xE0); 18 | 19 | LCD_Write_COM(0xB0); //LCD SPECIFICATION 20 | LCD_Write_DATA(0x00); // 0x24 21 | LCD_Write_DATA(0x00); 22 | LCD_Write_DATA(0x03); //Set HDP 799 23 | LCD_Write_DATA(0x1F); 24 | LCD_Write_DATA(0x01); //Set VDP 479 25 | LCD_Write_DATA(0xDF); 26 | LCD_Write_DATA(0x00); 27 | 28 | LCD_Write_COM(0xB4); //HSYNC 29 | LCD_Write_DATA(0x03); //Set HT 928 30 | LCD_Write_DATA(0xA0); 31 | LCD_Write_DATA(0x00); //Set HPS 46 32 | LCD_Write_DATA(0x2E); 33 | LCD_Write_DATA(0x30); //Set HPW 48 34 | LCD_Write_DATA(0x00); //Set LPS 15 35 | LCD_Write_DATA(0x0F); 36 | LCD_Write_DATA(0x00); 37 | 38 | LCD_Write_COM(0xB6); //VSYNC 39 | LCD_Write_DATA(0x02); //Set VT 525 40 | LCD_Write_DATA(0x0D); 41 | LCD_Write_DATA(0x00); //Set VPS 16 42 | LCD_Write_DATA(0x10); 43 | LCD_Write_DATA(0x10); //Set VPW 16 44 | LCD_Write_DATA(0x00); //Set FPS 8 45 | LCD_Write_DATA(0x08); 46 | 47 | LCD_Write_COM(0xBA); 48 | LCD_Write_DATA(0x05); //GPIO[3:0] out 1 49 | 50 | LCD_Write_COM(0xB8); 51 | LCD_Write_DATA(0x07); //GPIO3=input, GPIO[2:0]=output 52 | LCD_Write_DATA(0x01); //GPIO0 normal 53 | 54 | LCD_Write_COM(0x36); //rotation 55 | LCD_Write_DATA(0x22); // -- Set to 0x21 to rotate 180 degrees 56 | 57 | LCD_Write_COM(0xF0); //pixel data interface 58 | LCD_Write_DATA(0x03); 59 | 60 | 61 | delay(10); 62 | 63 | setXY(0, 0, 799, 479); 64 | LCD_Write_COM(0x29); //display on 65 | 66 | LCD_Write_COM(0xBE); //set PWM for B/L 67 | LCD_Write_DATA(0x06); 68 | LCD_Write_DATA(0xF0); 69 | LCD_Write_DATA(0x01); 70 | LCD_Write_DATA(0xF0); 71 | LCD_Write_DATA(0x00); 72 | LCD_Write_DATA(0x00); 73 | 74 | LCD_Write_COM(0xD0); 75 | LCD_Write_DATA(0x0D); 76 | 77 | LCD_Write_COM(0x2C); 78 | break; 79 | -------------------------------------------------------------------------------- /tft_drivers/ssd1963/800alt/setxy.h: -------------------------------------------------------------------------------- 1 | case SSD1963_800ALT: 2 | swap(word, x1, y1); 3 | swap(word, x2, y2); 4 | LCD_Write_COM(0x2a); 5 | LCD_Write_DATA(x1>>8); 6 | LCD_Write_DATA(x1); 7 | LCD_Write_DATA(x2>>8); 8 | LCD_Write_DATA(x2); 9 | LCD_Write_COM(0x2b); 10 | LCD_Write_DATA(y1>>8); 11 | LCD_Write_DATA(y1); 12 | LCD_Write_DATA(y2>>8); 13 | LCD_Write_DATA(y2); 14 | LCD_Write_COM(0x2c); 15 | break; 16 | -------------------------------------------------------------------------------- /tft_drivers/st7735/initlcd.h: -------------------------------------------------------------------------------- 1 | case ST7735: 2 | LCD_Write_COM(0x11);//Sleep exit 3 | delay(12); 4 | 5 | //ST7735R Frame Rate 6 | LCD_Write_COM(0xB1); 7 | LCD_Write_DATA(0x01); 8 | LCD_Write_DATA(0x2C); 9 | LCD_Write_DATA(0x2D); 10 | LCD_Write_COM(0xB2); 11 | LCD_Write_DATA(0x01); 12 | LCD_Write_DATA(0x2C); 13 | LCD_Write_DATA(0x2D); 14 | LCD_Write_COM(0xB3); 15 | LCD_Write_DATA(0x01); 16 | LCD_Write_DATA(0x2C); 17 | LCD_Write_DATA(0x2D); 18 | LCD_Write_DATA(0x01); 19 | LCD_Write_DATA(0x2C); 20 | LCD_Write_DATA(0x2D); 21 | 22 | LCD_Write_COM(0xB4); //Column inversion 23 | LCD_Write_DATA(0x07); 24 | 25 | //ST7735R Power Sequence 26 | LCD_Write_COM(0xC0); 27 | LCD_Write_DATA(0xA2); 28 | LCD_Write_DATA(0x02); 29 | LCD_Write_DATA(0x84); 30 | LCD_Write_COM(0xC1); 31 | LCD_Write_DATA(0xC5); 32 | LCD_Write_COM(0xC2); 33 | LCD_Write_DATA(0x0A); 34 | LCD_Write_DATA(0x00); 35 | LCD_Write_COM(0xC3); 36 | LCD_Write_DATA(0x8A); 37 | LCD_Write_DATA(0x2A); 38 | LCD_Write_COM(0xC4); 39 | LCD_Write_DATA(0x8A); 40 | LCD_Write_DATA(0xEE); 41 | 42 | LCD_Write_COM(0xC5); //VCOM 43 | LCD_Write_DATA(0x0E); 44 | 45 | LCD_Write_COM(0x36); //MX, MY, RGB mode 46 | LCD_Write_DATA(0xC8); 47 | 48 | //ST7735R Gamma Sequence 49 | LCD_Write_COM(0xe0); 50 | LCD_Write_DATA(0x0f); 51 | LCD_Write_DATA(0x1a); 52 | LCD_Write_DATA(0x0f); 53 | LCD_Write_DATA(0x18); 54 | LCD_Write_DATA(0x2f); 55 | LCD_Write_DATA(0x28); 56 | LCD_Write_DATA(0x20); 57 | LCD_Write_DATA(0x22); 58 | LCD_Write_DATA(0x1f); 59 | LCD_Write_DATA(0x1b); 60 | LCD_Write_DATA(0x23); 61 | LCD_Write_DATA(0x37); 62 | LCD_Write_DATA(0x00); 63 | 64 | LCD_Write_DATA(0x07); 65 | LCD_Write_DATA(0x02); 66 | LCD_Write_DATA(0x10); 67 | LCD_Write_COM(0xe1); 68 | LCD_Write_DATA(0x0f); 69 | LCD_Write_DATA(0x1b); 70 | LCD_Write_DATA(0x0f); 71 | LCD_Write_DATA(0x17); 72 | LCD_Write_DATA(0x33); 73 | LCD_Write_DATA(0x2c); 74 | LCD_Write_DATA(0x29); 75 | LCD_Write_DATA(0x2e); 76 | LCD_Write_DATA(0x30); 77 | LCD_Write_DATA(0x30); 78 | LCD_Write_DATA(0x39); 79 | LCD_Write_DATA(0x3f); 80 | LCD_Write_DATA(0x00); 81 | LCD_Write_DATA(0x07); 82 | LCD_Write_DATA(0x03); 83 | LCD_Write_DATA(0x10); 84 | 85 | LCD_Write_COM(0x2a); 86 | LCD_Write_DATA(0x00); 87 | LCD_Write_DATA(0x00); 88 | LCD_Write_DATA(0x00); 89 | LCD_Write_DATA(0x7f); 90 | LCD_Write_COM(0x2b); 91 | LCD_Write_DATA(0x00); 92 | LCD_Write_DATA(0x00); 93 | LCD_Write_DATA(0x00); 94 | LCD_Write_DATA(0x9f); 95 | 96 | LCD_Write_COM(0xF0); //Enable test command 97 | LCD_Write_DATA(0x01); 98 | LCD_Write_COM(0xF6); //Disable ram power save mode 99 | LCD_Write_DATA(0x00); 100 | 101 | LCD_Write_COM(0x3A); //65k mode 102 | LCD_Write_DATA(0x05); 103 | LCD_Write_COM(0x29);//Display on 104 | break; 105 | -------------------------------------------------------------------------------- /tft_drivers/st7735/setxy.h: -------------------------------------------------------------------------------- 1 | case ST7735: 2 | LCD_Write_COM(0x2a); 3 | LCD_Write_DATA(x1>>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2b); 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2c); 13 | break; 14 | -------------------------------------------------------------------------------- /tft_drivers/st7735s/initlcd.h: -------------------------------------------------------------------------------- 1 | case ST7735S: 2 | LCD_Write_COM(0x11);//Sleep exit 3 | delay(120); 4 | 5 | //ST7735R Frame Rate 6 | LCD_Write_COM(0xB1); 7 | LCD_Write_DATA(0x05); 8 | LCD_Write_DATA(0x3C); 9 | LCD_Write_DATA(0x3C); 10 | LCD_Write_COM(0xB2); 11 | LCD_Write_DATA(0x05); 12 | LCD_Write_DATA(0x3C); 13 | LCD_Write_DATA(0x3C); 14 | LCD_Write_COM(0xB3); 15 | LCD_Write_DATA(0x05); 16 | LCD_Write_DATA(0x3C); 17 | LCD_Write_DATA(0x3C); 18 | LCD_Write_DATA(0x05); 19 | LCD_Write_DATA(0x3C); 20 | LCD_Write_DATA(0x3C); 21 | 22 | LCD_Write_COM(0xB4); //Column inversion 23 | LCD_Write_DATA(0x03); 24 | 25 | //ST7735R Power Sequence 26 | LCD_Write_COM(0xC0); 27 | LCD_Write_DATA(0x28); 28 | LCD_Write_DATA(0x08); 29 | LCD_Write_DATA(0x04); 30 | LCD_Write_COM(0xC1); 31 | LCD_Write_DATA(0xC0); 32 | LCD_Write_COM(0xC2); 33 | LCD_Write_DATA(0x0D); 34 | LCD_Write_DATA(0x00); 35 | LCD_Write_COM(0xC3); 36 | LCD_Write_DATA(0x8D); 37 | LCD_Write_DATA(0x2A); 38 | LCD_Write_COM(0xC4); 39 | LCD_Write_DATA(0x8D); 40 | LCD_Write_DATA(0xEE); 41 | 42 | LCD_Write_COM(0xC5); //VCOM 43 | LCD_Write_DATA(0x1A); 44 | 45 | LCD_Write_COM(0x36); //MX, MY, RGB mode 46 | LCD_Write_DATA(0xC0); 47 | 48 | //ST7735R Gamma Sequence 49 | LCD_Write_COM(0xE0); 50 | LCD_Write_DATA(0x03); 51 | LCD_Write_DATA(0x22); 52 | LCD_Write_DATA(0x07); 53 | LCD_Write_DATA(0x0A); 54 | LCD_Write_DATA(0x2E); 55 | LCD_Write_DATA(0x30); 56 | LCD_Write_DATA(0x25); 57 | LCD_Write_DATA(0x2A); 58 | LCD_Write_DATA(0x28); 59 | LCD_Write_DATA(0x26); 60 | LCD_Write_DATA(0x2E); 61 | LCD_Write_DATA(0x3A); 62 | LCD_Write_DATA(0x00); 63 | LCD_Write_DATA(0x01); 64 | LCD_Write_DATA(0x03); 65 | LCD_Write_DATA(0x13); 66 | LCD_Write_COM(0xE1); 67 | LCD_Write_DATA(0x04); 68 | LCD_Write_DATA(0x16); 69 | LCD_Write_DATA(0x06); 70 | LCD_Write_DATA(0x0D); 71 | LCD_Write_DATA(0x2D); 72 | LCD_Write_DATA(0x26); 73 | LCD_Write_DATA(0x23); 74 | LCD_Write_DATA(0x27); 75 | LCD_Write_DATA(0x27); 76 | LCD_Write_DATA(0x25); 77 | LCD_Write_DATA(0x2D); 78 | LCD_Write_DATA(0x3B); 79 | LCD_Write_DATA(0x00); 80 | LCD_Write_DATA(0x01); 81 | LCD_Write_DATA(0x04); 82 | LCD_Write_DATA(0x13); 83 | 84 | //LCD_Write_COM(0x2A); 85 | //LCD_Write_DATA(0x00); 86 | //LCD_Write_DATA(0x00); 87 | //LCD_Write_DATA(0x00); 88 | //LCD_Write_DATA(0x7F); 89 | //LCD_Write_COM(0x2B); 90 | //LCD_Write_DATA(0x00); 91 | //LCD_Write_DATA(0x00); 92 | //LCD_Write_DATA(0x00); 93 | //LCD_Write_DATA(0x9F); 94 | 95 | LCD_Write_COM(0x3A); //65k mode 96 | LCD_Write_DATA(0x05); 97 | LCD_Write_COM(0x29);//Display on 98 | break; 99 | -------------------------------------------------------------------------------- /tft_drivers/st7735s/setxy.h: -------------------------------------------------------------------------------- 1 | case ST7735S: 2 | LCD_Write_COM(0x2a); 3 | LCD_Write_DATA(x1>>8); 4 | LCD_Write_DATA(x1); 5 | LCD_Write_DATA(x2>>8); 6 | LCD_Write_DATA(x2); 7 | LCD_Write_COM(0x2b); 8 | LCD_Write_DATA(y1>>8); 9 | LCD_Write_DATA(y1); 10 | LCD_Write_DATA(y2>>8); 11 | LCD_Write_DATA(y2); 12 | LCD_Write_COM(0x2c); 13 | break; 14 | -------------------------------------------------------------------------------- /version.txt: -------------------------------------------------------------------------------- 1 | Version: 2 | 1.0 12 Feb 2012 - initial release 3 | 1.1 09 Apr 2012 - added support for more display modules 4 | added support for String objects to print() 5 | fixed a bug in printNumF() 6 | added optional minimum length and filler character to pintNumI() and printNumF() 7 | added option to disable unneeded controller chip code to minimize memory use 8 | 1.2 14 Apr 2012 - added support for more display modules 9 | added getDisplayXSize() and getDisplayYSize() 10 | 1.3 03 Jun 2012 - added support for more display modules 11 | fixed a bug in the ITDB02-25H init 12 | 2.0 21 Jan 2013 - added support for Arduino Due and Arduino Leonardo 13 | added support for the "AquaLEDSource All in One Super Screw Shield" on chipKit Max32 14 | added support for more display modules 15 | fixed a bug in printNumF() 16 | optimized drawLine() 17 | optimized 16bit data transfer 18 | optimized some 8bit data transfer 19 | added option to use pre-defined RGB565 values with setColor(), setBackColor() and fillScr() 20 | added functions getColor(), getBackColor(), getFont(), getFontXsize() and getFontYsize() 21 | added 16 VGA standard colors as pre-defined color literal 22 | rearranged the manual to keep related functions grouped together 23 | 2.01 05 Feb 2013 - fixed a bug that only shows up on linux-based systems 24 | 2.1 29 Mar 2013 - added support for Electronics Lees 3.2" display shield Rev B on Arduinos 25 | fixed a bug that only shows up on some linux-based systems 26 | added built-in support for using display shields designed for Arduino Uno on Arduino Mega 27 | changed license to CC BY-NC-SA 3.0 28 | 2.2 01 May 2013 - added support for ElecFreaks TFT01-5.0 and TFT01-7.0 29 | added support for chipKit uC32 30 | restructured files slightly 31 | 2.3 08 May 2013 - added support for transparent text background 32 | fixed a bug in printNumF() 33 | 2.4 11 May 2013 - added basic support for multiple display modules from Coldtears 34 | 2.41 12 May 2013 - made some changes to facilitate the use of add-on libraries 35 | 2.42 17 Jun 2013 - fixed a small bug in drawBitmap() 36 | fixed a bug in the 16-bit Arduino Due driver 37 | 2.5 25 Jul 2013 - fixed a bug where some lines were 1 pixel too short 38 | fixed a bug in the init code for 7" modules that were only visible in portrait mode 39 | added basic support for more display modules from Coldtears 40 | updated ImageConverter565 to v2.0 41 | added ImgConv v1.0 - Command line image converter 42 | added manual for image converters 43 | fixed some omissions in memorysaver.h 44 | 2.51 02 Aug 2013 - updated ImageConverter565 to v2.1 45 | fixed a typo in the tools manual name 46 | 2.6 07 Sep 2013 - added support for 4 more ElecFreaks display modules 47 | added support for Watterott electronics MI0283QT-9A display module 48 | fixed a bug in the "Arduino (ARM)/UTFT_Demo_480x272" example 49 | 2.7 03 Nov 2013 - added support Bobuino (ATmega1284P) 50 | optimized Arduino Due driver slightly 51 | 2.71 06 Dec 2013 - added support for ElecFreaks TFT01-4.3 52 | added support for Coldtears 3.5" and 4.0" modules 53 | minor changes to the library constructor 54 | removed unused variables 55 | 2.72 12 Dec 2013 - added support for ElecFreaks TFT-2.4 v1.2 56 | 2.73 16 Feb 2014 - added support for Teensy 3.x Boards 57 | added support for three display modules from ElecHouse 58 | minor bugfixes 59 | added three new functions for CPLD-based displays 60 | 2.74 20 Feb 2014 - fixed a bug in the serial driver 61 | 2.75 28 Mar 2014 - added support for Coldtears 5" and 7" CPLD modules 62 | 2.76 04 May 2014 - added support for several display modules from DisplayModule 63 | 2.77 24 May 2014 - fixed a bug with the ElecHouse 7" display and shield combination 64 | 2.77a 20 June 2014 - mod by NIC, add ili9327 8-bit mode, test colour bar 65 | 2.78 08 Sep 2014 - fixed compatibility-issues with Arduino 1.5.7 66 | 67 | --------------------------------------------------------------------------------