27 lines
757 B
C++
Raw Normal View History

2025-02-15 17:51:57 -05:00
#include "panel.h"
2025-02-15 18:26:26 -05:00
Panel::Panel(IPanelDevice &device) :
device_(&device),
2025-02-16 07:21:16 -05:00
esp_io_(nullptr),
2025-02-15 17:51:57 -05:00
esp_panel_(nullptr),
2025-02-15 18:26:26 -05:00
esp_panel_config_(
2025-02-15 17:51:57 -05:00
(esp_lcd_panel_dev_config_t) {
2025-02-15 18:16:25 -05:00
.reset_gpio_num = device_->rst_num_,
2025-02-15 17:51:57 -05:00
.bits_per_pixel = 1,
2025-02-15 18:26:26 -05:00
.vendor_config = device_->vendor_config(),
2025-02-15 17:51:57 -05:00
}
)
{
2025-02-16 07:21:16 -05:00
esp_io_ = device_->create_io_handle();
2025-02-15 17:51:57 -05:00
2025-02-16 07:21:16 -05:00
device_->create_panel(esp_panel_config_, esp_io_, esp_panel_);
2025-02-15 17:51:57 -05:00
ESP_LOGI(TAG, "Resetting panel display");
ESP_ERROR_CHECK(esp_lcd_panel_reset(esp_panel_));
ESP_LOGI(TAG, "Initializing panel display");
ESP_ERROR_CHECK(esp_lcd_panel_init(esp_panel_));
ESP_LOGI(TAG, "Turning on panel display");
ESP_ERROR_CHECK(esp_lcd_panel_disp_on_off(esp_panel_, true));
}