1#if defined(USE_ESP32) && defined(USE_ESP32_VARIANT_ESP32S3)
12static constexpr size_t QSPI_DBI_MAX_LOG_BYTES = 64;
57 this->
width_ - w - this->x_low_);
59 this->x_low_ = this->
width_;
75 uint16_t new_color = display::ColorUtil::color_to_565(color);
76 if (this->
buffer_[pos] !=
static_cast<uint8_t
>(new_color >> 8)) {
77 this->
buffer_[
pos] =
static_cast<uint8_t
>(new_color >> 8);
81 new_color = new_color & 0xFF;
83 if (this->
buffer_[pos] != new_color) {
126 ESP_LOGVV(TAG,
"Set addr %d/%d, %d/%d", x1, y1, x2, y2);
133 put16_be(buf + 2, y2);
136 put16_be(buf + 2, x2);
145 if (w <= 0 ||
h <= 0)
157 for (
int y = 0;
y !=
h;
y++) {
158 memcpy(this->
buffer_ + ((
y + y_start) * this->
width_ + x_start) * 2,
173 bool big_endian,
int x_offset,
int y_offset,
int x_pad) {
179 const int first_col = std::max(0, -x_start), end_col = std::min(
w,
static_cast<int>(this->
width_) - x_start);
180 const int first_row = std::max(0, -
y_start), end_row = std::min(
h,
static_cast<int>(this->
height_) - y_start);
181 if (first_col >= end_col || first_row >= end_row)
187 for (
int y = first_row;
y != end_row;
y++) {
188 memcpy(this->
buffer_ + ((y_start +
y) * this->
width_ + x_start + first_col) * 2,
191 this->
x_low_ = std::min<int>(this->
x_low_, x_start + first_col);
192 this->
y_low_ = std::min<int>(this->
y_low_, y_start + first_row);
193 this->
x_high_ = std::max<int>(this->
x_high_, x_start + end_col - 1);
194 this->
y_high_ = std::max<int>(this->
y_high_, y_start + end_row - 1);
208 for (
int y = 0;
y !=
h;
y++) {
215#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE
218 ESP_LOGV(TAG,
"Command %02X, length %d, bytes %s", cmd,
len,
227 while (index != vec.size()) {
228 if (vec.size() - index < 2) {
229 ESP_LOGE(TAG,
"Malformed init sequence");
232 uint8_t cmd = vec[index++];
233 uint8_t
x = vec[index++];
234 if (
x == DELAY_FLAG) {
235 ESP_LOGV(TAG,
"Delay %dms", cmd);
238 uint8_t num_args =
x & 0x7F;
239 if (vec.size() - index < num_args) {
240 ESP_LOGE(TAG,
"Malformed init sequence");
243 const auto *
ptr = vec.data() + index;
251 ESP_LOGCONFIG(
"",
"QSPI_DBI Display");
252 ESP_LOGCONFIG(
"",
"Model: %s", this->
model_);
256 " Draw rounding: %u\n"
257 " SPI Data rate: %uMHz",
259 LOG_PIN(
" CS Pin: ", this->
cs_);
void set_timeout(const char *name, uint32_t timeout, std::function< void()> &&f)
Set a timeout function with a const char* name.
virtual void digital_write(bool value)=0
int int int const uint8_t ColorOrder ColorBitness bitness
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
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_
void write_sequence_(const std::vector< uint8_t > &vec)
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 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
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 copy_to_buffer_(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)
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)
@ DISPLAY_ROTATION_0_DEGREES
@ BIT_ORDER_MSB_FIRST
The most significant bit is transmitted/received first.
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 HOT delay(uint32_t ms)