MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / createPanel

Method createPanel

Drivers/ST7796-i8080/Source/St7796i8080Display.cpp:87–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87bool St7796i8080Display::createPanel() {
88 LOGGER.info("Configuring panel");
89
90 // Create ST7796 panel
91 esp_lcd_panel_dev_config_t panel_config = {
92 .reset_gpio_num = configuration.resetPin,
93 .rgb_ele_order = LCD_RGB_ELEMENT_ORDER_BGR,
94 .data_endian = LCD_RGB_DATA_ENDIAN_LITTLE,
95 .bits_per_pixel = 16,
96 .flags = {
97 .reset_active_high = false
98 },
99 .vendor_config = nullptr
100 };
101
102 if (esp_lcd_new_panel_st7796(ioHandle, &panel_config, &panelHandle) != ESP_OK) {
103 LOGGER.error("Failed to create panel");
104 return false;
105 }
106
107 // Reset panel
108 if (esp_lcd_panel_reset(panelHandle) != ESP_OK) {
109 LOGGER.error("Failed to reset panel");
110 return false;
111 }
112
113 // Initialize panel
114 if (esp_lcd_panel_init(panelHandle) != ESP_OK) {
115 LOGGER.error("Failed to init panel");
116 return false;
117 }
118
119 // Set swap XY
120 if (esp_lcd_panel_swap_xy(panelHandle, configuration.swapXY) != ESP_OK) {
121 LOGGER.error("Failed to swap XY ");
122 return false;
123 }
124
125 // Set mirror
126 if (esp_lcd_panel_mirror(panelHandle, configuration.mirrorX, configuration.mirrorY) != ESP_OK) {
127 LOGGER.error("Failed to set panel to mirror");
128 return false;
129 }
130
131 // Set inversion
132 if (esp_lcd_panel_invert_color(panelHandle, configuration.invertColor) != ESP_OK) {
133 LOGGER.error("Failed to set panel to invert");
134 return false;
135 }
136
137 // Turn on display
138 if (esp_lcd_panel_disp_on_off(panelHandle, true) != ESP_OK) {
139 LOGGER.error("Failed to turn display on");
140 return false;
141 }
142
143 return true;
144}

Callers

nothing calls this directly

Calls 2

infoMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected