1#ifdef USE_ESP32_VARIANT_ESP32S3
5#include <driver/gpio.h>
13 esp_lcd_rgb_panel_config_t config{};
14 config.flags.fb_in_psram = 1;
15 config.bounce_buffer_size_px = this->
width_ * 10;
17 config.timings.h_res = this->
width_;
18 config.timings.v_res = this->
height_;
27 config.clk_src = LCD_CLK_SRC_PLL160M;
29 for (
size_t i = 0; i != data_pin_count; i++) {
30 config.data_gpio_nums[i] =
static_cast<gpio_num_t
>(this->
data_pins_[i]->
get_pin());
32 config.data_width = data_pin_count;
33 config.disp_gpio_num = GPIO_NUM_NC;
36 config.de_gpio_num =
static_cast<gpio_num_t
>(this->
de_pin_->
get_pin());
38 esp_err_t err = esp_lcd_new_rgb_panel(&config, &this->
handle_);
40 esph_log_e(TAG,
"lcd_new_rgb_panel failed: %s", esp_err_to_name(err));
44 ESP_ERROR_CHECK(esp_lcd_panel_reset(this->
handle_));
45 ESP_ERROR_CHECK(esp_lcd_panel_init(this->
handle_));
50 esp_lcd_rgb_panel_restart(this->
handle_);
78 for (
int y = 0;
y !=
h;
y++) {
86 esph_log_e(TAG,
"lcd_lcd_panel_draw_bitmap failed: %s", esp_err_to_name(err));
118 if (this->
dc_pin_ ==
nullptr) {
119 this->
write(value, 9);
130 if (this->
dc_pin_ ==
nullptr) {
131 this->
write(value | 0x100, 9);
154 ESP_LOGV(TAG,
"Delay %dms", cmd);
159 ESP_LOGV(TAG,
"Command %X, %d bytes", cmd,
len);
173 ESP_LOGD(TAG,
"write MADCTL %X",
val);
184 ESP_LOGCONFIG(
"",
"ST7701S RGB LCD");
189 LOG_PIN(
" CS Pin: ", this->
cs_);
190 LOG_PIN(
" DC Pin: ", this->
dc_pin_);
191 LOG_PIN(
" DE Pin: ", this->
de_pin_);
195 for (
size_t i = 0; i != data_pin_count; i++) {
197 ESP_LOGCONFIG(TAG,
" Data pin %d: %s", i, pin_summary);
199 ESP_LOGCONFIG(TAG,
" SPI Data rate: %dMHz", (
unsigned) (this->
data_rate_ / 1000000));
void mark_failed()
Mark this component as failed.
virtual void digital_write(bool value)=0
int int int const uint8_t ColorOrder ColorBitness bitness
void ESPHOME_ALWAYS_INLINE feed_wdt_per_pixel_()
Watchdog feed for per pixel loops.
int int int const uint8_t ColorOrder ColorBitness bool int int y_offset
int int int const uint8_t ColorOrder ColorBitness bool int int int x_pad
int int int const uint8_t * ptr
bool ESPHOME_ALWAYS_INLINE is_point_clipped(int x, int y) const
Whether (x, y) falls outside the active clipping rectangle.
int int int const uint8_t ColorOrder ColorBitness bool big_endian
int int int const uint8_t ColorOrder ColorBitness bool int x_offset
DisplayRotation rotation_
virtual void draw_pixels_internal(int x_start, int y_start, int w, int h, const uint8_t *ptr, ColorBitness bitness, bool big_endian, int x_offset, int y_offset, int x_pad)
Draws a block for draw_pixels_at(); the parameters are the same.
size_t dump_summary(char *buffer, size_t len) const override
void spi_setup() override
void write_byte(uint8_t data)
void write(uint16_t data, size_t num_bits)
void spi_teardown() override
InternalGPIOPin * data_pins_[16]
uint16_t vsync_back_porch_
void write_sequence_(uint8_t cmd, size_t len, const uint8_t *bytes)
this relies upon the init sequence being well-formed, which is guaranteed by the Python init code.
uint16_t vsync_front_porch_
void write_to_display_(int x_start, int y_start, int w, int h, const uint8_t *ptr, int x_offset, int y_offset, int x_pad)
esp_lcd_panel_handle_t handle_
InternalGPIOPin * vsync_pin_
void draw_pixel_at(int x, int y, Color color) override
void draw_pixels_internal(int x_start, int y_start, int w, int h, const uint8_t *ptr, display::ColorBitness bitness, bool big_endian, int x_offset, int y_offset, int x_pad) override
InternalGPIOPin * de_pin_
uint16_t vsync_pulse_width_
void write_data_(uint8_t value)
display::ColorOrder color_mode_
uint16_t hsync_pulse_width_
std::vector< uint8_t > init_sequence_
void dump_config() override
void write_command_(uint8_t value)
InternalGPIOPin * hsync_pin_
uint16_t hsync_back_porch_
InternalGPIOPin * pclk_pin_
uint16_t hsync_front_porch_
void write_init_sequence_()
@ DISPLAY_ROTATION_0_DEGREES
@ DISPLAY_ROTATION_270_DEGREES
@ DISPLAY_ROTATION_180_DEGREES
@ DISPLAY_ROTATION_90_DEGREES
const uint8_t ST7701S_DELAY_FLAG
const uint8_t SW_RESET_CMD
const uint8_t CMD2_BK0[5]
constexpr T convert_big_endian(T val)
Convert a value between host byte order and big endian (most significant byte first) order.
constexpr size_t GPIO_SUMMARY_MAX_LEN
Maximum buffer size for dump_summary output.
void HOT delay(uint32_t ms)