ESPHome 2026.12.0-dev
Loading...
Searching...
No Matches
runtime_image.cpp
Go to the documentation of this file.
1#include "runtime_image.h"
2#include "image_decoder.h"
4#include "esphome/core/log.h"
5#include <algorithm>
6#include <utility>
7#include <cstdint>
8#include <cstring>
9#include <limits>
10
11#ifdef USE_RUNTIME_IMAGE_BMP
12#include "bmp_decoder.h"
13#endif
14#ifdef USE_RUNTIME_IMAGE_JPEG
15#include "jpeg_decoder.h"
16#endif
17#ifdef USE_RUNTIME_IMAGE_PNG
18#include "png_decoder.h"
19#endif
20#ifdef USE_RUNTIME_IMAGE_QOI
21#include "qoi_decoder.h"
22#endif
23
24namespace esphome::runtime_image {
25
26ESPHOME_LOG_TAG(TAG, "runtime_image");
27
28// Widest supported format is 4 bytes/pixel, so 32767 * 32767 * 4 still fits a 32-bit size_t
29static constexpr int MAX_IMAGE_DIMENSION = 32767;
30static constexpr int MAX_IMAGE_BPP = 32;
31static_assert((static_cast<uint64_t>(MAX_IMAGE_BPP) * MAX_IMAGE_DIMENSION + 7) / 8 * MAX_IMAGE_DIMENSION <=
32 std::numeric_limits<size_t>::max(),
33 "MAX_IMAGE_DIMENSION must keep the worst-case buffer size within size_t");
34
35inline bool is_color_on(const Color &color) {
36 // This produces the most accurate monochrome conversion, but is slightly slower.
37 // return (0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b) > 127;
38
39 // Approximation using fast integer computations; produces acceptable results
40 // Equivalent to 0.25 * R + 0.5 * G + 0.25 * B
41 return ((color.r >> 2) + (color.g >> 1) + (color.b >> 2)) & 0x80;
42}
43
45 image::Image *placeholder, bool is_big_endian, int fixed_width, int fixed_height)
46 : Image(nullptr, 0, 0, type, transparency, is_big_endian),
47 format_(format),
48 fixed_width_(fixed_width),
49 fixed_height_(fixed_height),
50 placeholder_(placeholder) {}
51
53#ifdef USE_LVGL_IMAGE
54 for (lv_obj_t *obj : this->lvgl_widgets_)
55 lv_obj_remove_event_cb_with_user_data(obj, lvgl_widget_deleted, this);
56 this->lvgl_widgets_.clear();
57#endif
58 this->release();
59}
60
61int RuntimeImage::resize(int width, int height) {
62 // Use fixed dimensions if specified (0 means auto-resize)
63 int target_width = this->fixed_width_ ? this->fixed_width_ : width;
64 int target_height = this->fixed_height_ ? this->fixed_height_ : height;
65
66 // When both fixed dimensions are set, scale uniformly to preserve aspect ratio
67 if (this->fixed_width_ && this->fixed_height_ && width > 0 && height > 0) {
68 float scale =
69 std::min(static_cast<float>(this->fixed_width_) / width, static_cast<float>(this->fixed_height_) / height);
70 target_width = static_cast<int>(width * scale);
71 target_height = static_cast<int>(height * scale);
72 }
73
74 size_t result = this->resize_buffer_(target_width, target_height);
75 if (result > 0 && this->progressive_display_) {
76 // Update display dimensions for progressive display
77 this->width_ = this->buffer_width_;
78 this->height_ = this->buffer_height_;
79 this->data_start_ = this->buffer_;
80 this->refresh_lvgl_();
81 }
82 return result;
83}
84
85void RuntimeImage::draw_pixel(int x, int y, const Color &color) {
86 if (!this->buffer_) {
87 ESP_LOGE(TAG, "Buffer not allocated!");
88 return;
89 }
90 if (x < 0 || y < 0 || x >= this->buffer_width_ || y >= this->buffer_height_) {
91 ESP_LOGE(TAG, "Tried to paint a pixel (%d,%d) outside the image!", x, y);
92 return;
93 }
94
95 switch (this->type_) {
97 const uint32_t width_8 = ((this->buffer_width_ + 7u) / 8u) * 8u;
98 uint32_t pos = x + y * width_8;
99 auto bitno = 0x80 >> (pos % 8u);
100 pos /= 8u;
101 auto on = is_color_on(color);
102 if (this->has_transparency() && color.w < 0x80)
103 on = false;
104 assign_bits(this->buffer_[pos], bitno, on);
105 break;
106 }
108 uint8_t bits = (color.r >> 7) << 2 | (color.g >> 7) << 1 | (color.b >> 7);
109 if (this->bpp_ == 4)
110 bits = bits << 1 | (color.w >> 7);
111 const uint32_t stride = (this->buffer_width_ * this->bpp_ + 7u) / 8u;
112 const uint32_t bitpos = y * stride * 8 + x * this->bpp_;
113 uint8_t *byte = this->buffer_ + bitpos / 8;
114 // Place the pixel in a 16-bit window so it may straddle two bytes.
115 const uint8_t shift = 16 - this->bpp_ - bitpos % 8;
116 const uint16_t mask = ((1u << this->bpp_) - 1) << shift;
117 const uint16_t value = bits << shift;
118 byte[0] = (byte[0] & ~(mask >> 8)) | (value >> 8);
119 if (mask & 0xFF)
120 byte[1] = (byte[1] & ~(mask & 0xFF)) | (value & 0xFF);
121 break;
122 }
124 uint32_t pos = this->get_position_(x, y);
125 // 0.2125, 0.7154 and 0.0721 in 1/256ths, summing to 256 so white stays 255. Integer maths: the S3 has no
126 // double FPU
127 auto gray = static_cast<uint8_t>((54 * color.r + 183 * color.g + 19 * color.b) >> 8);
129 if (gray == 1) {
130 gray = 0;
131 }
132 if (color.w < 0x80) {
133 gray = 1;
134 }
136 if (color.w != 0xFF)
137 gray = color.w;
138 }
139 this->buffer_[pos] = gray;
140 break;
141 }
143 const size_t pos = (x + y * this->buffer_width_) * 2;
144 Color mapped_color = color;
145 this->map_chroma_key(mapped_color);
146 uint16_t rgb565 = display::ColorUtil::color_to_565(mapped_color);
147 if (this->big_endian_) {
148 put_be16(this->buffer_ + pos, rgb565);
149 } else {
150 put_le16(this->buffer_ + pos, rgb565);
151 }
153 const size_t alpha_pos = pos / 2 + this->buffer_width_ * this->buffer_height_ * 2;
154 this->buffer_[alpha_pos] = color.w;
155 }
156 break;
157 }
159 uint32_t pos = this->get_position_(x, y);
160 Color mapped_color = color;
161 this->map_chroma_key(mapped_color);
162 this->buffer_[pos + 0] = mapped_color.b;
163 this->buffer_[pos + 1] = mapped_color.g;
164 this->buffer_[pos + 2] = mapped_color.r;
166 this->buffer_[pos + 3] = color.w;
167 }
168 break;
169 }
170 }
171}
172
175 if (color.g == 1 && color.r == 0 && color.b == 0) {
176 color.g = 0;
177 }
178 if (color.w < 0x80) {
179 color.r = 0;
180 color.g = this->type_ == image::IMAGE_TYPE_RGB565 ? 4 : 1;
181 color.b = 0;
182 }
183 }
184}
185
186#ifdef USE_LVGL
188 if (this->data_start_ == nullptr && this->placeholder_ != nullptr) {
189 this->dsc_ = *this->placeholder_->get_lv_image_dsc();
190 return &this->dsc_;
191 }
192 return Image::get_lv_image_dsc();
193}
194#endif
195
196#ifdef USE_LVGL_IMAGE
197void RuntimeImage::add_lvgl_widget(lv_obj_t *obj) {
198 if (std::find(this->lvgl_widgets_.begin(), this->lvgl_widgets_.end(), obj) != this->lvgl_widgets_.end())
199 return;
200 this->lvgl_widgets_.push_back(obj);
201 lv_obj_add_event_cb(obj, lvgl_widget_deleted, LV_EVENT_DELETE, this);
202}
203
204void RuntimeImage::lvgl_widget_deleted(lv_event_t *event) {
205 auto *image = static_cast<RuntimeImage *>(lv_event_get_user_data(event));
206 auto &widgets = image->lvgl_widgets_;
207 widgets.erase(std::remove(widgets.begin(), widgets.end(), lv_event_get_target_obj(event)), widgets.end());
208}
209#endif
210
212#ifdef USE_LVGL
213 // Not a virtual call: this also runs from the destructor
214 lv_image_dsc_t *dsc = this->RuntimeImage::get_lv_image_dsc();
215#ifdef USE_LVGL_IMAGE
216 auto &widgets = this->lvgl_widgets_;
217 for (size_t i = 0; i < widgets.size();) {
218 lv_obj_t *obj = widgets[i];
219 if (lv_image_get_src(obj) == dsc) {
220 // Setting the same source makes the widget read the size again, and redraws it
221 ::lv_image_set_src(obj, dsc);
222 i++;
223 } else {
224 lv_obj_remove_event_cb_with_user_data(obj, lvgl_widget_deleted, this);
225 widgets.erase(widgets.begin() + i);
226 }
227 }
228#endif
229#endif
230}
231
232void RuntimeImage::draw(int x, int y, display::Display *display, Color color_on, Color color_off) {
233 if (this->data_start_) {
234 // If we have a complete image, use the base class draw method
235 Image::draw(x, y, display, color_on, color_off);
236 } else if (this->placeholder_) {
237 // Show placeholder while the runtime image is not available
238 this->placeholder_->draw(x, y, display, color_on, color_off);
239 }
240 // If no image is loaded and no placeholder, nothing to draw
241}
242
243bool RuntimeImage::begin_decode(size_t expected_size, ImageFormat format) {
244 if (this->is_decoding()) {
245 ESP_LOGW(TAG, "Decoding already in progress");
246 return false;
247 }
248
249 if (format == AUTO && this->format_ != AUTO) {
250 // Fall back to the configured format before the reuse check below
251 format = this->format_;
252 }
253
254 // An idle decoder for a different format cannot be reused
255 if (this->decoder_ != nullptr && this->decoder_->get_format() != format) {
256 ESP_LOGD(TAG, "Decoder format mismatch: current: %s, new: %s",
257 LOG_STR_ARG(get_format_name(this->decoder_->get_format())), LOG_STR_ARG(get_format_name(format)));
258 this->decoder_ = nullptr;
259 }
260
261 if (!this->decoder_) {
262 this->decoder_ = this->create_decoder_(format);
263 if (!this->decoder_) {
264 ESP_LOGE(TAG, "Failed to create decoder for format %s", LOG_STR_ARG(get_format_name(format)));
265 return false;
266 }
267 }
268
269 this->decoded_bytes_ = 0;
270
271 int result = this->decoder_->prepare(expected_size);
272 if (result < 0) {
273 ESP_LOGE(TAG, "Failed to prepare decoder: %d", result);
274 this->decoder_ = nullptr; // If prepare fails, a full reset is needed
275 return false;
276 }
277 return true;
278}
279
280int RuntimeImage::feed_data(uint8_t *data, size_t len) {
281 if (!this->is_decoding()) {
282 ESP_LOGE(TAG, "No decoder initialized");
283 return -1;
284 }
285
286 int consumed = this->decoder_->decode(data, len);
287 if (consumed > 0) {
288 this->decoded_bytes_ += consumed;
289 }
290
291 return consumed;
292}
293
295 if (!this->decoder_supports_source()) {
296 ESP_LOGE(TAG, "Decoder cannot read a source");
298 }
299 return this->decoder_->begin_source(source);
300}
301
303 if (!this->is_decoding()) {
304 ESP_LOGE(TAG, "No decoder initialized");
306 }
307 const int result = this->decoder_->decode_step();
308 if (result == DECODE_STEP_DONE)
309 this->decoded_bytes_ = this->decoder_->get_decoded_bytes();
310 return result;
311}
312
314 if (!this->is_decoding()) {
315 return false;
316 }
317
318 // Finalize the image for display
319 if (this->is_double_buffered_()) {
320 if (this->buffer_ != nullptr) {
321 // Show the new image, and decode into the old one's buffer next time
322 std::swap(this->front_buffer_, this->buffer_);
323 std::swap(this->width_, this->buffer_width_);
324 std::swap(this->height_, this->buffer_height_);
325 this->data_start_ = this->front_buffer_;
326 this->refresh_lvgl_();
327 }
328 } else if (!this->progressive_display_) {
329 // Only now make the image visible
330 this->width_ = this->buffer_width_;
331 this->height_ = this->buffer_height_;
332 this->data_start_ = this->buffer_;
333 this->refresh_lvgl_();
334 }
335
336 // End the session; the decoder object stays warm so the next decode can
337 // reuse it (and its buffers) without churning the heap.
338 this->decoder_->reset();
339
340 ESP_LOGD(TAG, "Decoding complete: %dx%d, %zu bytes", this->width_, this->height_, this->decoded_bytes_);
341 return true;
342}
343
344bool RuntimeImage::is_decode_finished() const { return this->is_decoding() && this->decoder_->is_finished(); }
345
346bool RuntimeImage::decoder_knows_end() const { return this->is_decoding() && this->decoder_->knows_end(); }
347
349 this->release_buffer_();
350 if (this->front_buffer_) {
351 RAMAllocator<uint8_t> allocator;
352 allocator.deallocate(this->front_buffer_, this->get_buffer_size(this->width_, this->height_));
353 this->front_buffer_ = nullptr;
354 this->data_start_ = nullptr;
355 this->width_ = 0;
356 this->height_ = 0;
357 this->refresh_lvgl_();
358 }
359 // End any active decode session; decoders free the format-specific working buffers
360 // they can (PNG), while the decoder object itself is kept warm for the next decode.
361 if (this->decoder_) {
362 this->decoder_->reset();
363 }
364}
365
367 if (!this->is_double_buffered_()) {
368 this->release();
369 return;
370 }
371 if (this->decoder_) {
372 this->decoder_->reset();
373 }
374}
375
377 if (this->buffer_) {
378 if (this->external_buffer_) {
379 // The caller owns this memory and goes on using it after the image lets go of it.
380 ESP_LOGV(TAG, "Letting go of the external %dx%d buffer", this->buffer_width_, this->buffer_height_);
381 this->external_buffer_ = false;
382 } else {
383 ESP_LOGV(TAG, "Releasing buffer of size %zu", this->get_buffer_size(this->buffer_width_, this->buffer_height_));
384 RAMAllocator<uint8_t> allocator;
385 allocator.deallocate(this->buffer_, this->get_buffer_size(this->buffer_width_, this->buffer_height_));
386 }
387 const bool shown = this->data_start_ == this->buffer_;
388 this->buffer_ = nullptr;
389 this->buffer_width_ = 0;
390 this->buffer_height_ = 0;
391 // With double buffering the buffer decoded into is not the one on show
392 if (shown) {
393 this->data_start_ = nullptr;
394 this->width_ = 0;
395 this->height_ = 0;
396 this->refresh_lvgl_();
397 }
398 }
399}
400
401bool RuntimeImage::set_external_buffer(uint8_t *buffer, int width, int height) {
402 if (this->is_double_buffered_()) {
403 ESP_LOGE(TAG, "An external buffer cannot be double buffered");
404 return false;
405 }
406 this->release_buffer_();
407 if (buffer == nullptr || this->get_buffer_size(width, height) == 0) {
408 // Keep the released state rather than remembering a buffer that cannot be decoded into: an
409 // external buffer that is never handed back would otherwise block every later allocation.
410 ESP_LOGE(TAG, "Refusing an invalid external buffer for %dx%d", width, height);
411 return false;
412 }
413 this->buffer_ = buffer;
414 this->external_buffer_ = true;
415 this->buffer_width_ = width;
416 this->buffer_height_ = height;
417 return true;
418}
419
420size_t RuntimeImage::resize_buffer_(int width, int height) {
421 size_t new_size = this->get_buffer_size(width, height);
422
423 // A buffer only ever exists with dimensions the image can decode at, so a match here means
424 // new_size is non-zero. Checking it before the invalid dimension case below lets the external
425 // buffer be let go of for every decode it cannot serve, not just for valid other dimensions.
426 if (this->buffer_ && this->buffer_width_ == width && this->buffer_height_ == height) {
427 // Buffer already allocated with correct size
428 return new_size;
429 }
430
431 if (this->external_buffer_) {
432 ESP_LOGE(TAG, "Image decoded to %dx%d, but the external buffer is %dx%d", width, height, this->buffer_width_,
433 this->buffer_height_);
434 // Let the buffer go rather than free memory that belongs to the caller. Dropping it also stops
435 // a decoder that ignores this failure from publishing a picture it never painted.
436 this->release_buffer_();
437 return 0;
438 }
439
440 if (new_size == 0) {
441 ESP_LOGE(TAG, "Refusing to allocate buffer for invalid image dimensions %dx%d", width, height);
442 return 0;
443 }
444
445 // Release old buffer if dimensions changed
446 if (this->buffer_) {
447 this->release_buffer_();
448 }
449
450 ESP_LOGD(TAG, "Allocating buffer: %dx%d, %zu bytes", width, height, new_size);
451 RAMAllocator<uint8_t> allocator;
452 this->buffer_ = allocator.allocate(new_size);
453
454 if (!this->buffer_) {
455 ESP_LOGE(TAG, "Failed to allocate %zu bytes. Largest free block: %zu", new_size,
456 allocator.get_max_free_block_size());
457 return 0;
458 }
459
460 // Clear buffer
461 memset(this->buffer_, 0, new_size);
462
463 this->buffer_width_ = width;
464 this->buffer_height_ = height;
465
466 return new_size;
467}
468
469size_t RuntimeImage::get_buffer_size(int width, int height) const {
470 // Dimensions come from a remote image header; reject absurd values so the size math cannot overflow
471 if (width <= 0 || height <= 0 || width > MAX_IMAGE_DIMENSION || height > MAX_IMAGE_DIMENSION) {
472 return 0;
473 }
475 // Add extra alpha channel for RGB565 with alpha
476 return static_cast<size_t>(width) * height * 3;
477 }
478 return (static_cast<size_t>(this->get_bpp()) * width + 7u) / 8u * height;
479}
480
481int RuntimeImage::get_position_(int x, int y) const { return (x + y * this->buffer_width_) * this->get_bpp() / 8; }
482
483std::unique_ptr<ImageDecoder> RuntimeImage::create_decoder_(ImageFormat format) {
484 ESP_LOGV(TAG, "Creating decoder for format %s", LOG_STR_ARG(get_format_name(format)));
485 switch (format) {
486#ifdef USE_RUNTIME_IMAGE_BMP
487 case BMP:
488 return make_unique<BmpDecoder>(this);
489#endif
490#ifdef USE_RUNTIME_IMAGE_JPEG
491 case JPEG:
492 return make_unique<JpegDecoder>(this);
493#endif
494#ifdef USE_RUNTIME_IMAGE_PNG
495 case PNG:
496 return make_unique<PngDecoder>(this);
497#endif
498#ifdef USE_RUNTIME_IMAGE_QOI
499 case QOI:
500 return make_unique<QoiDecoder>(this);
501#endif
502 case AUTO:
503 ESP_LOGE(TAG, "Image format could not be determined; set `format:` explicitly in the configuration");
504 return nullptr;
505 default:
506 ESP_LOGE(TAG, "Unsupported image format: %s", LOG_STR_ARG(get_format_name(format)));
507 return nullptr;
508 }
509}
510
511} // namespace esphome::runtime_image
An STL allocator that uses SPI or internal RAM.
Definition helpers.h:2670
void deallocate(T *p, size_t n)
Definition helpers.h:2727
size_t get_max_free_block_size() const
Return the maximum size block this allocator could allocate.
Definition helpers.h:2775
T * allocate(size_t n)
Definition helpers.h:2697
const uint8_t * data_start_
Definition image.h:67
int get_bpp() const
Definition image.h:36
bool has_transparency() const
Definition image.h:43
ImageType type_
Definition image.h:66
ImageType get_type() const
Definition image.cpp:324
Transparency transparency_
Definition image.h:68
lv_img_dsc_t dsc_
Definition image.h:72
virtual lv_image_dsc_t * get_lv_image_dsc()
Definition image.cpp:183
void draw(int x, int y, display::Display *display, Color color_on, Color color_off) override
Definition image.cpp:45
Input that a decoder reads itself as it goes, so the whole image never has to be in memory at once.
A dynamic image that can be loaded and decoded at runtime.
int decode_step()
Decode a little more from the source; see ImageDecoder::decode_step().
static void lvgl_widget_deleted(lv_event_t *event)
bool begin_decode(size_t expected_size=0, ImageFormat format=AUTO)
Begin decoding an image.
bool is_decoding() const
Check if decoding is currently in progress.
void draw(int x, int y, display::Display *display, Color color_on, Color color_off) override
size_t get_buffer_size(int width, int height) const
Get the buffer size in bytes needed for a picture of the given dimensions.
int buffer_width_
Actual width of the current image.
int begin_source(DecodeSource *source)
Decode from a source the decoder reads itself, in place of feed_data().
bool end_decode()
Complete the decoding process.
int get_position_(int x, int y) const
Get the position in the buffer for a pixel.
const int fixed_height_
Fixed height requested on configuration, or 0 if not specified.
void release_buffer_()
Release only the image buffer without resetting the decoder.
void abort_decode()
End a decode that will not be finished.
int resize(int width, int height)
Resize the image buffer to the requested dimensions.
int feed_data(uint8_t *data, size_t len)
Feed data to the decoder.
const int fixed_width_
Fixed width requested on configuration, or 0 if not specified.
bool is_decode_finished() const
Check if the decoder has finished processing all data.
void release()
Release the image buffer and free its memory, ending any decode session.
image::Image * placeholder_
Placeholder image to show when the runtime image is not available.
RuntimeImage(ImageFormat format, image::ImageType type, image::Transparency transparency, image::Image *placeholder=nullptr, bool is_big_endian=false, int fixed_width=0, int fixed_height=0)
Construct a new RuntimeImage object.
bool decoder_knows_end() const
True while decoding and the decoder can tell a complete image from a cut-off one.
const ImageFormat format_
The image format this RuntimeImage is configured to decode.
size_t resize_buffer_(int width, int height)
Resize the image buffer to the requested dimensions.
std::unique_ptr< ImageDecoder > decoder_
lv_image_dsc_t * get_lv_image_dsc() override
Until an image is loaded, the placeholder's descriptor if there is one.
std::vector< lv_obj_t * > lvgl_widgets_
Widgets given this image. One moved to another image is dropped at the next refresh.
void draw_pixel(int x, int y, const Color &color)
std::unique_ptr< ImageDecoder > create_decoder_(ImageFormat format)
Create decoder instance for the requested format.
int buffer_height_
Actual height of the current image.
uint8_t * front_buffer_
With double buffering, the buffer on show, width_ by height_. buffer_ is then the one decoded into.
bool decoder_supports_source() const
Whether the active decoder can read a DecodeSource itself (see begin_source()).
bool set_external_buffer(uint8_t *buffer, int width, int height)
Decode into a buffer the caller owns, instead of one allocated here.
void refresh_lvgl_()
Bring the LVGL descriptor up to date after the image shown changed, and give it again to the widgets ...
void add_lvgl_widget(lv_obj_t *obj) override
bool external_buffer_
Whether buffer_ belongs to the caller, so it must not be freed or resized here.
uint8_t type
uint32_t buffer
Definition gif.cpp:50
@ TRANSPARENCY_ALPHA_CHANNEL
Definition image.h:22
@ TRANSPARENCY_CHROMA_KEY
Definition image.h:21
@ IMAGE_TYPE_GRAYSCALE
Definition image.h:13
@ IMAGE_TYPE_BINARY
Definition image.h:12
@ IMAGE_TYPE_RGB565
Definition image.h:15
@ IMAGE_TYPE_RGB111
Definition image.h:16
@ IMAGE_TYPE_RGB
Definition image.h:14
bool is_color_on(const Color &color)
ESPHOME_LOG_TAG(TAG, "image_decoder.bmp")
ImageFormat
Image format types that can be decoded dynamically.
@ AUTO
Format is supplied per decode, e.g.
const LogString * get_format_name(ImageFormat format)
Human-readable name for a format; "UNKNOWN" if not recognized.
uint32_t value
Definition hal.cpp:59
ESPHOME_ALWAYS_INLINE constexpr void assign_bits(T &value, std::type_identity_t< T > mask, bool on)
Set the bits of mask in value when on is true, clear them otherwise.
Definition helpers.h:1334
const void size_t len
Definition hal.h:68
size_t size_t pos
Definition helpers.h:1530
void const char int const char * format
Definition log.h:110
constexpr uint8_t * put_be16(uint8_t *dst, uint16_t value)
Write the low 16, 24 or 32 bits of value to dst, most significant byte first (be) or least significan...
Definition helpers.h:1296
constexpr uint8_t * put_le16(uint8_t *dst, uint16_t value)
Definition helpers.h:1314
static void uint32_t
uint8_t w
Definition color.h:50
uint8_t g
Definition color.h:42
uint8_t b
Definition color.h:46
uint8_t r
Definition color.h:38
uint16_t x
Definition tt21100.cpp:5
uint16_t y
Definition tt21100.cpp:6
esp_err_t result