1#if defined(USE_ESP32) && defined(USE_ESP32_VARIANT_ESP32S3)
10static constexpr size_t QSPI_DBI_MAX_LOG_BYTES = 64;
53 this->
width_ - w - this->x_low_);
55 this->x_low_ = this->
width_;
68 uint32_t pos = (
y * this->
width_) + x;
72 if (this->
buffer_[pos] !=
static_cast<uint8_t
>(new_color >> 8)) {
73 this->
buffer_[pos] =
static_cast<uint8_t
>(new_color >> 8);
77 new_color = new_color & 0xFF;
79 if (this->
buffer_[pos] != new_color) {
122 ESP_LOGVV(TAG,
"Set addr %d/%d, %d/%d", x1, y1, x2, y2);
129 put16_be(buf + 2, y2);
132 put16_be(buf + 2, x2);
140 if (w <= 0 ||
h <= 0)
144 Display::draw_pixels_at(x_start, y_start, w,
h, ptr, order, bitness, big_endian, x_offset, y_offset, x_pad);
147 auto stride = x_offset + w + x_pad;
148 for (
int y = 0;
y !=
h;
y++) {
149 memcpy(this->
buffer_ + ((
y + y_start) * this->
width_ + x_start) * 2,
150 ptr + ((
y + y_offset) * stride + x_offset) * 2, w * 2);
168 if (x_offset == 0 && x_pad == 0 && y_offset == 0) {
172 auto stride = x_offset + w + x_pad;
174 for (
int y = 0;
y !=
h;
y++) {
175 this->
write_cmd_addr_data(0, 0, 0, 0, ptr + ((
y + y_offset) * stride + x_offset) * 2, w * 2, 4);
181#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE
184 ESP_LOGV(TAG,
"Command %02X, length %d, bytes %s", cmd,
len,
193 while (index != vec.size()) {
194 if (vec.size() - index < 2) {
195 ESP_LOGE(TAG,
"Malformed init sequence");
198 uint8_t cmd = vec[index++];
199 uint8_t
x = vec[index++];
200 if (
x == DELAY_FLAG) {
201 ESP_LOGV(TAG,
"Delay %dms", cmd);
204 uint8_t num_args =
x & 0x7F;
205 if (vec.size() - index < num_args) {
206 ESP_LOGE(TAG,
"Malformed init sequence");
209 const auto *ptr = vec.data() + index;
217 ESP_LOGCONFIG(
"",
"QSPI_DBI Display");
218 ESP_LOGCONFIG(
"",
"Model: %s", this->
model_);
219 ESP_LOGCONFIG(TAG,
" Height: %u", this->
height_);
220 ESP_LOGCONFIG(TAG,
" Width: %u", this->
width_);
222 LOG_PIN(
" CS Pin: ", this->
cs_);
224 ESP_LOGCONFIG(TAG,
" SPI Data rate: %dMHz", (
unsigned) (this->
data_rate_ / 1000000));
void set_timeout(const std::string &name, uint32_t timeout, std::function< void()> &&f)
Set a timeout function with a unique name.
virtual void digital_write(bool value)=0
static uint16_t color_to_565(Color color, ColorOrder color_order=ColorOrder::COLOR_ORDER_RGB)
void write_sequence_(const std::vector< uint8_t > &vec)
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
int get_width_internal() override
void set_addr_window_(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
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)
void write_command_(uint8_t cmd, const uint8_t *bytes, size_t len)
the RM67162 in quad SPI mode seems to work like this (not in the datasheet, this is deduced from the ...
void write_init_sequence_()
display::ColorOrder color_mode_
void dump_config() override
void reset_params_(bool ready=false)
std::vector< std::vector< uint8_t > > init_sequences_
int get_height_internal() override
void draw_absolute_pixel_internal(int x, int y, Color color) override
void spi_setup() override
void write_cmd_addr_data(size_t cmd_bits, uint32_t cmd, size_t addr_bits, uint32_t address, const uint8_t *data, size_t length, uint8_t bus_width=1)
@ BIT_ORDER_MSB_FIRST
The most significant bit is transmitted/received first.
Providing packet encoding functions for exchanging data with a remote host.
char * format_hex_pretty_to(char *buffer, size_t buffer_size, const uint8_t *data, size_t length, char separator)
Format byte array as uppercase hex to buffer (base implementation).
constexpr size_t format_hex_pretty_size(size_t byte_count)
Calculate buffer size needed for format_hex_pretty_to with separator: "XX:XX:...:XX\0".
void IRAM_ATTR HOT delay(uint32_t ms)