1 #ifdef USE_ESP32_VARIANT_ESP32S3 6 namespace rpi_dpi_rgb {
9 ESP_LOGCONFIG(TAG,
"Setting up RPI_DPI_RGB");
11 esp_lcd_rgb_panel_config_t config{};
12 config.flags.fb_in_psram = 1;
13 #if ESP_IDF_VERSION_MAJOR >= 5 14 config.bounce_buffer_size_px = this->
width_ * 10;
16 #endif // ESP_IDF_VERSION_MAJOR 17 config.timings.h_res = this->
width_;
18 config.timings.v_res = this->
height_;
27 config.clk_src = LCD_CLK_SRC_PLL160M;
28 config.psram_trans_align = 64;
30 for (
size_t i = 0; i != data_pin_count; i++) {
33 config.data_width = data_pin_count;
34 config.disp_gpio_num = -1;
39 esp_err_t err = esp_lcd_new_rgb_panel(&config, &this->
handle_);
41 ESP_LOGE(TAG,
"lcd_new_rgb_panel failed: %s", esp_err_to_name(err));
45 ESP_ERROR_CHECK(esp_lcd_panel_reset(this->
handle_));
46 ESP_ERROR_CHECK(esp_lcd_panel_init(this->
handle_));
47 ESP_LOGCONFIG(TAG,
"RPI_DPI_RGB setup complete");
50 #if ESP_IDF_VERSION_MAJOR >= 5 52 esp_lcd_rgb_panel_restart(this->
handle_);
53 #endif // ESP_IDF_VERSION_MAJOR 63 return display::Display::draw_pixels_at(x_start, y_start, w, h, ptr, order, bitness, big_endian, x_offset, y_offset,
68 esp_err_t err = ESP_OK;
70 if (x_offset == 0 && x_pad == 0 && y_offset == 0) {
72 err = esp_lcd_panel_draw_bitmap(this->
handle_, x_start, y_start, x_start + w, y_start + h, ptr);
75 auto stride = x_offset + w + x_pad;
76 for (
int y = 0;
y !=
h;
y++) {
77 err = esp_lcd_panel_draw_bitmap(this->
handle_, x_start,
y + y_start, x_start + w,
y + y_start + 1,
78 ptr + ((
y + y_offset) * stride + x_offset) * 2);
84 ESP_LOGE(TAG,
"lcd_lcd_panel_draw_bitmap failed: %s", esp_err_to_name(err));
135 ESP_LOGCONFIG(
"",
"RPI_DPI_RGB LCD");
136 ESP_LOGCONFIG(TAG,
" Height: %u", this->
height_);
137 ESP_LOGCONFIG(TAG,
" Width: %u", this->
width_);
138 LOG_PIN(
" DE Pin: ", this->
de_pin_);
142 for (
size_t i = 0; i != data_pin_count; i++)
143 ESP_LOGCONFIG(TAG,
" Data pin %d: %s", i, (this->
data_pins_[i])->dump_summary().c_str());
166 #endif // USE_ESP32_VARIANT_ESP32S3 virtual void digital_write(bool value)=0
void reset_display_() const
InternalGPIOPin * data_pins_[16]
static uint16_t color_to_565(Color color, ColorOrder color_order=ColorOrder::COLOR_ORDER_RGB)
uint16_t hsync_front_porch_
void draw_pixels_at(int x_start, int y_start, int w, int h, const uint8_t *ptr, display::ColorOrder order, display::ColorBitness bitness, bool big_endian, int x_offset, int y_offset, int x_pad) override
uint16_t vsync_pulse_width_
int get_height_internal() override
InternalGPIOPin * de_pin_
uint16_t hsync_back_porch_
int get_height() override
Rect get_clipping() const
Get the current the clipping rectangle.
virtual uint8_t get_pin() const =0
uint16_t hsync_pulse_width_
uint16_t vsync_front_porch_
constexpr14 T convert_big_endian(T val)
Convert a value between host byte order and big endian (most significant byte first) order...
Application App
Global storage of Application pointer - only one Application can exist.
int get_width_internal() override
void dump_config() override
void swap(optional< T > &x, optional< T > &y)
DisplayRotation rotation_
InternalGPIOPin * pclk_pin_
uint16_t vsync_back_porch_
InternalGPIOPin * vsync_pin_
virtual void mark_failed()
Mark this component as failed.
Implementation of SPI Controller mode.
InternalGPIOPin * hsync_pin_
virtual void draw_pixels_at(int x_start, int y_start, int w, int h, const uint8_t *ptr, ColorOrder order, ColorBitness bitness, bool big_endian, int x_offset, int y_offset, int x_pad)
Given an array of pixels encoded in the nominated format, draw these into the display's buffer...
esp_lcd_panel_handle_t handle_
void draw_pixel_at(int x, int y, Color color) override
void IRAM_ATTR HOT delay(uint32_t ms)