moved file layout for Arduino library style

This commit is contained in:
prenticedavid
2017-01-11 13:31:49 +00:00
parent cebc3184e5
commit 653d50102c
14 changed files with 926 additions and 13 deletions

BIN
extras/bitmaps/miniwoof.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
extras/bitmaps/test.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

BIN
extras/bitmaps/woof.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

View File

@@ -0,0 +1,103 @@
CHANGE HISTORY:
Will Never Happen:
R61520 vert scroll is not possible
ST7781 vert scroll is not implemented
ILI9320, 9325, ... can never vert scroll sub-window
To Be Fixed:
GLUE Demo seems ok now
v2.9: posted 05 May 2016
MCUFRIEND_kbv.cpp:
Added pushCommand() method to send block of 8-bit SRAM data to MIPI controller
SSD1963 fixed aspects.
Added ILI9302
Added ILI9338
Added R61520
ILI9327 defaults to shifted band in REV modes. #define OFFSET_9327
Conditional S6D0139. #define SUPPORT_0139 Untested
Conditional HX8347-A. #define SUPPORT_8347A Untested
Conditional HX8347-I. #define SUPPORT_8347D
Conditional SSD1289. #define SUPPORT_1289
UTFTGLUE.h:
implement drawBitmap() method. (no rotations)
LCD_ID_readreg.ino:
write(0xB0, 0x00) after hardware Reset to read manufacturer locations.
added some extra registers.
v2.8: posted 26 February 2016
MCUFRIEND_kbv.cpp: LANDSCAPE is now 90 degrees instead of 270 degrees
methods branch on MIPI / 9320 style
Added SPFD5408
Added R61505W Untested
Added HX8347-A Untested
Added SSD1963 Untested
graphictest_kbv.ino: smaller buffer for Software Scroll. Just fits in Uno Flash
TouchScreen_Calibr_kbv: wait for consistent Touch
LCD_ID_readreg: Added some more registers
v2.7: posted ........ NOT YET
v2.6: posted ........ NOT YET
MCUFRIEND_kbv.cpp:
Added R65105V
v2.5: posted 11 January 2016
MCUFRIEND_kbv.cpp:
Added ST7789V
Added RM68090
Added ILI9481
Added pushColors() from Flash
Improved downward Vertical Scroll. API is changed.
ILI9327 should work in all aspects. vertical scroll in PORT/LAND_REV
S6D0154 should vertical scroll a subwindow
graphictest_kbv.ino: smooth colour gradation on rounded rectangle tests on bigger displays
added colour grading range.
added vertical scroll down
improve messages
graphictest_slim.ino: reduced-fat version of graphictest_kbv.ino
testcard_kbv.ino: drawn version of common BMP photo.
scroll_kbv.ino: changed vertScroll() call for new API
UTFTGLUE.h: improve calculate width and height of rectangles from coordinates.
v2.4: posted 10 December 2015
MCUFRIEND_kbv.cpp: LGDP4535 initialisation table fixed - UNTESTED
v2.3: posted 8 December 2015
MCUFRIEND_kbv.cpp: added S6D0139 UNTESTED
detect EXTC=0 ILI9341 shield from DX with ID == 0x0000. drive in RGB mode
ILI9327 should Vertical Scroll now. UNTESTED
UTFTGLUE.h: extra print(const char*) method to avoid warning messages
graphictest_kbv.ino: software scroll a smaller block at top of screen
GLUE_Demo_320x240: removed unnecessary "include Adafruit_TFTLCD.h"
aspect_kbv.ino: invert display when in different aspects
readpixel_kbv.ino: support smaller geometries
LCD_ID_readreg.ino: report some more regs
TouchScreen_Calibr_kbv: for resistive Touch screens like on Mcufriend shields
UTouch_Calibr_kbv: can use UTouch.h library for hardware Touch Controllers (and UTFT)
v2.2: posted 15 November 2015
MCUFRIEND_kbv.cpp: changed readGRAM() for ILI9327, ILI9486,
added REV_SCREEN flag to _lcd_capable
implement invertDisplay()
added LGDP4535
ILI9327: set Partial Area to 0, 399
MCUFRIEND_kbv.h: USE_GFX_KBV default argument: println(char *s="")
MCUFRIEND_shield.h: regular Uno shield drivers for Uno, Mega, Leonardo, Due, Zero
MCUFRIEND_special.h: experimental drivers
UTFTGLUE.h: identity kludges for non-UNO shields
LCD_ID_readreg.ino: report reg(0x09)
v2.1: posted 9 November 2015
MCUFRIEND_kbv.cpp: return 0x9327 / 0x9481 in readID()
MCUFRIEND_shield.h: increase low pulse width in RD_STROBE
EXAMPLES/: add scroll_kbv.ino sketch
edit readpixel_kbv_ino, aspect_kbv.ino
v2.0: posted 8 November 2015
Massive changes from v1.0

