mirror of
https://gitee.com/dlmu-cone/tronone-h7-scaffold
synced 2026-07-24 03:27:45 +08:00
tft lvgl test ok
This commit is contained in:
@@ -35,7 +35,7 @@ static const uint8_t tft_font5x7[][TFT_FONT_H] = {
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C}, /* . */
|
||||
{0x00, 0x0C, 0x0C, 0x00, 0x0C, 0x0C, 0x00}, /* : */
|
||||
{0x0E, 0x11, 0x13, 0x15, 0x19, 0x11, 0x0E}, /* 0 */
|
||||
{0x04, 0x0C, 0x04, 0x04, 0x04, 0x04, 0x0E}, /* 1 */
|
||||
{0x04, 0x06, 0x04, 0x04, 0x04, 0x04, 0x0E}, /* 1 */
|
||||
{0x0E, 0x11, 0x10, 0x08, 0x04, 0x02, 0x1F}, /* 2 */
|
||||
{0x1F, 0x08, 0x04, 0x08, 0x10, 0x11, 0x0E}, /* 3 */
|
||||
{0x08, 0x0C, 0x0A, 0x09, 0x1F, 0x08, 0x08}, /* 4 */
|
||||
@@ -188,6 +188,25 @@ static void tft_write_bytes(const uint8_t *data, uint32_t len)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void tft_write_bytes_continuous(const uint8_t *data, uint32_t len)
|
||||
{
|
||||
#if TFT_USE_SOFT_SPI
|
||||
tft_write_bytes(data, len);
|
||||
#else
|
||||
while (len > 0U)
|
||||
{
|
||||
uint16_t chunk = len > UINT16_MAX ? UINT16_MAX : (uint16_t) len;
|
||||
if (HAL_SPI_Transmit(&TFT_SPI_UNIT, (uint8_t *) data, chunk, TFT_SPI_TIMEOUT_MS) != HAL_OK)
|
||||
{
|
||||
tft_transfer_ok = false;
|
||||
return;
|
||||
}
|
||||
data += chunk;
|
||||
len -= chunk;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void lcd_write_reg(uint8_t reg)
|
||||
{
|
||||
tft_cs_low();
|
||||
@@ -237,6 +256,28 @@ static void tft_write_color_block(uint16_t color, uint32_t count)
|
||||
tft_cs_high();
|
||||
}
|
||||
|
||||
void TFT_WriteColorData(const uint8_t *data, uint32_t len)
|
||||
{
|
||||
if (data == NULL || len == 0U)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
tft_cs_low();
|
||||
tft_dc_data();
|
||||
#if TFT_HW_SPI_STREAM_COLOR
|
||||
tft_write_bytes_continuous(data, len);
|
||||
#else
|
||||
tft_write_bytes(data, len);
|
||||
#endif
|
||||
tft_cs_high();
|
||||
}
|
||||
|
||||
bool TFT_IsReady(void)
|
||||
{
|
||||
return tft_initialized && tft_transfer_ok;
|
||||
}
|
||||
|
||||
void LCD_Address_Set(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
|
||||
{
|
||||
uint16_t xs = x1 + TFT_X_OFFSET;
|
||||
|
||||
Reference in New Issue
Block a user