#ifndef PANEL_H #define PANEL_H #include "panel_device.h" class Panel { public: explicit Panel(IPanelDevice &device) : device_(&device), esp_io_(nullptr), esp_panel_(nullptr), esp_panel_config_( (esp_lcd_panel_dev_config_t) { .reset_gpio_num = device_->rst_num_, .bits_per_pixel = 1, .vendor_config = device_->vendor_config(), } ) { esp_io_ = device_->create_io_handle(); device_->create_panel(esp_panel_config_, esp_io_, esp_panel_); 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)); } ~Panel() = default; IPanelDevice *device_; esp_lcd_panel_io_handle_t esp_io_; esp_lcd_panel_handle_t esp_panel_; private: esp_lcd_panel_dev_config_t esp_panel_config_; }; #endif //PANEL_H