View File

@@ -0,0 +1,88 @@
1. Install "Adafruit_GFX.h" library from GitHub into your User libraries folder if not already there.
2. Unzip the attached "MCUFRIEND_kbv.zip" into your User libraries folder.
3. Insert your Mcufriend style display shield into UNO. Only 28-pin shields are supported.
4. Start your Arduino IDE.
5. Build any of the Examples from the File->Examples->Mcufriend_kbv menu.
Most of them will write some text to the Serial window (9600 baud). The BMP examples require you to copy the pictures from the bitmaps/ folder to your microSD (root directory)
6. This library is only intended for UNO and these specific Shields. It will work on a MEGA2560 but not very fast.
7. The constructor takes no arguments (because it only works with these shields)
8. The examples are the standard Adafruit ones. You can see my edits by searching for "kbv"
9. Any Adafruit sketch should work with the MCUFRIEND_kbv constructor() but should allow extra ID values
An Adafruit constructor(cs, rs, wr, rd, rst) IGNORES any arguments. i.e. it only uses the shield control pins
10. It currently supports UNO shields with "mcufriend.com" pcbs with controllers:
HX8347-A 240x320 ID=0x8347 #define SUPPORT_8347A *** Untested ***
HX8347-D 240x320 ID=0x4747 #define SUPPORT_8347D
HX8347-G 240x320 ID=0x7575 #define SUPPORT_8347D
HX8347-I 240x320 ID=0x9595 #define SUPPORT_8347D
HX8352-A 240x400 ID=0x5252 #define SUPPORT_8352A
HX8357-D 320x480 ID=0x8357
ILI9302 240x320 ID=0x9302
ILI9320 240x320 ID=0x9320
ILI9325 240x320 ID=0x9325
ILI9326 240x400 ID=0x9326 #define SUPPORT_9326_5420
ILI9327 240x400 ID=0x9327
ILI9328 240x320 ID=0x9328
ILI9329 240x320 ID=0x9329
ILI9331 240x320 ID=0x9331
ILI9335 240x320 ID=0x9335
ILI9338 240x320 ID=0x9338
ILI9341 240x320 ID=0x9341
ILI9481 320x480 ID=0x9481
ILI9486 320x480 ID=0x9486
ILI9488 320x480 ID=0x9488
LGDP4532 240x320 ID=0x4532 #define SUPPORT_4532
LGDP4535 240x320 ID=0x4535 #define SUPPORT_4535
R61505V 240x320 ID=0xB505
R61505W 240x320 ID=0xC505
R61509V 240x400 ID=0xB509 #define SUPPORT_B509_7793
R61520 240x320 ID=0x1520
R61526A 240x320 ID=0x1526
R61581 320x480 ID=0x1581
RM68090 240x320 ID=0x6809
RM68140 320x480 ID=0x6814 #define SUPPORT_68140
S6D0139 240x320 ID=0x0139 #define SUPPORT_0139 *** Untested ***
S6D0154 240x320 ID=0x0154 #define SUPPORT_0154
SPFD5408 240x320 ID=0x5408
SPFD5420 240x400 ID=0x5420 #define SUPPORT_9326_5420
SSD1963 800x480 ID=0x1963
SSD1289 240x320 ID=0x1289 #define SUPPORT_1289
ST7781 240x320 ID=0x7783 #define SUPPORT_7781
ST7789V 240x320 ID=0x7789
ST7793 240x400 ID=0x7793 #define SUPPORT_B509_7793
ST7796 320x480 ID=0x7796
UNKNOWN 320x480 ID=0x1511
UNKNOWN 240x320 ID=0x1602
UNKNOWN 240x320 ID=0xAC11
Most of these controllers are #define SUPPORT_xxxx by default.
You can save Flash memory on a Uno by commenting out the macro(s).
11. It should run on a UNO, MEGA2560, LEONARDO, DUE, ZERO, M0-PRO,
It also runs on NUCLEO-F103 and TEENSY3.2 with Sparkfun Adapter
12. These Mcufriend-style shields tend to have a resistive TouchScreen on A1, 7, A2, 6 but are not always the same rotation of direction.
Run the diagnose_Touchpins.ino sketch to detect which pins are used
Run the TouchScreen_Calibr_kbv.ino sketch to diagnose your model and then scale the result from TouchScreen.h methods()
The Resistive TouchScreen does not work on the Due. It seems to be upset by sharing pins. I have discovered why.
(You need a new Touch library.)
13. The aspect_kbv.ino sketch should show the 4 different rotations. Please report the results for an ILI9335, ILI9327.
14. The scroll_kbv.ino sketch should scroll a window or subwindow for most chips. Not all chips can scroll.
15. The readpixel_kbv.ino sketch should display memory in each aspect.
16. The GLUE_Demo_320x240.ino sketch uses a "GLUE" class to display a UTFT sketch on supported mcufriend shields.
It is NOT perfect. Please report any problems. It is designed as a CONVENIENCE for legacy UTFT code.
Please use MCUFRIEND_kbv method()s in new code.
CHANGE HISTORY: is now in "mcufriend_history.txt"

