18 this->
enabled_ = (config.brightness > 0);
26 ESP_LOGCONFIG(TAG,
"Setting up HUB75Display...");
31 ESP_LOGE(TAG,
"Failed to initialize HUB75 driver!");
39 LOG_DISPLAY(
"",
"HUB75",
this);
42 " Panel: %dx%d pixels\n"
43 " Layout: %dx%d panels\n"
44 " Virtual Display: %dx%d pixels",
51 static_cast<int>(
config_.scan_wiring),
static_cast<int>(
config_.shift_driver));
54 " Pins: R1:%i, G1:%i, B1:%i, R2:%i, G2:%i, B2:%i\n"
55 " Pins: A:%i, B:%i, C:%i, D:%i, E:%i\n"
56 " Pins: LAT:%i, OE:%i, CLK:%i",
62 " Clock Speed: %" PRIu32
" MHz\n"
63 " Latch Blanking: %i\n"
65 " Min Refresh Rate: %i Hz\n"
69 TRUEFALSE(
config_.clk_phase_inverted),
config_.min_refresh_rate, HUB75_BIT_DEPTH,
108 if (!color.
is_on() && fill_rect.
x == 0 && fill_rect.
y == 0 && fill_rect.
w == this->get_width_internal() &&
109 fill_rect.
h == this->get_height_internal()) {
114 driver_->fill(fill_rect.
x, fill_rect.
y, fill_rect.
w, fill_rect.
h, color.
r, color.
g, color.
b);
134 ColorBitness bitness,
bool big_endian,
int x_offset,
int y_offset,
143 Hub75ColorOrder color_order = Hub75ColorOrder::RGB;
148 format = Hub75PixelFormat::RGB565;
152#if LV_COLOR_DEPTH == 32
154 format = Hub75PixelFormat::RGB888_32;
157 color_order = Hub75ColorOrder::RGB;
158#elif LV_COLOR_DEPTH == 24
160 format = Hub75PixelFormat::RGB888;
163 color_order = Hub75ColorOrder::BGR;
165 ESP_LOGE(TAG,
"Unsupported LV_COLOR_DEPTH: %d", LV_COLOR_DEPTH);
170 format = Hub75PixelFormat::RGB888;
173 color_order = Hub75ColorOrder::BGR;
176 ESP_LOGE(TAG,
"Unsupported bitness: %d",
static_cast<int>(
bitness));
189 for (
int yy = 0; yy <
h; ++yy) {
190 const size_t row_offset = ((
y_offset + yy) * stride_px +
x_offset) * bytes_per_pixel;
191 const uint8_t *row_ptr =
ptr + row_offset;
201 if (this->
driver_ !=
nullptr) {
202 this->
driver_->set_brightness(brightness);
209 return Hub75Rotation::ROTATE_90;
211 return Hub75Rotation::ROTATE_180;
213 return Hub75Rotation::ROTATE_270;
215 return Hub75Rotation::ROTATE_0;
221 case Hub75Rotation::ROTATE_90:
223 case Hub75Rotation::ROTATE_180:
225 case Hub75Rotation::ROTATE_270:
234 const Hub75Rotation hub75_rotation = to_hub75_rotation(rotation);
235 if (this->
driver_ ==
nullptr) {
236 this->
config_.rotation = hub75_rotation;
239 this->
driver_->set_rotation(hub75_rotation);
243 return to_display_rotation(this->
driver_ ==
nullptr ? this->
config_.rotation : this->driver_->get_rotation());
bool clip(int x, int y)
Check if pixel is within region of display.
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
Rect get_clipping() const
Get the current the clipping rectangle.
int int int const uint8_t ColorOrder ColorBitness bool int x_offset
int16_t x
X coordinate of corner.
int16_t h
Height of region.
int16_t y
Y coordinate of corner.
bool is_set() const ESPHOME_ALWAYS_INLINE
Y coordinate of corner.
int16_t w
Width of region.
void draw_pixel_at(int x, int y, Color color) override
HUB75Display(const Hub75Config &config)
void set_brightness(uint8_t brightness)
display::DisplayRotation get_rotation() const override
int get_width_internal() 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
void dump_config() override
void fill(Color color) override
void set_rotation(display::DisplayRotation rotation) override
int get_height_internal() override
@ DISPLAY_ROTATION_0_DEGREES
@ DISPLAY_ROTATION_270_DEGREES
@ DISPLAY_ROTATION_180_DEGREES
@ DISPLAY_ROTATION_90_DEGREES
ESPHOME_LOG_TAG(TAG, "hub75")
bool is_on() ESPHOME_ALWAYS_INLINE