MKS Robin ILI9328 TFT support (#16401)

2.0.x
Alexander Gavrilenko 5 years ago committed by Scott Lahteine
parent 747b2b9bf4
commit c6f7ea9f22

@ -49,6 +49,7 @@
void LCD_IO_Init(uint8_t cs, uint8_t rs);
void LCD_IO_WriteData(uint16_t RegValue);
void LCD_IO_WriteReg(uint16_t Reg);
uint16_t LCD_IO_ReadData(uint16_t RegValue);
uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize);
#ifdef LCD_USE_DMA_FSMC
void LCD_IO_WriteMultiple(uint16_t data, uint32_t count);
@ -80,7 +81,9 @@ uint8_t u8g_com_stm32duino_fsmc_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, voi
u8g_Delay(50);
if (arg_ptr)
*((uint32_t *)arg_ptr) = LCD_IO_ReadData(LCD_READ_ID, 3);
*((uint32_t *)arg_ptr) = LCD_IO_ReadData(0x0000);
if (*((uint32_t *)arg_ptr) == 0)
*((uint32_t *)arg_ptr) = (LCD_READ_ID << 24) | LCD_IO_ReadData(LCD_READ_ID, 3);
isCommand = 0;
break;
@ -265,6 +268,13 @@ void LCD_IO_WriteReg(uint16_t Reg) {
__DSB();
}
uint16_t LCD_IO_ReadData(uint16_t RegValue) {
LCD->REG = RegValue;
__DSB();
return LCD->RAM;
}
uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize) {
volatile uint32_t data;
LCD->REG = RegValue;

@ -65,6 +65,8 @@
#include <string.h>
#if ENABLED(LCD_USE_DMA_FSMC)
extern void LCD_IO_WriteReg(uint16_t Reg);
extern void LCD_IO_WriteData(uint16_t RegValue);
extern void LCD_IO_WriteSequence(uint16_t *data, uint16_t length);
extern void LCD_IO_WriteSequence_Async(uint16_t *data, uint16_t length);
extern void LCD_IO_WaitSequence_Async();
@ -80,10 +82,6 @@
#define X_HI (X_LO + 2 * WIDTH - 1)
#define Y_HI (Y_LO + 2 * HEIGHT - 1)
#define LCD_COLUMN 0x2A /* Colomn address register */
#define LCD_ROW 0x2B /* Row address register */
#define LCD_WRITE_RAM 0x2C
// see https://ee-programming-notepad.blogspot.com/2016/10/16-bit-color-generator-picker.html
#define COLOR_BLACK 0x0000 // #000000
@ -133,113 +131,254 @@
static uint32_t lcd_id = 0;
#define U8G_ESC_DATA(x) (uint8_t)(x >> 8), (uint8_t)(x & 0xFF)
#define ST7789V_CASET 0x2A /* Column address register */
#define ST7789V_RASET 0x2B /* Row address register */
#define ST7789V_WRITE_RAM 0x2C /* Write data to GRAM */
static const uint8_t page_first_sequence[] = {
U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), U8G_ESC_DATA(X_LO), U8G_ESC_DATA(X_HI),
U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), U8G_ESC_DATA(Y_LO), U8G_ESC_DATA(Y_HI),
U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1),
U8G_ESC_END
};
static const uint8_t clear_screen_sequence[] = {
U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), 0x00, 0x00, U8G_ESC_DATA(LCD_FULL_PIXEL_WIDTH),
U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), 0x00, 0x00, U8G_ESC_DATA(LCD_FULL_PIXEL_HEIGHT),
U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1),
U8G_ESC_END
};
/* Mind the mess: with landscape screen orientation 'Horizontal' is Y and 'Vertical' is X */
#define ILI9328_HASET 0x20 /* Horizontal GRAM address register (0-255) */
#define ILI9328_VASET 0x21 /* Vertical GRAM address register (0-511)*/
#define ILI9328_WRITE_RAM 0x22 /* Write data to GRAM */
#if ENABLED(TOUCH_BUTTONS)
#define ILI9328_HASTART 0x50 /* Horizontal address start position (0-255) */
#define ILI9328_HAEND 0x51 /* Horizontal address end position (0-255) */
#define ILI9328_VASTART 0x52 /* Vertical address start position (0-511) */
#define ILI9328_VAEND 0x53 /* Vertical address end position (0-511) */
static const uint8_t separation_line_sequence_left[] = {
U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), U8G_ESC_DATA(10), U8G_ESC_DATA(159),
U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), U8G_ESC_DATA(170), U8G_ESC_DATA(173),
U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1),
U8G_ESC_END
};
static const uint8_t separation_line_sequence_right[] = {
U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), U8G_ESC_DATA(160), U8G_ESC_DATA(309),
U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), U8G_ESC_DATA(170), U8G_ESC_DATA(173),
U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1),
U8G_ESC_END
};
static void setWindow_ili9328(u8g_t *u8g, u8g_dev_t *dev, uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ymax) {
#ifdef LCD_USE_DMA_FSMC
LCD_IO_WriteReg(ILI9328_HASTART);
LCD_IO_WriteData(Ymin);
LCD_IO_WriteReg(ILI9328_HAEND);
LCD_IO_WriteData(Ymax);
LCD_IO_WriteReg(ILI9328_VASTART);
LCD_IO_WriteData(Xmin);
LCD_IO_WriteReg(ILI9328_VAEND);
LCD_IO_WriteData(Xmax);
static const uint8_t buttonD_sequence[] = {
U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), U8G_ESC_DATA(14), U8G_ESC_DATA(77),
U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), U8G_ESC_DATA(185), U8G_ESC_DATA(224),
U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1),
U8G_ESC_END
};
LCD_IO_WriteReg(ILI9328_HASET);
LCD_IO_WriteData(Ymin);
LCD_IO_WriteReg(ILI9328_VASET);
LCD_IO_WriteData(Xmin);
static const uint8_t buttonA_sequence[] = {
U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), U8G_ESC_DATA(90), U8G_ESC_DATA(153),
U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), U8G_ESC_DATA(185), U8G_ESC_DATA(224),
U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1),
U8G_ESC_END
};
LCD_IO_WriteReg(ILI9328_WRITE_RAM);
#else
u8g_SetAddress(u8g, dev, 0);
static const uint8_t buttonB_sequence[] = {
U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), U8G_ESC_DATA(166), U8G_ESC_DATA(229),
U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), U8G_ESC_DATA(185), U8G_ESC_DATA(224),
U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1),
U8G_ESC_END
};
u8g_WriteByte(u8g, dev, ILI9328_HASTART);
u8g_WriteSequence(u8g, dev, 2, (uint8_t *)&Ymin);
u8g_WriteByte(u8g, dev, ILI9328_HAEND);
u8g_WriteSequence(u8g, dev, 2, (uint8_t *)&Ymax);
u8g_WriteByte(u8g, dev, ILI9328_VASTART);
u8g_WriteSequence(u8g, dev, 2, (uint8_t *)&Xmin);
u8g_WriteByte(u8g, dev, ILI9328_VAEND);
u8g_WriteSequence(u8g, dev, 2, (uint8_t *)&Xmax);
static const uint8_t buttonC_sequence[] = {
U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), U8G_ESC_DATA(242), U8G_ESC_DATA(305),
U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), U8G_ESC_DATA(185), U8G_ESC_DATA(224),
U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1),
U8G_ESC_END
};
u8g_WriteByte(u8g, dev, ILI9328_HASET);
u8g_WriteSequence(u8g, dev, 2, (uint8_t *)&Ymin);
u8g_WriteByte(u8g, dev, ILI9328_VASET);
u8g_WriteSequence(u8g, dev, 2, (uint8_t *)&Xmin);
u8g_WriteByte(u8g, dev, ILI9328_WRITE_RAM);
u8g_SetAddress(u8g, dev, 1);
#endif
}
static void setWindow_st7789v(u8g_t *u8g, u8g_dev_t *dev, uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ymax) {
#ifdef LCD_USE_DMA_FSMC
LCD_IO_WriteReg(ST7789V_CASET);
LCD_IO_WriteData((Xmin >> 8) & 0xFF);
LCD_IO_WriteData(Xmin & 0xFF);
LCD_IO_WriteData((Xmax >> 8) & 0xFF);
LCD_IO_WriteData(Xmax & 0xFF);
LCD_IO_WriteReg(ST7789V_RASET);
LCD_IO_WriteData((Ymin >> 8) & 0xFF);
LCD_IO_WriteData(Ymin & 0xFF);
LCD_IO_WriteData((Ymax >> 8) & 0xFF);
LCD_IO_WriteData(Ymax & 0xFF);
LCD_IO_WriteReg(ST7789V_WRITE_RAM);
#else
u8g_SetAddress(u8g, dev, 0); u8g_WriteByte(u8g, dev, ST7789V_CASET); u8g_SetAddress(u8g, dev, 1);
u8g_WriteByte(u8g, dev, (Xmin >> 8) & 0xFF);
u8g_WriteByte(u8g, dev, Xmin & 0xFF);
u8g_WriteByte(u8g, dev, (Xmax >> 8) & 0xFF);
u8g_WriteByte(u8g, dev, Xmax & 0xFF);
u8g_SetAddress(u8g, dev, 0); u8g_WriteByte(u8g, dev, ST7789V_RASET); u8g_SetAddress(u8g, dev, 1);
u8g_WriteByte(u8g, dev, (Ymin >> 8) & 0xFF);
u8g_WriteByte(u8g, dev, Ymin & 0xFF);
u8g_WriteByte(u8g, dev, (Ymax >> 8) & 0xFF);
u8g_WriteByte(u8g, dev, Ymax & 0xFF);
u8g_SetAddress(u8g, dev, 0); u8g_WriteByte(u8g, dev, ST7789V_WRITE_RAM); u8g_SetAddress(u8g, dev, 1);
#endif
}
static void setWindow_none(u8g_t *u8g, u8g_dev_t *dev, uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ymax) {}
void (*setWindow)(u8g_t *u8g, u8g_dev_t *dev, uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ymax) = setWindow_none;
#define ESC_REG(x) 0xFFFF, 0x00FF & (uint16_t)x
#define ESC_DELAY(x) 0xFFFF, 0x8000 | (x & 0x7FFF)
#define ESC_END 0xFFFF, 0x7FFF
#define ESC_FFFF 0xFFFF, 0xFFFF
#ifdef LCD_USE_DMA_FSMC
void writeEscSequence(const uint16_t *sequence) {
uint16_t data;
for (;;) {
data = *sequence++;
if (data != 0xFFFF) {
LCD_IO_WriteData(data);
continue;
}
data = *sequence++;
if (data == 0x7FFF) return;
if (data == 0xFFFF) {
LCD_IO_WriteData(data);
} else if (data & 0x8000) {
delay(data & 0x7FFF);
} else if ((data & 0xFF00) == 0) {
LCD_IO_WriteReg(data);
}
}
}
#else
void writeEscSequence8(u8g_t *u8g, u8g_dev_t *dev, const uint16_t *sequence) {
uint16_t data;
u8g_SetAddress(u8g, dev, 1);
for (;;) {
data = *sequence++;
if (data != 0xFFFF) {
u8g_WriteByte(u8g, dev, data & 0xFF);
continue;
}
data = *sequence++;
if (data == 0x7FFF) return;
if (data == 0xFFFF) {
u8g_WriteByte(u8g, dev, data & 0xFF);
} else if (data & 0x8000) {
delay(data & 0x7FFF);
} else if ((data & 0xFF00) == 0) {
u8g_SetAddress(u8g, dev, 0);
u8g_WriteByte(u8g, dev, data & 0xFF);
u8g_SetAddress(u8g, dev, 1);
}
}
}
void writeEscSequence16(u8g_t *u8g, u8g_dev_t *dev, const uint16_t *sequence) {
uint16_t data;
u8g_SetAddress(u8g, dev, 0);
for (;;) {
data = *sequence++;
if (data != 0xFFFF) {
u8g_WriteSequence(u8g, dev, 2, (uint8_t *)&data);
continue;
}
data = *sequence++;
if (data == 0x7FFF) return;
if (data == 0xFFFF) {
u8g_WriteSequence(u8g, dev, 2, (uint8_t *)&data);
} else if (data & 0x8000) {
delay(data & 0x7FFF);
} else if ((data & 0xFF00) == 0) {
u8g_WriteByte(u8g, dev, data & 0xFF);
}
}
u8g_SetAddress(u8g, dev, 1);
}
#endif
static const uint8_t st7789v_init_sequence[] = { // 0x8552 - ST7789V
U8G_ESC_ADR(0),
0x10,
U8G_ESC_DLY(10),
0x01,
U8G_ESC_DLY(100), U8G_ESC_DLY(100),
0x11,
U8G_ESC_DLY(120),
0x36, U8G_ESC_ADR(1), 0xA0,
U8G_ESC_ADR(0), 0x3A, U8G_ESC_ADR(1), 0x05,
U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), 0x00, 0x00, 0x01, 0x3F,
U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), 0x00, 0x00, 0x00, 0xEF,
U8G_ESC_ADR(0), 0xB2, U8G_ESC_ADR(1), 0x0C, 0x0C, 0x00, 0x33, 0x33,
U8G_ESC_ADR(0), 0xB7, U8G_ESC_ADR(1), 0x35,
U8G_ESC_ADR(0), 0xBB, U8G_ESC_ADR(1), 0x1F,
U8G_ESC_ADR(0), 0xC0, U8G_ESC_ADR(1), 0x2C,
U8G_ESC_ADR(0), 0xC2, U8G_ESC_ADR(1), 0x01, 0xC3,
U8G_ESC_ADR(0), 0xC4, U8G_ESC_ADR(1), 0x20,
U8G_ESC_ADR(0), 0xC6, U8G_ESC_ADR(1), 0x0F,
U8G_ESC_ADR(0), 0xD0, U8G_ESC_ADR(1), 0xA4, 0xA1,
U8G_ESC_ADR(0), 0xE0, U8G_ESC_ADR(1), 0xD0, 0x08, 0x11, 0x08, 0x0C, 0x15, 0x39, 0x33, 0x50, 0x36, 0x13, 0x14, 0x29, 0x2D,
U8G_ESC_ADR(0), 0xE1, U8G_ESC_ADR(1), 0xD0, 0x08, 0x10, 0x08, 0x06, 0x06, 0x39, 0x44, 0x51, 0x0B, 0x16, 0x14, 0x2F, 0x31,
U8G_ESC_ADR(0), 0x29, 0x11, 0x35, U8G_ESC_ADR(1), 0x00,
U8G_ESC_END
static const uint16_t st7789v_init[] = {
ESC_REG(0x0010), ESC_DELAY(10),
ESC_REG(0x0001), ESC_DELAY(200),
ESC_REG(0x0011), ESC_DELAY(120),
ESC_REG(0x0036), 0x00A0,
ESC_REG(0x003A), 0x0055,
ESC_REG(0x002A), 0x0000, 0x0000, 0x0001, 0x003F,
ESC_REG(0x002B), 0x0000, 0x0000, 0x0000, 0x00EF,
ESC_REG(0x00B2), 0x000C, 0x000C, 0x0000, 0x0033, 0x0033,
ESC_REG(0x00B7), 0x0035,
ESC_REG(0x00BB), 0x001F,
ESC_REG(0x00C0), 0x002C,
ESC_REG(0x00C2), 0x0001, 0x00C3,
ESC_REG(0x00C4), 0x0020,
ESC_REG(0x00C6), 0x000F,
ESC_REG(0x00D0), 0x00A4, 0x00A1,
ESC_REG(0x0029),
ESC_REG(0x0011),
ESC_END
};
static const uint8_t ili9341_init_sequence[] = { // 0x9341 - ILI9341
U8G_ESC_ADR(0),
0x10,
U8G_ESC_DLY(10),
0x01,
U8G_ESC_DLY(100), U8G_ESC_DLY(100),
0x36, U8G_ESC_ADR(1), 0xE8,
U8G_ESC_ADR(0), 0x3A, U8G_ESC_ADR(1), 0x55,
U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), 0x00, 0x00, 0x01, 0x3F,
U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), 0x00, 0x00, 0x00, 0xEF,
U8G_ESC_ADR(0), 0xC5, U8G_ESC_ADR(1), 0x3E, 0x28,
U8G_ESC_ADR(0), 0xC7, U8G_ESC_ADR(1), 0x86,
U8G_ESC_ADR(0), 0xB1, U8G_ESC_ADR(1), 0x00, 0x18,
U8G_ESC_ADR(0), 0xC0, U8G_ESC_ADR(1), 0x23,
U8G_ESC_ADR(0), 0xC1, U8G_ESC_ADR(1), 0x10,
U8G_ESC_ADR(0), 0x29,
U8G_ESC_ADR(0), 0x11,
U8G_ESC_DLY(100),
U8G_ESC_END
static const uint16_t ili9328_init[] = {
ESC_REG(0x0001), 0x0100,
ESC_REG(0x0002), 0x0400,
ESC_REG(0x0003), 0x1038,
ESC_REG(0x0004), 0x0000,
ESC_REG(0x0008), 0x0202,
ESC_REG(0x0009), 0x0000,
ESC_REG(0x000A), 0x0000,
ESC_REG(0x000C), 0x0000,
ESC_REG(0x000D), 0x0000,
ESC_REG(0x000F), 0x0000,
ESC_REG(0x0010), 0x0000,
ESC_REG(0x0011), 0x0007,
ESC_REG(0x0012), 0x0000,
ESC_REG(0x0013), 0x0000,
ESC_REG(0x0007), 0x0001,
ESC_DELAY(200),
ESC_REG(0x0010), 0x1690,
ESC_REG(0x0011), 0x0227,
ESC_DELAY(50),
ESC_REG(0x0012), 0x008C,
ESC_DELAY(50),
ESC_REG(0x0013), 0x1500,
ESC_REG(0x0029), 0x0004,
ESC_REG(0x002B), 0x000D,
ESC_DELAY(50),
ESC_REG(0x0050), 0x0000,
ESC_REG(0x0051), 0x00EF,
ESC_REG(0x0052), 0x0000,
ESC_REG(0x0053), 0x013F,
ESC_REG(0x0020), 0x0000,
ESC_REG(0x0021), 0x0000,
ESC_REG(0x0060), 0x2700,
ESC_REG(0x0061), 0x0001,
ESC_REG(0x006A), 0x0000,
ESC_REG(0x0080), 0x0000,
ESC_REG(0x0081), 0x0000,
ESC_REG(0x0082), 0x0000,
ESC_REG(0x0083), 0x0000,
ESC_REG(0x0084), 0x0000,
ESC_REG(0x0085), 0x0000,
ESC_REG(0x0090), 0x0010,
ESC_REG(0x0092), 0x0600,
ESC_REG(0x0007), 0x0133,
ESC_REG(0x0022),
ESC_END
};
static const uint16_t ili9341_init[] = {
ESC_REG(0x0010), ESC_DELAY(10),
ESC_REG(0x0001), ESC_DELAY(200),
ESC_REG(0x0036), 0x00E8,
ESC_REG(0x003A), 0x0055,
ESC_REG(0x002A), 0x0000, 0x0000, 0x0001, 0x003F,
ESC_REG(0x002B), 0x0000, 0x0000, 0x0000, 0x00EF,
ESC_REG(0x00C5), 0x003E, 0x0028,
ESC_REG(0x00C7), 0x0086,
ESC_REG(0x00B1), 0x0000, 0x0018,
ESC_REG(0x00C0), 0x0023,
ESC_REG(0x00C1), 0x0010,
ESC_REG(0x0029),
ESC_REG(0x0011),
ESC_DELAY(100),
ESC_END
};
#if ENABLED(TOUCH_BUTTONS)
@ -439,23 +578,55 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
switch (msg) {
case U8G_DEV_MSG_INIT:
dev->com_fn(u8g, U8G_COM_MSG_INIT, U8G_SPI_CLK_CYCLE_NONE, &lcd_id);
if (lcd_id == 0x040404) return 0; // No connected display on FSMC
if (lcd_id == 0xFFFFFF) return 0; // No connected display on SPI
if ((lcd_id & 0xFFFF) == 0x8552) // ST7789V
u8g_WriteEscSeqP(u8g, dev, st7789v_init_sequence);
if ((lcd_id & 0xFFFF) == 0x9341) // ILI9341
u8g_WriteEscSeqP(u8g, dev, ili9341_init_sequence);
switch(lcd_id & 0xFFFF) {
case 0x8552: // ST7789V
#ifdef LCD_USE_DMA_FSMC
writeEscSequence(st7789v_init);
#else
writeEscSequence8(u8g, dev, st7789v_init);
#endif
setWindow = setWindow_st7789v;
break;
case 0x9328: // ILI9328
#ifdef LCD_USE_DMA_FSMC
writeEscSequence(ili9328_init);
#else
writeEscSequence16(u8g, dev, ili9328_init);
#endif
setWindow = setWindow_ili9328;
break;
case 0x9341: // ILI9341
#ifdef LCD_USE_DMA_FSMC
writeEscSequence(ili9341_init);
#else
writeEscSequence8(u8g, dev, ili9341_init);
#endif
setWindow = setWindow_st7789v;
break;
case 0x0404: // No connected display on FSMC
lcd_id = 0;
return 0;
case 0xFFFF: // No connected display on SPI
lcd_id = 0;
return 0;
default:
if (lcd_id && 0xFF000000)
setWindow = setWindow_st7789v;
else
setWindow = setWindow_ili9328;
break;
}
if (preinit) {
preinit = false;
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
}
// Clear Screen Sequence
u8g_WriteEscSeqP(u8g, dev, clear_screen_sequence);
// Clear Screen
setWindow(u8g, dev, 0, 0, LCD_FULL_PIXEL_WIDTH - 1, LCD_FULL_PIXEL_HEIGHT - 1);
#ifdef LCD_USE_DMA_FSMC
LCD_IO_WriteMultiple(TFT_MARLINBG_COLOR, (320*240));
LCD_IO_WriteMultiple(TFT_MARLINBG_COLOR, LCD_FULL_PIXEL_WIDTH * LCD_FULL_PIXEL_HEIGHT);
#else
memset2(buffer, TFT_MARLINBG_COLOR, 160);
for (uint16_t i = 0; i < 960; i++)
@ -465,31 +636,25 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
// bottom line and buttons
#if ENABLED(TOUCH_BUTTONS)
setWindow(u8g, dev, 10, 170, 309, 171);
#ifdef LCD_USE_DMA_FSMC
u8g_WriteEscSeqP(u8g, dev, separation_line_sequence_left);
LCD_IO_WriteMultiple(TFT_DISABLED_COLOR, 300);
u8g_WriteEscSeqP(u8g, dev, separation_line_sequence_right);
LCD_IO_WriteMultiple(TFT_DISABLED_COLOR, 300);
LCD_IO_WriteMultiple(TFT_DISABLED_COLOR, 600);
#else
memset2(buffer, TFT_DISABLED_COLOR, 150);
u8g_WriteEscSeqP(u8g, dev, separation_line_sequence_left);
for (uint8_t i = 4; i--;)
u8g_WriteSequence(u8g, dev, 150, (uint8_t *)buffer);
u8g_WriteEscSeqP(u8g, dev, separation_line_sequence_right);
for (uint8_t i = 4; i--;)
for (uint8_t i = 8; i--;)
u8g_WriteSequence(u8g, dev, 150, (uint8_t *)buffer);
#endif
u8g_WriteEscSeqP(u8g, dev, buttonD_sequence);
setWindow(u8g, dev, 14, 185, 77, 224);
drawImage(buttonD, u8g, dev, 32, 20, TFT_BTCANCEL_COLOR);
u8g_WriteEscSeqP(u8g, dev, buttonA_sequence);
setWindow(u8g, dev, 90, 185, 153, 224);
drawImage(buttonA, u8g, dev, 32, 20, TFT_BTARROWS_COLOR);
u8g_WriteEscSeqP(u8g, dev, buttonB_sequence);
setWindow(u8g, dev, 166, 185, 229, 224);
drawImage(buttonB, u8g, dev, 32, 20, TFT_BTARROWS_COLOR);
u8g_WriteEscSeqP(u8g, dev, buttonC_sequence);
setWindow(u8g, dev, 242, 185, 305, 224);
drawImage(buttonC, u8g, dev, 32, 20, TFT_BTOKMENU_COLOR);
#endif // TOUCH_BUTTONS
@ -499,7 +664,7 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
case U8G_DEV_MSG_PAGE_FIRST:
page = 0;
u8g_WriteEscSeqP(u8g, dev, page_first_sequence);
setWindow(u8g, dev, X_LO, Y_LO, X_HI, Y_HI);
break;
case U8G_DEV_MSG_PAGE_NEXT:

@ -112,7 +112,8 @@
/**
* Note: MKS Robin TFT screens use various TFT controllers
* Supported screens are based on the ILI9341 and ST7789V (320x240), ILI9328 and 9488 are not.
* Supported screens are based on the ILI9341, ST7789V and ILI9328 (320x240)
* ILI9488 is not supported
* Define init sequences for other screens in u8g_dev_tft_320x240_upscale_from_128x64.cpp
*
* If the screen stays white, disable 'LCD_RESET_PIN'

Loading…
Cancel
Save