View File

@@ -0,0 +1,307 @@
case 0x9341:
_lcd_capable = AUTO_READINC | TWO_PARM_WINDOW | MV_AXIS;
static const uint8_t ILI9341_regValues_kbv[] PROGMEM = { //.kbv MCUFRIEND_kbv
0x01, 0, // software reset
TFTLCD_DELAY, 150, // 5ms if awake, 125ms if asleep.
0xCB, 5, 0x39, 0x2C, 0x00, 0x34, 0x02, //Power Control A [39 2C 00 34 02]
0xCF, 3, 0x00, 0xC1, 0x30, //Power Control B [00 81 30]
0xE8, 3, 0x85, 0x00, 0x78, //Driver Timing A [04 11 7A]
0xEA, 2, 0x00, 0x00, //Driver Timing B [66 00]
0xED, 4, 0x64, 0x03, 0x12, 0x81, //Power On Seq [55 01 23 01]
0xF7, 1, 0x20, //Pump Ratio [10]
0xC0, 1, 0x23, //Power Control 1 [26]
0xC1, 1, 0x10, //Power Control 2 [00]
0xC5, 2, 0x3E, 0x28, //VCOM 1 [31 3C]
0xC7, 1, 0x86, //VCOM 2 [C0]
0x36, 1, 0x48, //Memory Access [00]
0xB1, 2, 0x00, 0x18, //Frame Control [00 1B]
0xB6, 3, 0x08, 0x82, 0x27, //Display Function [0A 82 27 XX]
0xF2, 1, 0x00, //Enable 3G [02]
0x26, 1, 0x01, //Gamma Set [01]
0xE0, 15, 0x0f, 0x31, 0x2b, 0x0c, 0x0e, 0x08, 0x4e, 0xf1, 0x37, 0x07, 0x10, 0x03, 0x0e, 0x09, 0x00,
0xE1, 15, 0x00, 0x0e, 0x14, 0x03, 0x11, 0x07, 0x31, 0xC1, 0x48, 0x08, 0x0f, 0x0c, 0x31, 0x36, 0x0f,
0x11, 0, //Sleep Out
TFTLCD_DELAY, 150,
0x29, 0, //Display On
0x3A, 1, 0x55, //Pixel Format [66]
};
static const uint8_t ILI9341_regValues_2_6[] PROGMEM = { // LG 2.6" from AN
0x01, 0, // software reset
0xCB, 5, 0x39, 0x2C, 0x00, 0x34, 0x02, //Power Control A [39 2C 00 34 02]
0xCF, 3, 0x00, 0xC1, 0x30, //Power Control B [00 81 30]
0xE8, 3, 0x85, 0x00, 0x78, //Driver Timing A [04 11 7A]
0xEA, 2, 0x00, 0x00, //Driver Timing B [66 00]
0xED, 4, 0x64, 0x03, 0x12, 0x81, //Power On Seq [55 01 23 01]
0xF7, 1, 0x20, //Pump Ratio [10]
0xC0, 1, 0x23, //Power Control 1 [26]
0xC1, 1, 0x10, //Power Control 2 [00]
0xC5, 2, 0x2B, 0x2B, //VCOM 1 [31 3C]
0xC7, 1, 0xC0, //VCOM 2 [C0]
0x36, 1, 0x48, //Memory Access [00]
0xB1, 2, 0x00, 0x1B, //Frame Control [00 1B]
// 0xB6, 3, 0x0A, 0x02, 0x27, //Display Function [0A 82 27 XX] .kbv REV=0
0xF2, 1, 0x00, //Enable 3G [02]
0x26, 1, 0x01, //Gamma Set [01]
0xE0, 15, 0x0f, 0x31, 0x2b, 0x0c, 0x0e, 0x08, 0x4e, 0xf1, 0x37, 0x07, 0x10, 0x03, 0x0e, 0x09, 0x00,
0xE1, 15, 0x00, 0x0e, 0x14, 0x03, 0x11, 0x07, 0x31, 0xC1, 0x48, 0x08, 0x0f, 0x0c, 0x31, 0x36, 0x0f,
0x11, 0, //Sleep Out
TFTLCD_DELAY, 150,
0x29, 0, //Display On
0x3A, 1, 0x55, //Pixel Format [66]
};
static const uint8_t ILI9341_regValues_2_0[] PROGMEM = { // BOE 2.0"
0x01, 0, // software reset
0xCF, 3, 0x00, 0x99, 0x30, //Power Control B [00 81 30]
0xED, 4, 0x64, 0x03, 0x12, 0x81, //Power On Seq [55 01 23 01]
0xE8, 3, 0x85, 0x10, 0x78, //Driver Timing A [04 11 7A]
0xCB, 5, 0x39, 0x2C, 0x00, 0x34, 0x02, //Power Control A [39 2C 00 34 02]
0xF7, 1, 0x20, //Pump Ratio [10]
0xEA, 2, 0x00, 0x00, //Driver Timing B [66 00]
0xC0, 1, 0x26, //Power Control 1 [26]
0xC1, 1, 0x12, //Power Control 2 [00]
0xC5, 2, 0x2B, 0x2C, //VCOM 1 [31 3C]
0xC7, 1, 0xC4, //VCOM 2 [C0]
0x36, 1, 0x08, //Memory Access [00]
0xB1, 2, 0x00, 0x1B, //Frame Control [00 1B]
// 0xB6, 3, 0x0A, 0xA2, 0x27, //?? Display Function [0A 82 27 XX] .kbv SS=1
0xF2, 1, 0x00, //Enable 3G [02]
0x26, 1, 0x01, //Gamma Set [01]
0xE0, 15, 0x0f, 0x24, 0x21, 0x0a, 0x0e, 0x09, 0x51, 0xa9, 0x44, 0x07, 0x10, 0x03, 0x2c, 0x0b, 0x00,
0xE1, 15, 0x00, 0x1b, 0x1e, 0x05, 0x11, 0x06, 0x2e, 0x56, 0x3b, 0x08, 0x0f, 0x0c, 0x13, 0x14, 0x0f,
0x11, 0, //Sleep Out
TFTLCD_DELAY, 150,
0x29, 0, //Display On
0x3A, 1, 0x55, //Pixel Format [66]
};
static const uint8_t ILI9341_regValues_2_4[] PROGMEM = { // BOE 2.4"
0x01, 0, // software reset
TFTLCD_DELAY, 50, // .kbv
0xCF, 3, 0x00, 0x81, 0x30, //Power Control B [00 81 30]
0xED, 4, 0x64, 0x03, 0x12, 0x81, //Power On Seq [55 01 23 01]
0xE8, 3, 0x85, 0x10, 0x78, //Driver Timing A [04 11 7A]
0xCB, 5, 0x39, 0x2C, 0x00, 0x34, 0x02, //Power Control A [39 2C 00 34 02]
0xF7, 1, 0x20, //Pump Ratio [10]
0xEA, 2, 0x00, 0x00, //Driver Timing B [66 00]
0xB1, 2, 0x00, 0x1B, //Frame Control [00 1B]
// 0xB6, 2, 0x0A, 0xA2, 0x27, //Display Function [0A 82 27 XX] .kbv SS=1
0xC0, 1, 0x21, //Power Control 1 [26]
0xC1, 1, 0x11, //Power Control 2 [00]
0xC5, 2, 0x3F, 0x3C, //VCOM 1 [31 3C]
0xC7, 1, 0xB5, //VCOM 2 [C0]
0x36, 1, 0x48, //Memory Access [00]
0xF2, 1, 0x00, //Enable 3G [02]
0x26, 1, 0x01, //Gamma Set [01]
0xE0, 15, 0x0f, 0x26, 0x24, 0x0b, 0x0e, 0x09, 0x54, 0xa8, 0x46, 0x0c, 0x17, 0x09, 0x0f, 0x07, 0x00,
0xE1, 15, 0x00, 0x19, 0x1b, 0x04, 0x10, 0x07, 0x2a, 0x47, 0x39, 0x03, 0x06, 0x06, 0x30, 0x38, 0x0f,
0x11, 0, //Sleep Out
TFTLCD_DELAY, 150,
0x29, 0, //Display On
0x3A, 1, 0x55, //Pixel Format [66]
};
static const uint8_t ILI9341_regValues_ada[] PROGMEM = { // Adafruit_TFTLCD only works with EXTC=0
0x01, 0, // software reset
TFTLCD_DELAY, 50,
0x28, 0, //Display Off
0xC0, 1, 0x23, //Power Control 1 [26]
0xC1, 1, 0x10, //Power Control 2 [00]
0xC5, 2, 0x2B, 0x2B, //VCOM 1 [31 3C]
0xC7, 1, 0xC0, //VCOM 2 [C0]
0x36, 1, 0x88, //Memory Access [00]
0xB1, 2, 0x00, 0x1B, //Frame Control [00 1B]
0xB7, 1, 0x07, //Entry Mode [00]
0x11, 0, //Sleep Out
TFTLCD_DELAY, 150,
0x29, 0, //Display On
0x3A, 1, 0x55, //Pixel Format [66]
};
static const uint8_t ILI9341_regValues_ada9341[] PROGMEM = { // Adafruit_ILI9341
0xEF, 3, 0x03, 0x80, 0x02, //
0xCF, 3, 0x00, 0xC1, 0x30, //Power Control B [00 81 30]
0xED, 4, 0x64, 0x03, 0x12, 0x81, //Power On Seq [55 01 23 01]
0xE8, 3, 0x85, 0x00, 0x78, //Driver Timing A [04 11 7A]
0xCB, 5, 0x39, 0x2C, 0x00, 0x34, 0x02, //Power Control A [39 2C 00 34 02]
0xF7, 1, 0x20, //Pump Ratio [10]
0xEA, 2, 0x00, 0x00, //Driver Timing B [66 00]
0xC0, 1, 0x23, //Power Control 1 [26]
0xC1, 1, 0x11, //Power Control 2 [00]
0xC5, 2, 0x3E, 0x28, //VCOM 1 [31 3C]
0xC7, 1, 0x86, //VCOM 2 [C0]
0x36, 1, 0x48, //Memory Access [00]
0xB1, 2, 0x00, 0x18, //Frame Control [00 1B]
0xB6, 3, 0x0A, 0x82, 0x27, //?? Display Function [0A 82 27 XX]
0xF2, 1, 0x00, //Enable 3G [02]
0x26, 1, 0x01, //Gamma Set [01]
0xE0, 15, 0x0f, 0x31, 0x2b, 0x0c, 0x0e, 0x08, 0x4e, 0xf1, 0x37, 0x07, 0x10, 0x03, 0x0e, 0x09, 0x00,
0xE1, 15, 0x00, 0x0e, 0x14, 0x03, 0x11, 0x07, 0x31, 0xC1, 0x48, 0x08, 0x0f, 0x0c, 0x31, 0x36, 0x0f,
0x11, 0, //Sleep Out
TFTLCD_DELAY, 150,
0x29, 0, //Display On
0x3A, 1, 0x55, //Pixel Format [66]
};
// init_table(ILI9341_regValues_kbv, sizeof(ILI9341_regValues_kbv)); //ok for me
// init_table(ILI9341_regValues_2_0, sizeof(ILI9341_regValues_2_0)); //wrong direction
init_table(ILI9341_regValues_2_4, sizeof(ILI9341_regValues_2_4)); //wrong direction
// init_table(ILI9341_regValues_2_6, sizeof(ILI9341_regValues_2_6)); //inverted
// init_table(ILI9341_regValues_ada, sizeof(ILI9341_regValues_ada)); //white screen
// init_table(ILI9341_regValues_ada9341, sizeof(ILI9341_regValues_ada9341)); //ok for me
break;
case 0x9486:
_lcd_capable = AUTO_READINC | TWO_PARM_WINDOW | MV_AXIS;
static const uint8_t ILI9486_regValues[] PROGMEM = {
0x01, 0, //Soft Reset
0x28, 0, //Display Off
0xC0, 2, 0x0d, 0x0d, //Power Control 1 [0x0E0E]
0xC1, 2, 0x43, 0x00, //Power Control 2 [0x4300]
0xC2, 1, 0x00, //Power Control 3
0xC5, 4, 0x00, 0x48, 0x00, 0x48, //VCOM Control 1 [0x00400040]
0xB6, 3, 0x00, 0x22, 0x3B, // Display Function Control .kbv SS=1
// 0xE0,15, 0x0f,0x31,0x2b,0x0c,0x0e,0x08,0x4e,0xf1,0x37,0x07,0x10,0x03,0x0e,0x09,0x00,
// 0xE1,15, 0x00,0x0e,0x14,0x03,0x11,0x07,0x31,0xC1,0x48,0x08,0x0f,0x0c,0x31,0x36,0x0f,
0x20, 0, // Display Inversion OFF
0x36, 1, 0x0A, //Memory Access
0x3A, 1, 0x55, //Interlace Pixel
// 0x21, 0, //Invert display !!!
0x11, 0, //Sleep Out
TFTLCD_DELAY, 50,
0x29, 0, //Display On
};
init_table(ILI9486_regValues, sizeof(ILI9486_regValues));
p16 = (int16_t *) & HEIGHT;
*p16 = 480;
p16 = (int16_t *) & WIDTH;
*p16 = 320;
break;
case 0x9488:
_lcd_capable = AUTO_READINC | TWO_PARM_WINDOW | MV_AXIS;
static const uint8_t ILI9488_regValues[] PROGMEM = {
0x01, 0, //Soft Reset
0x28, 0, //Display Off
0xC0, 2, 0x0E, 0x0E, //Power Control 1 [0E 0E]
0xC1, 1, 0x43, //Power Control 2 [43]
0xC5, 4, 0x00, 0x22, 0x80, 0x40, //VCOM Control 1 [00 40 00 40]
0x36, 1, 0x08, //Memory Access [00]
0x3A, 1, 0x55, //Interlace Pixel [XX]
0xB1, 2, 0xB0, 0x11, //Frame Rate Control [B0 11]
0xB6, 3, 0x02, 0x02, 0x3B, //Display Function [02 02 3B] .kbv SS=0
0x11, 0, //Sleep Out
TFTLCD_DELAY, 150,
0x29, 0, //Display On
// 0x2C, 0,
};
static const uint8_t ILI9488_regValues_max[] PROGMEM = { // Atmel MaxTouch
0x01, 0, //Soft Reset
TFTLCD_DELAY, 50,
0x28, 0, //Display Off
0xC0, 2, 0x10, 0x10, //Power Control 1 [0E 0E]
0xC1, 1, 0x41, //Power Control 2 [43]
0xC5, 4, 0x00, 0x22, 0x80, 0x40, //VCOM Control 1 [00 40 00 40]
0x36, 1, 0x68, //Memory Access [00]
0xB0, 1, 0x00, //Interface [00]
0xB1, 2, 0xB0, 0x11, //Frame Rate Control [B0 11]
0xB4, 1, 0x02, //Inversion Control [02]
0xB7, 1, 0xC6, //Entry Mode [06]
0x3A, 1, 0x55, //Interlace Pixel Format [XX]
0xF7, 4, 0xA9, 0x51, 0x2C, 0x82, //Adjustment Control 3 [A9 51 2C 82]
0x11, 0, //Sleep Out
TFTLCD_DELAY, 150,
0x29, 0, //Display On
};
// init_table(ILI9488_regValues, sizeof(ILI9488_regValues));
init_table(ILI9488_regValues_max, sizeof(ILI9488_regValues_max));
p16 = (int16_t *) & HEIGHT;
*p16 = 480;
p16 = (int16_t *) & WIDTH;
*p16 = 320;
break;
// ###################################################################################
case 0x7789:
case 0x8552:
_lcd_capable = AUTO_READINC | TWO_PARM_WINDOW | MV_AXIS;
static const uint8_t ST7789_regValues[] PROGMEM = {
(0x0011); //exit SLEEP mode
TFTLCD_DELAY, 10,
(0x0036), 1, 0x80, //MADCTL: memory data access control
(0x003A), 1, 0x66, //COLMOD: Interface Pixel format *** I use 262K-colors in 18bit/pixel format when using 8-bit interface to allow 3-bytes per pixel
// (0x003A), 1, 0x0055, //COLMOD: Interface Pixel format *** I use 65K-colors in 16bit/pixel (5-6-5) format when using 16-bit interface to allow 1-byte per pixel
(0x00B2), 5, 0x0C, 0x0C, 0x00, 0x33, 0x33, //PORCTRK: Porch setting
(0x00B7), 1, 0x35, //GCTRL: Gate Control
(0x00BB), 1, 0x2B, //VCOMS: VCOM setting
(0x00C0), 1, 0x2C, //LCMCTRL: LCM Control
(0x00C2), 2, 0x01, 0xFF, //VDVVRHEN: VDV and VRH Command Enable
(0x00C3), 1, 0x11, //VRHS: VRH Set
(0x00C4), 1, 0x20, //VDVS: VDV Set
(0x00C6), 1, 0x0F, //FRCTRL2: Frame Rate control in normal mode
(0x00D0), 2, 0xA4, 0xA1, //PWCTRL1: Power Control 1
(0x00E0), 14, 0xD0, 0x00, 0x05, 0x0E, 0x15, 0x0D, 0x37, 0x43, 0x47, 0x09, 0x15, 0x12, 0x16, 0x19, //PVGAMCTRL: Positive Voltage Gamma control
(0x00E1), 14, 0xD0, 0x00, 0x05, 0x0D, 0x0C, 0x06, 0x2D, 0x44, 0x40, 0x0E, 0x1C, 0x18, 0x16, 0x19, //NVGAMCTRL: Negative Voltage Gamma control
(0x002A), 4, 0x00, 0x00, 0x00, 0xEF, //X address set
(0x002B), 4, 0x00, 0x00, 0x01, 0x3F, //Y address set
TFTLCD_DELAY, 10,
};
init_table(ST7789_regValues, sizeof(ST7789_regValues)); //
break;
// ####################################################################################
static const uint16_t ILI9225_regValues[] PROGMEM = {
/* Start Initial Sequence */
/* Set SS bit and direction output from S528 to S1 */
ILI9225_POWER_CTRL1, 0x0000, // Set SAP,DSTB,STB
ILI9225_POWER_CTRL2, 0x0000, // Set APON,PON,AON,VCI1EN,VC
ILI9225_POWER_CTRL3, 0x0000, // Set BT,DC1,DC2,DC3
ILI9225_POWER_CTRL4, 0x0000, // Set GVDD
ILI9225_POWER_CTRL5, 0x0000, // Set VCOMH/VCOML voltage
TFTLCD_DELAY, 40,
// Power-on sequence
ILI9225_POWER_CTRL2, 0x0018, // Set APON,PON,AON,VCI1EN,VC
ILI9225_POWER_CTRL3, 0x6121, // Set BT,DC1,DC2,DC3
ILI9225_POWER_CTRL4, 0x006F, // Set GVDD /*007F 0088 */
ILI9225_POWER_CTRL5, 0x495F, // Set VCOMH/VCOML voltage
ILI9225_POWER_CTRL1, 0x0800, // Set SAP,DSTB,STB
TFTLCD_DELAY, 10,
ILI9225_POWER_CTRL2, 0x103B, // Set APON,PON,AON,VCI1EN,VC
TFTLCD_DELAY, 50,
ILI9225_DRIVER_OUTPUT_CTRL, 0x011C, // set the display line number and display direction
ILI9225_LCD_AC_DRIVING_CTRL, 0x0100, // set 1 line inversion
ILI9225_ENTRY_MODE, 0x1030, // set GRAM write direction and BGR=1.
ILI9225_DISP_CTRL1, 0x0000, // Display off
ILI9225_BLANK_PERIOD_CTRL1, 0x0808, // set the back porch and front porch
ILI9225_FRAME_CYCLE_CTRL, 0x1100, // set the clocks number per line
ILI9225_INTERFACE_CTRL, 0x0000, // CPU interface
ILI9225_OSC_CTRL, 0x0D01, // Set Osc /*0e01*/
ILI9225_VCI_RECYCLING, 0x0020, // Set VCI recycling
ILI9225_RAM_ADDR_SET1, 0x0000, // RAM Address
ILI9225_RAM_ADDR_SET2, 0x0000, // RAM Address
/* Set GRAM area */
ILI9225_GATE_SCAN_CTRL, 0x0000,
ILI9225_VERTICAL_SCROLL_CTRL1, 0x00DB,
ILI9225_VERTICAL_SCROLL_CTRL2, 0x0000,
ILI9225_VERTICAL_SCROLL_CTRL3, 0x0000,
ILI9225_PARTIAL_DRIVING_POS1, 0x00DB,
ILI9225_PARTIAL_DRIVING_POS2, 0x0000,
ILI9225_HORIZONTAL_WINDOW_ADDR1, 0x00AF,
ILI9225_HORIZONTAL_WINDOW_ADDR2, 0x0000,
ILI9225_VERTICAL_WINDOW_ADDR1, 0x00DB,
ILI9225_VERTICAL_WINDOW_ADDR2, 0x0000,
/* Set GAMMA curve */
ILI9225_GAMMA_CTRL1, 0x0000,
ILI9225_GAMMA_CTRL2, 0x0808,
ILI9225_GAMMA_CTRL3, 0x080A,
ILI9225_GAMMA_CTRL4, 0x000A,
ILI9225_GAMMA_CTRL5, 0x0A08,
ILI9225_GAMMA_CTRL6, 0x0808,
ILI9225_GAMMA_CTRL7, 0x0000,
ILI9225_GAMMA_CTRL8, 0x0A00,
ILI9225_GAMMA_CTRL9, 0x0710,
ILI9225_GAMMA_CTRL10, 0x0710,
ILI9225_DISP_CTRL1, 0x0012,
TFTLCD_DELAY, 50,
ILI9225_DISP_CTRL1, 0x1017,
};

