feat: speed up PRTS LCD refresh

This commit is contained in:
TuxMonkey
2026-07-20 23:34:13 +08:00
parent b2169513e1
commit 8671f84139
14 changed files with 2296 additions and 98 deletions

View File

@@ -224,13 +224,18 @@ static void lcd_write_data8(uint8_t data)
tft_cs_high();
}
static void lcd_write_data16(uint16_t data)
static void lcd_write_reg_data(uint8_t reg, const uint8_t *data, uint32_t len)
{
uint8_t buf[2] = {(uint8_t) (data >> 8), (uint8_t) data};
tft_cs_low();
tft_dc_data();
tft_write_bytes(buf, sizeof(buf));
tft_dc_command();
tft_write_bytes(&reg, 1U);
if (data != NULL && len > 0U && tft_transfer_ok)
{
tft_dc_data();
tft_write_bytes(data, len);
}
tft_cs_high();
tft_dc_data();
}
static void tft_write_color_block(uint16_t color, uint32_t count)
@@ -284,14 +289,22 @@ void LCD_Address_Set(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
uint16_t xe = x2 + TFT_X_OFFSET;
uint16_t ys = y1 + TFT_Y_OFFSET;
uint16_t ye = y2 + TFT_Y_OFFSET;
uint8_t col_data[4] = {
(uint8_t) (xs >> 8),
(uint8_t) xs,
(uint8_t) (xe >> 8),
(uint8_t) xe
};
uint8_t row_data[4] = {
(uint8_t) (ys >> 8),
(uint8_t) ys,
(uint8_t) (ye >> 8),
(uint8_t) ye
};
lcd_write_reg(0x2A);
lcd_write_data16(xs);
lcd_write_data16(xe);
lcd_write_reg(0x2B);
lcd_write_data16(ys);
lcd_write_data16(ye);
lcd_write_reg(0x2C);
lcd_write_reg_data(0x2A, col_data, sizeof(col_data));
lcd_write_reg_data(0x2B, row_data, sizeof(row_data));
lcd_write_reg_data(0x2C, NULL, 0U);
}
void TFT_FillRect(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color)

View File

@@ -13,8 +13,8 @@ extern "C" {
#define TFT_USE_HORIZONTAL 2U
#define TFT_USE_SOFT_SPI 0U
#define TFT_HW_SPI_BYTE_MODE 1U
#define TFT_HW_SPI_PULSE_CS 1U
#define TFT_HW_SPI_BYTE_MODE 0U
#define TFT_HW_SPI_PULSE_CS 0U
#define TFT_HW_SPI_STREAM_COLOR 1U
#if (TFT_USE_HORIZONTAL == 0U) || (TFT_USE_HORIZONTAL == 1U)