ESPHome 2026.11.0b6
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 this->buffer_[pos + 0] = static_cast<uint8_t>((rgb565 >> 8) & 0xFF);
149 this->buffer_[pos + 1] = static_cast<uint8_t>(rgb565 & 0xFF);
150 } else {
151 this->buffer_[pos + 0] = static_cast<uint8_t>(rgb565 & 0xFF);
152 this->buffer_[pos + 1] = static_cast<uint8_t>((rgb565 >> 8) & 0xFF);
153 }
155 const size_t alpha_pos = pos / 2 + this->buffer_width_ * this->buffer_height_ * 2;
156 this->buffer_[alpha_pos] = color.w;
157 }
158 break;
159 }
161 uint32_t pos = this->get_position_(x, y);
162 Color mapped_color = color;
163 this->map_chroma_key(mapped_color);
164 this->buffer_[pos + 0] = mapped_color.b;
165 this->buffer_[pos + 1] = mapped_color.g;
166 this->buffer_[pos + 2] = mapped_color.r;
168 this->buffer_[pos + 3] = color.w;
169 }
170 break;
171 }
172 }
173}
174
177 if (color.g == 1 && color.r == 0 && color.b == 0) {
178 color.g = 0;
179 }
180 if (color.w < 0x80) {
181 color.r = 0;
182 color.g = this->type_ == image::IMAGE_TYPE_RGB565 ? 4 : 1;
183 color.b = 0;
184 }
185 }
186}
187
188#ifdef USE_LVGL
190 if (this->data_start_ == nullptr && this->placeholder_ != nullptr) {
191 this->dsc_ = *this->placeholder_->get_lv_image_dsc();
192 return &this->dsc_;
193 }
194 return Image::get_lv_image_dsc();
195}
196#endif
197
198#ifdef USE_LVGL_IMAGE
199void RuntimeImage::add_lvgl_widget(lv_obj_t *obj) {
200 if (std::find(this->lvgl_widgets_.begin(), this->lvgl_widgets_.end(), obj) != this->lvgl_widgets_.end())
201 return;
202 this->lvgl_widgets_.push_back(obj);
203 lv_obj_add_event_cb(obj, lvgl_widget_deleted, LV_EVENT_DELETE, this);
204}
205
206void RuntimeImage::lvgl_widget_deleted(lv_event_t *event) {
207 auto *image = static_cast<RuntimeImage *>(lv_event_get_user_data(event));
208 auto &widgets = image->lvgl_widgets_;
209 widgets.erase(std::remove(widgets.begin(), widgets.end(), lv_event_get_target_obj(event)), widgets.end());
210}
211#endif
212
214#ifdef USE_LVGL
215 // Not a virtual call: this also runs from the destructor
216 lv_image_dsc_t *dsc = this->RuntimeImage::get_lv_image_dsc();
217#ifdef USE_LVGL_IMAGE
218 auto &widgets = this->lvgl_widgets_;
219 for (size_t i = 0; i < widgets.size();) {
220 lv_obj_t *obj = widgets[i];
221 if (lv_image_get_src(obj) == dsc) {
222 // Setting the same source makes the widget read the size again, and redraws it
223 ::lv_image_set_src(obj, dsc);
224 i++;
225 } else {
226 lv_obj_remove_event_cb_with_user_data(obj, lvgl_widget_deleted, this);
227 widgets.erase(widgets.begin() + i);
228 }
229 }
230#endif
231#endif
232}
233
234void RuntimeImage::draw(int x, int y, display::Display *display, Color color_on, Color color_off) {
235 if (this->data_start_) {
236 // If we have a complete image, use the base class draw method
237 Image::draw(x, y, display, color_on, color_off);
238 } else if (this->placeholder_) {
239 // Show placeholder while the runtime image is not available
240 this->placeholder_->draw(x, y, display, color_on, color_off);
241 }
242 // If no image is loaded and no placeholder, nothing to draw
243}
244
245bool RuntimeImage::begin_decode(size_t expected_size, ImageFormat format) {
246 if (this->is_decoding()) {
247 ESP_LOGW(TAG, "Decoding already in progress");
248 return false;
249 }
250
251 if (format == AUTO && this->format_ != AUTO) {
252 // Fall back to the configured format before the reuse check below
253 format = this->format_;
254 }
255
256 // An idle decoder for a different format cannot be reused
257 if (this->decoder_ != nullptr && this->decoder_->get_format() != format) {
258 ESP_LOGD(TAG, "Decoder format mismatch: current: %s, new: %s",
259 LOG_STR_ARG(get_format_name(this->decoder_->get_format())), LOG_STR_ARG(get_format_name(format)));
260 this->decoder_ = nullptr;
261 }
262
263 if (!this->decoder_) {
264 this->decoder_ = this->create_decoder_(format);
265 if (!this->decoder_) {
266 ESP_LOGE(TAG, "Failed to create decoder for format %s", LOG_STR_ARG(get_format_name(format)));
267 return false;
268 }
269 }
270
271 this->decoded_bytes_ = 0;
272
273 int result = this->decoder_->prepare(expected_size);
274 if (result < 0) {
275 ESP_LOGE(TAG, "Failed to prepare decoder: %d", result);
276 this->decoder_ = nullptr; // If prepare fails, a full reset is needed
277 return false;
278 }
279 return true;
280}
281
282int RuntimeImage::feed_data(uint8_t *data, size_t len) {
283 if (!this->is_decoding()) {
284 ESP_LOGE(TAG, "No decoder initialized");
285 return -1;
286 }
287
288 int consumed = this->decoder_->decode(data, len);
289 if (consumed > 0) {
290 this->decoded_bytes_ += consumed;
291 }
292
293 return consumed;
294}
295
297 if (!this->decoder_supports_source()) {
298 ESP_LOGE(TAG, "Decoder cannot read a source");
300 }
301 return this->decoder_->begin_source(source);
302}
303
305 if (!this->is_decoding()) {
306 ESP_LOGE(TAG, "No decoder initialized");
308 }
309 const int result = this->decoder_->decode_step();
310 if (result == DECODE_STEP_DONE)
311 this->decoded_bytes_ = this->decoder_->get_decoded_bytes();
312 return result;
313}
314
316 if (!this->is_decoding()) {
317 return false;
318 }
319
320 // Finalize the image for display
321 if (this->is_double_buffered_()) {
322 if (this->buffer_ != nullptr) {
323 // Show the new image, and decode into the old one's buffer next time
324 std::swap(this->front_buffer_, this->buffer_);
325 std::swap(this->width_, this->buffer_width_);
326 std::swap(this->height_, this->buffer_height_);
327 this->data_start_ = this->front_buffer_;
328 this->refresh_lvgl_();
329 }
330 } else if (!this->progressive_display_) {
331 // Only now make the image visible
332 this->width_ = this->buffer_width_;
333 this->height_ = this->buffer_height_;
334 this->data_start_ = this->buffer_;
335 this->refresh_lvgl_();
336 }
337
338 // End the session; the decoder object stays warm so the next decode can
339 // reuse it (and its buffers) without churning the heap.
340 this->decoder_->reset();
341
342 ESP_LOGD(TAG, "Decoding complete: %dx%d, %zu bytes", this->width_, this->height_, this->decoded_bytes_);
343 return true;
344}
345
346bool RuntimeImage::is_decode_finished() const { return this->is_decoding() && this->decoder_->is_finished(); }
347
348bool RuntimeImage::decoder_knows_end() const { return this->is_decoding() && this->decoder_->knows_end(); }
349
351 this->release_buffer_();
352 if (this->front_buffer_) {
353 RAMAllocator<uint8_t> allocator;
354 allocator.deallocate(this->front_buffer_, this->get_buffer_size(this->width_, this->height_));
355 this->front_buffer_ = nullptr;
356 this->data_start_ = nullptr;
357 this->width_ = 0;
358 this->height_ = 0;
359 this->refresh_lvgl_();
360 }
361 // End any active decode session; decoders free the format-specific working buffers
362 // they can (PNG), while the decoder object itself is kept warm for the next decode.
363 if (this->decoder_) {
364 this->decoder_->reset();
365 }
366}
367
369 if (!this->is_double_buffered_()) {
370 this->release();
371 return;
372 }
373 if (this->decoder_) {
374 this->decoder_->reset();
375 }
376}
377
379 if (this->buffer_) {
380 if (this->external_buffer_) {
381 // The caller owns this memory and goes on using it after the image lets go of it.
382 ESP_LOGV(TAG, "Letting go of the external %dx%d buffer", this->buffer_width_, this->buffer_height_);
383 this->external_buffer_ = false;
384 } else {
385 ESP_LOGV(TAG, "Releasing buffer of size %zu", this->get_buffer_size(this->buffer_width_, this->buffer_height_));
386 RAMAllocator<uint8_t> allocator;
387 allocator.deallocate(this->buffer_, this->get_buffer_size(this->buffer_width_, this->buffer_height_));
388 }
389 const bool shown = this->data_start_ == this->buffer_;
390 this->buffer_ = nullptr;
391 this->buffer_width_ = 0;
392 this->buffer_height_ = 0;
393 // With double buffering the buffer decoded into is not the one on show
394 if (shown) {
395 this->data_start_ = nullptr;
396 this->width_ = 0;
397 this->height_ = 0;
398 this->refresh_lvgl_();
399 }
400 }
401}
402
403bool RuntimeImage::set_external_buffer(uint8_t *buffer, int width, int height) {
404 if (this->is_double_buffered_()) {
405 ESP_LOGE(TAG, "An external buffer cannot be double buffered");
406 return false;
407 }
408 this->release_buffer_();
409 if (buffer == nullptr || this->get_buffer_size(width, height) == 0) {
410 // Keep the released state rather than remembering a buffer that cannot be decoded into: an
411 // external buffer that is never handed back would otherwise block every later allocation.
412 ESP_LOGE(TAG, "Refusing an invalid external buffer for %dx%d", width, height);
413 return false;
414 }
415 this->buffer_ = buffer;
416 this->external_buffer_ = true;
417 this->buffer_width_ = width;
418 this->buffer_height_ = height;
419 return true;
420}
421
422size_t RuntimeImage::resize_buffer_(int width, int height) {
423 size_t new_size = this->get_buffer_size(width, height);
424
425 // A buffer only ever exists with dimensions the image can decode at, so a match here means
426 // new_size is non-zero. Checking it before the invalid dimension case below lets the external
427 // buffer be let go of for every decode it cannot serve, not just for valid other dimensions.
428 if (this->buffer_ && this->buffer_width_ == width && this->buffer_height_ == height) {
429 // Buffer already allocated with correct size
430 return new_size;
431 }
432
433 if (this->external_buffer_) {
434 ESP_LOGE(TAG, "Image decoded to %dx%d, but the external buffer is %dx%d", width, height, this->buffer_width_,
435 this->buffer_height_);
436 // Let the buffer go rather than free memory that belongs to the caller. Dropping it also stops
437 // a decoder that ignores this failure from publishing a picture it never painted.
438 this->release_buffer_();
439 return 0;
440 }
441
442 if (new_size == 0) {
443 ESP_LOGE(TAG, "Refusing to allocate buffer for invalid image dimensions %dx%d", width, height);
444 return 0;
445 }
446
447 // Release old buffer if dimensions changed
448 if (this->buffer_) {
449 this->release_buffer_();
450 }
451
452 ESP_LOGD(TAG, "Allocating buffer: %dx%d, %zu bytes", width, height, new_size);
453 RAMAllocator<uint8_t> allocator;
454 this->buffer_ = allocator.allocate(new_size);
455
456 if (!this->buffer_) {
457 ESP_LOGE(TAG, "Failed to allocate %zu bytes. Largest free block: %zu", new_size,
458 allocator.get_max_free_block_size());
459 return 0;
460 }
461
462 // Clear buffer
463 memset(this->buffer_, 0, new_size);
464
465 this->buffer_width_ = width;
466 this->buffer_height_ = height;
467
468 return new_size;
469}
470
471size_t RuntimeImage::get_buffer_size(int width, int height) const {
472 // Dimensions come from a remote image header; reject absurd values so the size math cannot overflow
473 if (width <= 0 || height <= 0 || width > MAX_IMAGE_DIMENSION || height > MAX_IMAGE_DIMENSION) {
474 return 0;
475 }
477 // Add extra alpha channel for RGB565 with alpha
478 return static_cast<size_t>(width) * height * 3;
479 }
480 return (static_cast<size_t>(this->get_bpp()) * width + 7u) / 8u * height;
481}
482
483int RuntimeImage::get_position_(int x, int y) const { return (x + y * this->buffer_width_) * this->get_bpp() / 8; }
484
485std::unique_ptr<ImageDecoder> RuntimeImage::create_decoder_(ImageFormat format) {
486 ESP_LOGV(TAG, "Creating decoder for format %s", LOG_STR_ARG(get_format_name(format)));
487 switch (format) {
488#ifdef USE_RUNTIME_IMAGE_BMP
489 case BMP:
490 return make_unique<BmpDecoder>(this);
491#endif
492#ifdef USE_RUNTIME_IMAGE_JPEG
493 case JPEG:
494 return make_unique<JpegDecoder>(this);
495#endif
496#ifdef USE_RUNTIME_IMAGE_PNG
497 case PNG:
498 return make_unique<PngDecoder>(this);
499#endif
500#ifdef USE_RUNTIME_IMAGE_QOI
501 case QOI:
502 return make_unique<QoiDecoder>(this);
503#endif
504 case AUTO:
505 ESP_LOGE(TAG, "Image format could not be determined; set `format:` explicitly in the configuration");
506 return nullptr;
507 default:
508 ESP_LOGE(TAG, "Unsupported image format: %s", LOG_STR_ARG(get_format_name(format)));
509 return nullptr;
510 }
511}
512
513} // namespace esphome::runtime_image
An STL allocator that uses SPI or internal RAM.
Definition helpers.h:2396
void deallocate(T *p, size_t n)
Definition helpers.h:2453
size_t get_max_free_block_size() const
Return the maximum size block this allocator could allocate.
Definition helpers.h:2501
T * allocate(size_t n)
Definition helpers.h:2423
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:309
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:168
void draw(int x, int y, display::Display *display, Color color_on, Color color_off) override
Definition image.cpp:31
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
const char * format
@ 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:41
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:1150
const void size_t len
Definition hal.h:68
size_t size_t pos
Definition helpers.h:1333
static void uint32_t
uint8_t w
Definition color.h:48
uint8_t g
Definition color.h:40
uint8_t b
Definition color.h:44
uint8_t r
Definition color.h:36
uint16_t x
Definition tt21100.cpp:5
uint16_t y
Definition tt21100.cpp:6