View File

@@ -0,0 +1,77 @@
#elif defined(__SAM3X8E__) && defined(USE_MEGA_16BIT_SHIELD) //regular CTE shield on DUE
#warning USE_MEGA_16BIT_SHIELD
// configure macros for the control pins
#define RD_PORT PIOA
#define RD_PIN 20 //D43
#define WR_PORT PIOC
#define WR_PIN 7 //D39
#define CD_PORT PIOC
#define CD_PIN 6 //D38
#define CS_PORT PIOC
#define CS_PIN 8 //D40
#define RESET_PORT PIOC
#define RESET_PIN 9 //D41
// configure macros for data bus
//
#define AMASK ((1<<7)|(3<<14)) //PA7, PA14-PA15
#define BMASK (1<<26) //PB26
#define CMASK (31<<1) //PC1-PC5
#define DMASK ((15<<0)|(1<<6)|(3<<9)) //PD0-PD3, PD6, PD9-PD10
#define write_16(x) { PIOA->PIO_CODR = AMASK; PIOB->PIO_CODR = BMASK; PIOC->PIO_CODR = CMASK; PIOD->PIO_CODR = DMASK; \
PIOA->PIO_SODR = (((x)&(1<<6))<<1)|(((x)&(3<<9))<<5); \
PIOB->PIO_SODR = (((x)&(1<<8))<<18); \
PIOC->PIO_SODR = (((x)&(1<<0))<<5); \
PIOC->PIO_SODR = (((x)&(1<<1))<<3); \
PIOC->PIO_SODR = (((x)&(1<<2))<<1); \
PIOC->PIO_SODR = (((x)&(1<<3))>>1); \
PIOC->PIO_SODR = (((x)&(1<<4))>>3); \
PIOD->PIO_SODR = (((x)&(1<<7))<<2)|(((x)&(1<<5))<<5)|(((x)&(15<<11))>>11)|(((x)&(1<<15))>>9); \
}
/*
#define write_16(VL) { PIOA->PIO_CODR = AMASK; PIOB->PIO_CODR = BMASK; PIOC->PIO_CODR = CMASK; PIOD->PIO_CODR = DMASK; \
REG_PIOA_SODR=(((((VL)>>8) & 0x06)<<13) | ((VL & 0x40)<<1);\
(((VL)>>8) & 0x01) ? REG_PIOB_SODR = 0x4000000 : REG_PIOB_CODR = 0x4000000;\
REG_PIOC_SODR=((VL & 0x01)<<5) | ((VL & 0x02)<<3) | ((VL & 0x04)<<1) | ((VL & 0x08)>>1) | ((VL & 0x10)>>3);\
REG_PIOD_SODR=((((VL)>>8) & 0x78)>>3) | ((((VL)>>8) & 0x80)>>1) | ((VL & 0x20)<<5) | ((VL & 0x80)<<2);\
}
*/
#define read_16() ( 0\
|((PIOC->PIO_PDSR & (1<<5))>>5)\
|((PIOC->PIO_PDSR & (1<<4))>>3)\
|((PIOC->PIO_PDSR & (1<<3))>>1)\
|((PIOC->PIO_PDSR & (1<<2))<<1)\
|((PIOC->PIO_PDSR & (1<<1))<<3)\
|((PIOD->PIO_PDSR & (1<<10))>>5)\
|((PIOA->PIO_PDSR & (1<<7))>>1)\
|((PIOD->PIO_PDSR & (1<<9))>>2)\
|((PIOB->PIO_PDSR & (1<<26))>>18)\
|((PIOA->PIO_PDSR & (3<<14))>>5)\
|((PIOD->PIO_PDSR & (15<<0))<<11)\
|((PIOD->PIO_PDSR & (1<<6))<<9)\
)
#define read_8() (read_16() & 0xFF)
#define setWriteDir() {\
PIOA->PIO_OER = AMASK; PIOA->PIO_PER = AMASK; \
PIOB->PIO_OER = BMASK; PIOB->PIO_PER = BMASK; \
PIOC->PIO_OER = CMASK; PIOC->PIO_PER = CMASK; \
PIOD->PIO_OER = DMASK; PIOD->PIO_PER = DMASK; \
}
#define setReadDir() { \
PMC->PMC_PCER0 = (1 << ID_PIOA)|(1 << ID_PIOB)|(1 << ID_PIOC)|(1 << ID_PIOD); \
PIOA->PIO_ODR = AMASK; \
PIOB->PIO_ODR = BMASK; \
PIOC->PIO_ODR = CMASK; \
PIOD->PIO_ODR = DMASK; \
}
#define write8(x) { write16(x & 0xFF); }
#define write16(x) { write_16(x); WR_ACTIVE; WR_STROBE; WR_IDLE; WR_IDLE; }
#define READ_16(dst) { RD_STROBE; RD_ACTIVE; RD_ACTIVE; RD_ACTIVE; RD_ACTIVE; dst = read_16(); RD_IDLE; RD_IDLE; RD_IDLE; }
#define READ_8(dst) { READ_16(dst); dst &= 0xFF; }
// Shield Control macros.
#define PIN_LOW(port, pin) (port)->PIO_CODR = (1<<(pin))
#define PIN_HIGH(port, pin) (port)->PIO_SODR = (1<<(pin))
#define PIN_OUTPUT(port, pin) (port)->PIO_OER = (1<<(pin))