11
11
#include " lvgl_v8_port.h"
12
12
#include " lv_demos.h"
13
13
14
+ #define EXAMPLE_LCD_USE_EXTERNAL_INIT_CMD (0 )
15
+
14
16
using namespace esp_panel ::drivers;
15
17
using namespace esp_panel ::board;
16
18
17
19
static const char *TAG = " example" ;
20
+ #if EXAMPLE_LCD_USE_EXTERNAL_INIT_CMD
21
+ static const esp_panel_lcd_vendor_init_cmd_t external_init_cmd[] = {
22
+ // {cmd, { data }, data_size, delay_ms}
23
+ // {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x13}, 5, 0},
24
+ // {0xEF, (uint8_t []){0x08}, 1, 0},
25
+ // {0xFF, (uint8_t []){0x77, 0x01, 0x00, 0x00, 0x10}, 5, 0},
26
+ // ...
27
+ };
28
+ #endif // EXAMPLE_LCD_USE_EXTERNAL_INIT_CMD
18
29
19
30
extern " C" void app_main ()
20
31
{
@@ -23,22 +34,41 @@ extern "C" void app_main()
23
34
24
35
ESP_LOGI (TAG, " Initializing board" );
25
36
ESP_UTILS_CHECK_FALSE_EXIT (board->init (), " Board init failed" );
37
+
26
38
#if LVGL_PORT_AVOID_TEARING_MODE
27
- auto lcd = board->getLCD ();
28
- // When avoid tearing function is enabled, the frame buffer number should be set in the board driver
29
- lcd->configFrameBufferNumber (LVGL_PORT_DISP_BUFFER_NUM);
30
- #if ESP_PANEL_DRIVERS_BUS_ENABLE_RGB && CONFIG_IDF_TARGET_ESP32S3
31
- auto lcd_bus = lcd->getBus ();
39
+ {
40
+ auto lcd = board->getLCD ();
41
+ // When avoid tearing function is enabled, the frame buffer number should be set in the board driver
42
+ lcd->configFrameBufferNumber (LVGL_PORT_DISP_BUFFER_NUM);
43
+ # if ESP_PANEL_DRIVERS_BUS_ENABLE_RGB && CONFIG_IDF_TARGET_ESP32S3
44
+ auto lcd_bus = lcd->getBus ();
45
+ /* *
46
+ * As the anti-tearing feature typically consumes more PSRAM bandwidth, for the ESP32-S3, we need to utilize the
47
+ * "bounce buffer" functionality to enhance the RGB data bandwidth.
48
+ * This feature will consume `bounce_buffer_size * bytes_per_pixel * 2` of SRAM memory.
49
+ */
50
+ if (lcd_bus->getBasicAttributes ().type == ESP_PANEL_BUS_TYPE_RGB) {
51
+ static_cast <BusRGB *>(lcd_bus)->configRGB_BounceBufferSize (lcd->getFrameWidth () * 10 );
52
+ }
53
+ # endif
54
+ }
55
+ #endif // LVGL_PORT_AVOID_TEARING_MODE
56
+
57
+ #if EXAMPLE_LCD_USE_EXTERNAL_INIT_CMD
58
+ ESP_LOGI (TAG, " Using external LCD init command" );
59
+ {
60
+ auto lcd = board->getLCD ();
61
+ ESP_UTILS_CHECK_FALSE_EXIT (
62
+ lcd->configVendorCommands (external_init_cmd, sizeof (external_init_cmd) / sizeof (external_init_cmd[0 ])),
63
+ " LCD init failed"
64
+ );
65
+ }
32
66
/* *
33
- * As the anti-tearing feature typically consumes more PSRAM bandwidth, for the ESP32-S3, we need to utilize the
34
- * "bounce buffer" functionality to enhance the RGB data bandwidth.
35
- * This feature will consume `bounce_buffer_size * bytes_per_pixel * 2` of SRAM memory.
67
+ * In addition, you can also get handles to any other devices (like touch) and use `config*()` functions to
68
+ * configure or replace default parameters, but this must be completed before `board->begin()`
36
69
*/
37
- if (lcd_bus->getBasicAttributes ().type == ESP_PANEL_BUS_TYPE_RGB) {
38
- static_cast <BusRGB *>(lcd_bus)->configRGB_BounceBufferSize (lcd->getFrameWidth () * 10 );
39
- }
40
- #endif
41
- #endif
70
+ #endif // EXAMPLE_LCD_USE_EXTERNAL_INIT_CMD
71
+
42
72
ESP_UTILS_CHECK_FALSE_EXIT (board->begin (), " Board begin failed" );
43
73
44
74
ESP_LOGI (TAG, " Initializing LVGL" );
0 commit comments