{"id":3584,"date":"2025-05-31T23:10:24","date_gmt":"2025-05-31T15:10:24","guid":{"rendered":"https:\/\/saludpcb.com\/zh\/?p=3584"},"modified":"2025-09-26T06:15:40","modified_gmt":"2025-09-25T22:15:40","slug":"lvgl-render-spi-dma-esp32","status":"publish","type":"post","link":"https:\/\/saludpcb.com\/zh\/lvgl-render-spi-dma-esp32\/","title":{"rendered":"\u70ba LVGL Render \u6253\u597d\u5730\u57fa | ESP32 \u4f7f\u7528 SPI DMA \u52a0\u901f TFT \u756b\u9762\u5237\u65b0"},"content":{"rendered":"\n<hr class=\"wp-block-separator alignwide has-text-color has-palette-color-1-color has-alpha-channel-opacity has-palette-color-1-background-color has-background is-style-wide\"\/>\n\n\n\n<p><strong>LVGL Render<\/strong> \u5982\u679c\u4f60\u66fe\u5728 ESP32 \u4e0a\u958b\u767c\u904e UI\uff0c\u4f7f\u7528 <a href=\"https:\/\/lvgl.io\/\" target=\"_blank\" rel=\"noopener\">LVGL<\/a>\uff08Light and Versatile Graphics Library\uff09\u4f86\u6253\u9020\u5716\u5f62\u4ecb\u9762\uff0c\u90a3\u4f60\u5f88\u53ef\u80fd\u9047\u904e\u4e00\u500b\u4ee4\u4eba\u6cae\u55aa\u7684\u60c5\u6cc1\uff1a\u756b\u9762\u66f4\u65b0\u901f\u5ea6\u592a\u6162\uff0c\u5c0e\u81f4\u64cd\u4f5c\u5ef6\u9072\u548c\u756b\u9762\u9583\u720d\u3002<br>\u9019\u4e0d\u662f LVGL \u7684\u932f\uff0c\u800c\u662f\u5e95\u5c64 \u986f\u793a\u9a45\u52d5\u7684\u8cc7\u6599\u50b3\u8f38\u65b9\u5f0f\u5f71\u97ff\u4e86\u6548\u80fd\u3002\u9019\u7bc7\u6587\u7ae0\u7684\u76ee\u6a19\uff0c\u5c31\u662f\u5e36\u4f60\u7406\u89e3\u5982\u4f55\u900f\u904e SPI DMA\uff08Direct Memory Access\uff09 \u7684\u65b9\u5f0f\uff0c\u5728 ESP32 \u4e0a\u63d0\u5347 TFT LCD \u986f\u793a\u6548\u7387\uff0c\u70ba\u4f60\u5f8c\u7e8c\u5be6\u4f5c LVGL \u6253\u4e0b\u7a69\u5b9a\u3001\u9ad8\u6548\u7684\u57fa\u790e\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/saludpcb.com\/zh\/wp-content\/uploads\/2025\/05\/Supercharge-Your-LVGL-Render-on-ESP32-Using-SPI-DMA-Fast-and-Efficient.jpg\" alt=\"LVGL Render\" class=\"wp-image-3605\" title=\"\" srcset=\"https:\/\/saludpcb.com\/zh\/wp-content\/uploads\/2025\/05\/Supercharge-Your-LVGL-Render-on-ESP32-Using-SPI-DMA-Fast-and-Efficient.jpg 1024w, https:\/\/saludpcb.com\/zh\/wp-content\/uploads\/2025\/05\/Supercharge-Your-LVGL-Render-on-ESP32-Using-SPI-DMA-Fast-and-Efficient-768x768.jpg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>\u5167\u5bb9<\/h2><nav><ul><li class=\"\"><a href=\"#\u4ec0\u9ebc\u662f-lvgl-render\uff1f\">\u4ec0\u9ebc\u662f LVGL Render\uff1f<\/a><\/li><li class=\"\"><a href=\"#esp-32-\u7684-spi-dma-\u539f\u7406\u7c21\u4ecb\">ESP32 \u7684 SPI DMA \u539f\u7406\u7c21\u4ecb<\/a><\/li><li class=\"\"><a href=\"#\u6c92\u6709-dma-vs-\u6709-dma-\u7684\u5dee\u7570\">\u6c92\u6709 DMA vs \u6709 DMA \u7684 LVGL Render \u5dee\u7570<\/a><\/li><li class=\"\"><a href=\"#\u74b0\">\u958b\u767c\u74b0\u5883<\/a><\/li><li class=\"\"><a href=\"#\u5c08\u6848\u7d50\u69cb\">\u5c08\u6848\u7d50\u69cb<\/a><\/li><li class=\"\"><a href=\"#e\">\u4e8c\u7a2e\u65b9\u6848\u7a0b\u5f0f\u78bc\u6bd4\u8f03<\/a><\/li><li class=\"\"><a href=\"#\u5b8c\u6574-code\">\u5b8c\u6574 Code<\/a><\/li><li class=\"\"><a href=\"#\u7de8\u8b6f\u548c\u71d2\u9304-1\">\u7de8\u8b6f\u548c\u71d2\u9304<\/a><\/li><li class=\"\"><a href=\"#\u7d50\u8ad6\">\u7d50\u8ad6<\/a><\/li><\/ul><\/nav><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u4ec0\u9ebc\u662f-lvgl-render\uff1f\">\u4ec0\u9ebc\u662f LVGL Render\uff1f<\/h2>\n\n\n\n<p>LVGL \u7684\u6838\u5fc3\u4efb\u52d9\u662f\u5c07\u756b\u9762\u8f49\u63db\u6210\u50cf\u7d20\u6578\u64da\uff08frame buffer\uff09\uff0c\u7136\u5f8c\u900f\u904e\u4e00\u500b\u300cflush \u51fd\u6578\u300d\u628a\u9019\u4e9b\u50cf\u7d20\u9001\u5230\u87a2\u5e55\u4e0a\u3002\u9019\u500b\u904e\u7a0b\u7a31\u70ba render\u3002<\/p>\n\n\n\n<p>\u5728 ESP32 \u4e0a\uff0c\u9019\u500b flush \u7684\u8cc7\u6599\u50b3\u905e\u901a\u5e38\u662f\u900f\u904e SPI \u4ecb\u9762\u5c07 LVGL \u8a08\u7b97\u5f8c\u7684\u50cf\u7d20\u8cc7\u6599\u5beb\u5165 TFT LCD \u7684 RAM \u4e2d\u3002<\/p>\n\n\n\n<p>LVGL \u4e26\u4e0d\u7ba1\u4f60\u7528\u54ea\u7a2e\u65b9\u5f0f\u9001\u8cc7\u6599\u2014\u2014\u4f60\u53ef\u4ee5\u4e00\u7b46\u4e00\u7b46\u5beb\uff0c\u4e5f\u53ef\u4ee5\u7528 DMA \u65b9\u5f0f\u3002\u4f46 DMA \u53ef\u4ee5\u4e00\u6b21\u9001\u5b8c\u4e00\u6574\u584a\u756b\u9762\uff0c\u6548\u80fd\u5dee\u8ddd\u6975\u5927\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"esp-32-\u7684-spi-dma-\u539f\u7406\u7c21\u4ecb\">ESP32 \u7684 SPI DMA \u539f\u7406\u7c21\u4ecb<\/h2>\n\n\n\n<p>DMA\uff08Direct Memory Access\uff09\u662f\u4e00\u7a2e\u8b93\u786c\u9ad4\u76f4\u63a5\u5f9e\u8a18\u61b6\u9ad4\u642c\u8cc7\u6599\u5230\u5468\u908a\u88dd\u7f6e\uff08\u5982 SPI\uff09\uff0c\u4e0d\u7d93\u7531 CPU \u7684\u6a5f\u5236\u3002\u5c0d SPI \u4f86\u8aaa\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6c92\u7528 DMA\uff1aCPU \u9700\u8981\u4e00\u7b46\u4e00\u7b46\u9001\u8cc7\u6599\u5230 SPI \u5bc4\u5b58\u5668\uff1b<\/li>\n\n\n\n<li>\u7528\u4e86 DMA\uff1aCPU \u53ea\u8981\u8a2d\u5b9a\u4e00\u6b21\uff0cDMA \u63a7\u5236\u5668\u6703\u81ea\u884c\u5c07\u6574\u500b\u756b\u9762\u8cc7\u6599\u642c\u5230 SPI\u3002<\/li>\n<\/ul>\n\n\n\n<p>ESP32 \u652f\u63f4 DMA\uff0c\u642d\u914d spi_device_queue_trans() \u7b49 API\uff0c\u53ef\u975e\u540c\u6b65\u63d0\u4ea4\u6574\u7b46\u756b\u9762\u8cc7\u6599\u3002\u9019\u5c0d\u65bc\u756b\u9762\u5927\u5c0f\u70ba 240&#215;320 \u7684 TFT \u800c\u8a00\uff0c\u662f\u5fc5\u9808\u512a\u5316\u7684\u90e8\u5206\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u6c92\u6709-dma-vs-\u6709-dma-\u7684\u5dee\u7570\">\u6c92\u6709 DMA vs \u6709 DMA \u7684 LVGL Render \u5dee\u7570<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u9805\u76ee<\/th><th>\u7121 DMA<\/th><th>\u6709 DMA<\/th><\/tr><\/thead><tbody><tr><td>\u8cc7\u6599\u50b3\u9001\u65b9\u5f0f<\/td><td>CPU \u9010\u7b46\u50b3\u9001<\/td><td>DMA \u81ea\u52d5\u642c\u904b<\/td><\/tr><tr><td>CPU \u4f7f\u7528\u7387<\/td><td>\u9ad8<\/td><td>\u4f4e<\/td><\/tr><tr><td>\u756b\u9762\u5237\u65b0\u6548\u7387<\/td><td>\u6162\uff08\u6709\u660e\u986f\u5361\u9813\uff09<\/td><td>\u5feb\uff08\u63a5\u8fd1\u786c\u9ad4\u6975\u9650\uff09<\/td><\/tr><tr><td>LVGL \u6574\u9ad4\u9ad4\u9a57<\/td><td>lag\u3001\u6389\u5e40<\/td><td>\u7d72\u6ed1\u6d41\u66a2<\/td><\/tr><tr><td>\u7a0b\u5f0f\u78bc\u8907\u96dc\u5ea6<\/td><td>\u4f4e<\/td><td>\u7a0d\u9ad8\uff08\u9700\u8a2d\u7f6e DMA\uff09<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u74b0\">\u958b\u767c\u74b0\u5883<\/h2>\n\n\n\n<p>\u5728\u958b\u59cb\u7de8\u7a0b\u4e4b\u524d\uff0c\u8acb\u78ba\u4fdd\u5df2\u5b8c\u6210\u4ee5\u4e0b\u6e96\u5099\u5de5\u4f5c\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/saludpcb.com\/zh\/esp32-tutorial-how-to-create-an-esp32-project-with-vscode\/\">\u5b89\u88dd ESP-IDF \u958b\u767c\u74b0\u5883<\/a> (\u81f3\u5c11\u7248\u672c v5.x \u6216\u66f4\u9ad8)\u3002<\/li>\n\n\n\n<li><a href=\"https:\/\/saludpcb.com\/zh\/esp32-devkit-module-pinout\/\">ESP32 \u958b\u767c\u677f<\/a>\u3002<\/li>\n\n\n\n<li>\u4e00\u500b SPI \u63a5\u53e3\u7684 TFT LCD\uff08\u5982 ST7789)\u3002<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u5c08\u6848\u7d50\u69cb\"><strong>\u5c08\u6848\u7d50\u69cb<\/strong><\/h2>\n\n\n\n<p>\u5efa\u7acb\u4e00\u500b\u4e7e\u6de8\u7684 ESP-IDF LVGL Render \u5c08\u6848\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">tft_dma_lvgl_demo\/\n\u251c\u2500\u2500 CMakeLists.txt\n\u251c\u2500\u2500 sdkconfig\n\u2514\u2500\u2500 main\/\n    \u251c\u2500\u2500 main.c         # Main program\n    \u2514\u2500\u2500 tft_driver.c   # TFT driver (including DMA implementation)<\/code><\/pre>\n\n\n\n<p>\u672c\u6587\u5c07\u6240\u6709\u908f\u8f2f\u96c6\u4e2d\u5728&nbsp;<code>main.c<\/code>&nbsp;\u505a SPI DMA \u793a\u7bc4 \uff0c\u65e5\u5f8c\u4f60\u53ef\u5c07&nbsp;<code>tft_fill_color()<\/code>&nbsp;\u62bd\u6210\u7368\u7acb driver \u6a21\u7d44\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"e\">\u4e8c\u7a2e\u65b9\u6848\u7a0b\u5f0f\u78bc\u6bd4\u8f03<\/h2>\n\n\n\n<p>\u50b3\u7d71\u7248\u672c\uff08\u7121 DMA\uff09\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">void tft_fill_color(uint16_t color) {\n    uint8_t color_data[2] = {color &gt;&gt; 8, color &amp; 0xFF};  \/\/ Convert 16-bit color to two 8-bit bytes\n    for (int i = 0; i &lt; TFT_WIDTH * TFT_HEIGHT; i++) {\n        tft_send_data(color_data, 2);  \/\/ Send 2 bytes per pixel\n    }\n}<\/code><\/pre>\n\n\n\n<p>DMA \u52a0\u901f\u7248\u672c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">void tft_fill_color_dma(uint16_t color) {\n    for (int i = 0; i &lt; TFT_WIDTH * TFT_HEIGHT; i++) {\n        frame_buffer[i * 2]     = color &gt;&gt; 8;       \/\/ High byte of color\n        frame_buffer[i * 2 + 1] = color &amp; 0xFF;     \/\/ Low byte of color\n    }\n\n    spi_transaction_t t = {\n        .length = TFT_WIDTH * TFT_HEIGHT * 16,      \/\/ Total bits (16 bits per pixel)\n        .tx_buffer = frame_buffer,\n        .user = (void*)1\n    };\n    spi_device_queue_trans(spi, &amp;t, portMAX_DELAY);          \/\/ Queue the DMA transfer\n    spi_transaction_t *ret;\n    spi_device_get_trans_result(spi, &amp;ret, portMAX_DELAY);   \/\/ Wait for transfer to complete\n}\n<\/code><\/pre>\n\n\n\n<p>\u5be6\u6e2c\u7d50\u679c\uff08\u76f8\u540c\u756b\u9762\u5237\u65b0\uff09\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u6e2c\u8a66\u9805\u76ee<\/th><th>\u50b3\u7d71\u65b9\u5f0f<\/th><th>DMA \u65b9\u5f0f<\/th><\/tr><\/thead><tbody><tr><td>\u5168\u87a2\u5e55\u586b\u8272\u6642\u9593<\/td><td>\u7d04 1 s<\/td><td>\u5c0f\u5c0f\u65bc 1 s<\/td><\/tr><tr><td>CPU \u7a7a\u9592\u6642\u9593<\/td><td>\u5e7e\u4e4e\u70ba 0<\/td><td>\u53ef\u505a\u5176\u4ed6\u4e8b<\/td><\/tr><tr><td>\u662f\u5426\u6d41\u66a2<\/td><td>\u975e\u5e38\u4e0d\u6d41\u66a2<\/td><td>\u6d41\u66a2<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u5b8c\u6574-code\">\u5b8c\u6574 Code<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">#include \"driver\/spi_master.h\"\n#include \"driver\/gpio.h\"\n#include \"esp_log.h\"\n#include \"freertos\/FreeRTOS.h\"\n#include \"freertos\/task.h\"\n#include \"esp_heap_caps.h\"\n\n#define TAG \"TFT_DMA\"\n\n\/\/ Hardware pin definitions\n#define PIN_NUM_MISO  -1\n#define PIN_NUM_MOSI  13\n#define PIN_NUM_CLK   14\n#define PIN_NUM_CS    4\n#define PIN_NUM_DC    15\n#define PIN_NUM_RST   2\n#define PIN_NUM_LED   27\n\n\/\/ Screen resolution\n#define TFT_WIDTH     240\n#define TFT_HEIGHT    320\n\n\/\/ ST7789 command definitions\n#define ST7789_SWRESET 0x01\n#define ST7789_SLPOUT  0x11\n#define ST7789_DISPON  0x29\n#define ST7789_CASET   0x2A\n#define ST7789_RASET   0x2B\n#define ST7789_RAMWR   0x2C\n\nspi_device_handle_t spi;\nuint8_t *frame_buffer = NULL;\n\n\/* SPI pre-transfer callback: sets DC pin *\/\nstatic void IRAM_ATTR spi_pre_transfer_callback(spi_transaction_t *t) {\n    gpio_set_level(PIN_NUM_DC, (int)t-&gt;user);\n}\n\n\/* Send command to TFT *\/\nvoid tft_send_cmd(uint8_t cmd) {\n    spi_transaction_t t = {\n        .length = 8,\n        .tx_buffer = &amp;cmd,\n        .user = (void*)0,\n    };\n    spi_device_polling_transmit(spi, &amp;t);\n}\n\n\/* Send data to TFT *\/\nvoid tft_send_data(uint8_t *data, uint16_t len) {\n    spi_transaction_t t = {\n        .length = len * 8,\n        .tx_buffer = data,\n        .user = (void*)1,\n    };\n    spi_device_polling_transmit(spi, &amp;t);\n}\n\n\/* Set display window area *\/\nvoid tft_set_window(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) {\n    uint8_t buf[4];\n\n    buf[0] = x1 &gt;&gt; 8; buf[1] = x1 &amp; 0xFF;\n    buf[2] = x2 &gt;&gt; 8; buf[3] = x2 &amp; 0xFF;\n    tft_send_cmd(ST7789_CASET);\n    tft_send_data(buf, 4);\n\n    buf[0] = y1 &gt;&gt; 8; buf[1] = y1 &amp; 0xFF;\n    buf[2] = y2 &gt;&gt; 8; buf[3] = y2 &amp; 0xFF;\n    tft_send_cmd(ST7789_RASET);\n    tft_send_data(buf, 4);\n}\n\n\/* Fill the entire screen with a color using DMA *\/\nvoid tft_fill_color_dma(uint16_t color) {\n    if (!frame_buffer) {\n        frame_buffer = (uint8_t *)heap_caps_malloc(TFT_WIDTH * TFT_HEIGHT * 2, MALLOC_CAP_DMA);\n        if (!frame_buffer) {\n            ESP_LOGE(TAG, \"Frame buffer allocation failed\");\n            return;\n        }\n    }\n\n    \/\/ Fill DMA buffer with color (RGB565 format)\n    for (int i = 0; i &lt; TFT_WIDTH * TFT_HEIGHT; i++) {\n        frame_buffer[i * 2]     = color &gt;&gt; 8;\n        frame_buffer[i * 2 + 1] = color &amp; 0xFF;\n    }\n\n    tft_set_window(0, 0, TFT_WIDTH - 1, TFT_HEIGHT - 1);\n    tft_send_cmd(ST7789_RAMWR);\n\n    \/\/ DMA SPI transfer for full frame\n    spi_transaction_t t = {\n        .length = TFT_WIDTH * TFT_HEIGHT * 16,\n        .tx_buffer = frame_buffer,\n        .user = (void*)1\n    };\n\n    ESP_ERROR_CHECK(spi_device_queue_trans(spi, &amp;t, portMAX_DELAY));\n    spi_transaction_t *ret;\n    ESP_ERROR_CHECK(spi_device_get_trans_result(spi, &amp;ret, portMAX_DELAY));\n}\n\n\/* Initialize TFT display *\/\nvoid tft_init() {\n    \/\/ Configure GPIO\n    gpio_config_t io_conf = {\n        .pin_bit_mask = (1ULL &lt;&lt; PIN_NUM_LED) | (1ULL &lt;&lt; PIN_NUM_DC) | (1ULL &lt;&lt; PIN_NUM_RST),\n        .mode = GPIO_MODE_OUTPUT,\n    };\n    gpio_config(&amp;io_conf);\n\n    gpio_set_level(PIN_NUM_RST, 0);\n    vTaskDelay(pdMS_TO_TICKS(100));\n    gpio_set_level(PIN_NUM_RST, 1);\n    vTaskDelay(pdMS_TO_TICKS(120));\n\n    \/\/ Initialize SPI bus\n    spi_bus_config_t buscfg = {\n        .mosi_io_num = PIN_NUM_MOSI,\n        .miso_io_num = PIN_NUM_MISO,\n        .sclk_io_num = PIN_NUM_CLK,\n        .quadwp_io_num = -1,\n        .quadhd_io_num = -1,\n        .max_transfer_sz = TFT_WIDTH * TFT_HEIGHT * 2,\n    };\n    ESP_ERROR_CHECK(spi_bus_initialize(SPI2_HOST, &amp;buscfg, SPI_DMA_CH_AUTO));\n\n    spi_device_interface_config_t devcfg = {\n        .clock_speed_hz = 40 * 1000 * 1000,\n        .mode = 0,\n        .spics_io_num = PIN_NUM_CS,\n        .queue_size = 7,\n        .pre_cb = spi_pre_transfer_callback,\n    };\n    ESP_ERROR_CHECK(spi_bus_add_device(SPI2_HOST, &amp;devcfg, &amp;spi));\n\n    \/\/ Initialize TFT controller\n    tft_send_cmd(ST7789_SWRESET);\n    vTaskDelay(pdMS_TO_TICKS(150));\n\n    tft_send_cmd(ST7789_SLPOUT);\n    vTaskDelay(pdMS_TO_TICKS(120));\n\n    uint8_t colmod_cmd[] = {0x3A, 0x55}; \/\/ Set color mode to RGB565\n    tft_send_cmd(colmod_cmd[0]);\n    tft_send_data(&amp;colmod_cmd[1], 1);\n\n    tft_send_cmd(ST7789_DISPON);\n    vTaskDelay(pdMS_TO_TICKS(120));\n\n    gpio_set_level(PIN_NUM_LED, 1);\n}\n\n\/* Main function *\/\nvoid app_main(void) {\n    tft_init();\n    ESP_LOGI(TAG, \"TFT initialized with DMA\");\n\n    while (1) {\n        tft_fill_color_dma(0xF800); \/\/ Red\n        vTaskDelay(pdMS_TO_TICKS(1000));\n\n        tft_fill_color_dma(0x07E0); \/\/ Green\n        vTaskDelay(pdMS_TO_TICKS(1000));\n\n        tft_fill_color_dma(0x001F); \/\/ Blue\n        vTaskDelay(pdMS_TO_TICKS(1000));\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>\u9019\u6bb5\u7a0b\u5f0f\u78bc\u5c55\u793a\u4e86\u5982\u4f55\u5728 ESP32 \u4e0a\u4f7f\u7528 <strong>SPI DMA<\/strong> \u50b3\u8f38\u4f86\u63d0\u5347 TFT LCD\uff08\u4f7f\u7528 ST7789 \u63a7\u5236\u5668\uff09\u986f\u793a\u6548\u7387\uff0c\u4e26\u642d\u914d <strong>LVGL \u7684 Render \u6982\u5ff5<\/strong>\u5960\u5b9a\u5e95\u5c64\u9ad8\u901f\u5237\u65b0\u80fd\u529b<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u7de8\u8b6f\u548c\u71d2\u9304-1\">\u7de8\u8b6f\u548c\u71d2\u9304<\/h2>\n\n\n\n<p>\u5b8c\u6210\u7a0b\u5f0f\u78bc\u5f8c\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 <a href=\"https:\/\/www.espressif.com\/en\/products\/sdks\/esp-idf\" target=\"_blank\" rel=\"noopener\">ESP-IDF<\/a> \u63d0\u4f9b\u7684\u547d\u4ee4\u9032\u884c\u7de8\u8b6f\u3001\u71d2\u9304\u548c\u76e3\u63a7\u3002<\/p>\n\n\n\n<p>\u5728 VS Code \u7684\u5de6\u4e0b\u89d2 ESP-IDF \u5de5\u5177\u5217\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u9ede\u9078 <strong>Build project<\/strong><\/li>\n\n\n\n<li>\u9ede\u9078 <strong>Flash device<\/strong><\/li>\n\n\n\n<li>\u9ede\u9078 <strong>Monitor device<\/strong><\/li>\n<\/ul>\n\n\n\n<p>\u7576\u7a0b\u5f0f\u555f\u52d5\u5f8c\uff0cTFT \u986f\u793a\u5668\u6703\u4e0d\u65b7\u5faa\u74b0\u986f\u793a\u4e09\u7a2e\u7d14\u8272\u756b\u9762\uff0c\u6bcf\u4e00\u79d2\u5207\u63db\u4e00\u6b21\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u7d05\u8272\u756b\u9762<\/strong> (<code>0xF800<\/code>)\uff1aRGB565 \u683c\u5f0f\u4e2d\u7684\u7d05\u8272\uff0c\u986f\u793a 1 \u79d2<\/li>\n\n\n\n<li><strong>\u7da0\u8272\u756b\u9762<\/strong> (<code>0x07E0<\/code>)\uff1a\u986f\u793a 1 \u79d2<\/li>\n\n\n\n<li><strong>\u85cd\u8272\u756b\u9762<\/strong> (<code>0x001F<\/code>)\uff1a\u986f\u793a 1 \u79d2<\/li>\n\n\n\n<li>\u7136\u5f8c\u5f9e\u982d\u958b\u59cb\u91cd\u8907<\/li>\n<\/ol>\n\n\n\n<p>\u9019\u4ee3\u8868\u6574\u500b\u87a2\u5e55\u6bcf\u79d2\u90fd\u88ab\u5b8c\u6574\u5237\u65b0\u4e00\u6b21\uff0c\u4e26\u4e14\u7531 DMA \u76f4\u63a5\u628a frame buffer \u7684\u5167\u5bb9\u50b3\u9001\u7d66 LCD\uff0c\u5927\u5e45\u6e1b\u5c11 CPU \u5e72\u9810\u548c\u5361\u9813\u7684\u53ef\u80fd\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u7d50\u8ad6\">\u7d50\u8ad6<\/h2>\n\n\n\n<p>\u5728 LVGL Render \u5d4c\u5165\u5f0f\u7cfb\u7d71\u4e2d\uff0c<strong>CPU \u662f\u73cd\u8cb4\u8cc7\u6e90<\/strong>\u3002\u50b3\u7d71 SPI \u50b3\u8f38\u65b9\u5f0f\u4e0d\u50c5\u8017\u6642\uff0c\u9084\u6703\u9020\u6210\u7cfb\u7d71\u53cd\u61c9\u9072\u920d\u3002\u800c DMA \u7684\u5f15\u5165\uff0c\u8b93\u4f60\u80fd\u4ee5<strong>\u6975\u4f4e CPU \u8ca0\u8f09\u5b8c\u6210\u5168\u87a2\u5e55\u8cc7\u6599\u8f38\u51fa<\/strong>\u3002<\/p>\n\n\n\n<p>\u96d6\u7136\u9019\u4e00\u7bc7\u9084\u672a\u5be6\u969b\u63a5\u4e0a LVGL Render\uff0c\u4f46\u9019\u5957\u5e95\u5c64\u67b6\u69cb\uff0c<strong>\u5c31\u662f\u65e5\u5f8c\u8207 LVGL \u6574\u5408\u6642\u771f\u6b63\u8b93\u756b\u9762\u8dd1\u5f97\u6d41\u66a2\u7684\u6838\u5fc3\u95dc\u9375<\/strong>\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator alignwide has-text-color has-palette-color-1-color has-alpha-channel-opacity has-palette-color-1-background-color has-background is-style-wide\"\/>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>LVGL Render \u5982\u679c\u4f60\u66fe\u5728 ESP32 \u4e0a\u958b\u767c\u904e UI\uff0c\u4f7f\u7528 LVGL\uff08Light and Versa [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3605,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,53,83],"tags":[27,21,44,9,11],"class_list":["post-3584","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-module","category-esp32","category-featured","tag-c","tag-ide","tag-programming-language","tag-python","tag-tutorial"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/saludpcb.com\/zh\/wp-json\/wp\/v2\/posts\/3584","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/saludpcb.com\/zh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/saludpcb.com\/zh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/saludpcb.com\/zh\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/saludpcb.com\/zh\/wp-json\/wp\/v2\/comments?post=3584"}],"version-history":[{"count":20,"href":"https:\/\/saludpcb.com\/zh\/wp-json\/wp\/v2\/posts\/3584\/revisions"}],"predecessor-version":[{"id":3613,"href":"https:\/\/saludpcb.com\/zh\/wp-json\/wp\/v2\/posts\/3584\/revisions\/3613"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/saludpcb.com\/zh\/wp-json\/wp\/v2\/media\/3605"}],"wp:attachment":[{"href":"https:\/\/saludpcb.com\/zh\/wp-json\/wp\/v2\/media?parent=3584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/saludpcb.com\/zh\/wp-json\/wp\/v2\/categories?post=3584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/saludpcb.com\/zh\/wp-json\/wp\/v2\/tags?post=3584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}