|
@@ -242,6 +242,7 @@ void (*setWindow)(u8g_t *u8g, u8g_dev_t *dev, uint16_t Xmin, uint16_t Ymin, uint
|
242
|
242
|
}
|
243
|
243
|
}
|
244
|
244
|
#define WRITE_ESC_SEQUENCE(V) writeEscSequence(V)
|
|
245
|
+ #define WRITE_ESC_SEQUENCE16(V) writeEscSequence(V)
|
245
|
246
|
#else
|
246
|
247
|
void writeEscSequence8(u8g_t *u8g, u8g_dev_t *dev, const uint16_t *sequence) {
|
247
|
248
|
uint16_t data;
|
|
@@ -289,6 +290,8 @@ void (*setWindow)(u8g_t *u8g, u8g_dev_t *dev, uint16_t Xmin, uint16_t Ymin, uint
|
289
|
290
|
}
|
290
|
291
|
u8g_SetAddress(u8g, dev, 1);
|
291
|
292
|
}
|
|
293
|
+
|
|
294
|
+ #define WRITE_ESC_SEQUENCE16(V) writeEscSequence16(u8g, dev, V)
|
292
|
295
|
#endif
|
293
|
296
|
|
294
|
297
|
static const uint16_t st7789v_init[] = {
|
|
@@ -378,7 +381,28 @@ static const uint16_t ili9341_init[] = {
|
378
|
381
|
ESC_END
|
379
|
382
|
};
|
380
|
383
|
|
381
|
|
-static const uint16_t st9677_init[] = {
|
|
384
|
+static const uint16_t ili9488_init[] = {
|
|
385
|
+ ESC_REG(0x00E0), 0x0000, 0x0007, 0x000F, 0x000D, 0x001B, 0x000A, 0x003C, 0x0078, 0x004A, 0x0007, 0x000E, 0x0009, 0x001B, 0x001E, 0x000F,
|
|
386
|
+ ESC_REG(0x00E1), 0x0000, 0x0022, 0x0024, 0x0006, 0x0012, 0x0007, 0x0036, 0x0047, 0x0047, 0x0006, 0x000A, 0x0007, 0x0030, 0x0037, 0x000F,
|
|
387
|
+ ESC_REG(0x00C0), 0x0010, 0x0010,
|
|
388
|
+ ESC_REG(0x00C1), 0x0041,
|
|
389
|
+ ESC_REG(0x00C5), 0x0000, 0x0022, 0x0080,
|
|
390
|
+ ESC_REG(0x0036), TERN(GRAPHICAL_TFT_ROTATE_180, 0x00A8, 0x0068),
|
|
391
|
+ ESC_REG(0x003A), 0x0055,
|
|
392
|
+ ESC_REG(0x00B0), 0x0000,
|
|
393
|
+ ESC_REG(0x00B1), 0x00B0, 0x0011,
|
|
394
|
+ ESC_REG(0x00B4), 0x0002,
|
|
395
|
+ ESC_REG(0x00B6), 0x0002, 0x0042,
|
|
396
|
+ ESC_REG(0x00B7), 0x00C6,
|
|
397
|
+ ESC_REG(0x00E9), 0x0000,
|
|
398
|
+ ESC_REG(0x00F0), 0x00A9, 0x0051, 0x002C, 0x0082,
|
|
399
|
+ ESC_REG(0x0029),
|
|
400
|
+ ESC_REG(0x0011),
|
|
401
|
+ ESC_DELAY(100),
|
|
402
|
+ ESC_END
|
|
403
|
+};
|
|
404
|
+
|
|
405
|
+static const uint16_t st7796_init[] = {
|
382
|
406
|
ESC_REG(0x0010), ESC_DELAY(120),
|
383
|
407
|
ESC_REG(0x0001), ESC_DELAY(120),
|
384
|
408
|
ESC_REG(0x0011), ESC_DELAY(120),
|
|
@@ -588,8 +612,8 @@ static const uint16_t st9677_init[] = {
|
588
|
612
|
|
589
|
613
|
LCD_IO_WriteSequence(buffer, length * sq(FSMC_UPSCALE));
|
590
|
614
|
#else
|
591
|
|
- u8g_WriteSequence(u8g, dev, k << 1, (uint8_t*)buffer);
|
592
|
|
- u8g_WriteSequence(u8g, dev, k << 1, (uint8_t*)buffer);
|
|
615
|
+ for (uint8_t i = FSMC_UPSCALE; i--;)
|
|
616
|
+ u8g_WriteSequence(u8g, dev, k << 1, (uint8_t*)buffer);
|
593
|
617
|
#endif
|
594
|
618
|
}
|
595
|
619
|
}
|
|
@@ -617,7 +641,7 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
|
617
|
641
|
uint16_t* buffer = &bufferA[0];
|
618
|
642
|
bool allow_async = DISABLED(SPI_GRAPHICAL_TFT);
|
619
|
643
|
#else
|
620
|
|
- uint16_t buffer[WIDTH*2]; // 16-bit RGB 565 pixel line buffer
|
|
644
|
+ uint16_t buffer[WIDTH * FSMC_UPSCALE]; // 16-bit RGB 565 pixel line buffer
|
621
|
645
|
#endif
|
622
|
646
|
|
623
|
647
|
switch (msg) {
|
|
@@ -630,18 +654,21 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
|
630
|
654
|
setWindow = setWindow_st7789v;
|
631
|
655
|
break;
|
632
|
656
|
case 0x9328: // ILI9328
|
633
|
|
- WRITE_ESC_SEQUENCE(ili9328_init);
|
|
657
|
+ WRITE_ESC_SEQUENCE16(ili9328_init);
|
634
|
658
|
setWindow = setWindow_ili9328;
|
635
|
659
|
break;
|
636
|
660
|
case 0x9341: // ILI9341
|
637
|
661
|
case 0x8066: // Anycubic / TronXY TFTs (480x320)
|
638
|
|
- WRITE_ESC_SEQUENCE(ili9341_init);
|
|
662
|
+ WRITE_ESC_SEQUENCE(ili9488_init);
|
639
|
663
|
setWindow = setWindow_st7789v;
|
640
|
664
|
break;
|
641
|
665
|
case 0x7796:
|
642
|
|
- WRITE_ESC_SEQUENCE(TERN(HAS_LCD_IO, st9677_init, ili9341_init));
|
|
666
|
+ WRITE_ESC_SEQUENCE(st7796_init);
|
643
|
667
|
setWindow = setWindow_st7789v;
|
644
|
668
|
break;
|
|
669
|
+ case 0x9488:
|
|
670
|
+ WRITE_ESC_SEQUENCE(ili9488_init);
|
|
671
|
+ setWindow = setWindow_st7789v;
|
645
|
672
|
case 0x0404: // No connected display on FSMC
|
646
|
673
|
lcd_id = 0;
|
647
|
674
|
return 0;
|
|
@@ -664,8 +691,8 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
|
664
|
691
|
LCD_IO_WriteMultiple(TFT_MARLINBG_COLOR, (LCD_FULL_PIXEL_WIDTH) * (LCD_FULL_PIXEL_HEIGHT));
|
665
|
692
|
#else
|
666
|
693
|
memset2(buffer, TFT_MARLINBG_COLOR, (LCD_FULL_PIXEL_WIDTH) / 2);
|
667
|
|
- for (uint16_t i = 0; i < (LCD_FULL_PIXEL_WIDTH) * 3; i++)
|
668
|
|
- u8g_WriteSequence(u8g, dev, (LCD_FULL_PIXEL_WIDTH) / 2, (uint8_t *)buffer);
|
|
694
|
+ for (uint16_t i = 0; i < (LCD_FULL_PIXEL_HEIGHT) * sq(FSMC_UPSCALE); i++)
|
|
695
|
+ u8g_WriteSequence(u8g, dev, LCD_FULL_PIXEL_WIDTH / 2, (uint8_t *)buffer);
|
669
|
696
|
#endif
|
670
|
697
|
|
671
|
698
|
// Bottom buttons
|
|
@@ -721,11 +748,10 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
|
721
|
748
|
LCD_IO_WriteSequence(buffer, COUNT(bufferA));
|
722
|
749
|
#else
|
723
|
750
|
uint8_t* bufptr = (uint8_t*) buffer;
|
724
|
|
- for (uint8_t i = 2; i--;) {
|
725
|
|
- u8g_WriteSequence(u8g, dev, WIDTH, &bufptr[0]);
|
726
|
|
- u8g_WriteSequence(u8g, dev, WIDTH, &bufptr[WIDTH]);
|
727
|
|
- u8g_WriteSequence(u8g, dev, WIDTH, &bufptr[WIDTH*2]);
|
728
|
|
- u8g_WriteSequence(u8g, dev, WIDTH, &bufptr[WIDTH*3]);
|
|
751
|
+ for (uint8_t i = FSMC_UPSCALE; i--;) {
|
|
752
|
+ LOOP_S_L_N(n, 0, FSMC_UPSCALE * 2) {
|
|
753
|
+ u8g_WriteSequence(u8g, dev, WIDTH, &bufptr[WIDTH * n]);
|
|
754
|
+ }
|
729
|
755
|
}
|
730
|
756
|
#endif
|
731
|
757
|
}
|