ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
epaper_spi.cpp
Go to the documentation of this file.
1#include "epaper_spi.h"
2#include <algorithm>
3#include <cinttypes>
6#include "esphome/core/log.h"
8
9namespace esphome::epaper_spi {
10
11ESPHOME_LOG_TAG(TAG, "epaper_spi");
12static constexpr size_t EPAPER_MAX_CMD_LOG_BYTES = 128;
13
14PROGMEM_STRING_TABLE(EPaperStateStrings, "IDLE", "UPDATE", "RESET", "RESET_END", "SHOULD_WAIT", "INITIALISE",
15 "TRANSFER_DATA", "POWER_ON", "REFRESH_SCREEN", "POWER_OFF", "DEEP_SLEEP", "Unknown");
16
18 return EPaperStateStrings::get_log_str(static_cast<uint8_t>(this->state_), EPaperStateStrings::LAST_INDEX);
19}
20
22 if (!this->init_buffer_(this->buffer_length_)) {
23 this->mark_failed(LOG_STR("Failed to initialise buffer"));
24 return;
25 }
26 this->setup_pins_();
27 this->spi_setup();
28}
29
30bool EPaperBase::init_buffer_(size_t buffer_length) {
31 if (!this->buffer_.init(buffer_length)) {
32 return false;
33 }
34 this->clear();
35 return true;
36}
37
39 if (!this->is_using_partial_update_() || this->sent_init_failed_)
40 return false;
41 if (this->sent_.init(length))
42 return true;
43 this->sent_init_failed_ = true;
44 ESP_LOGW(TAG, "No memory for the previous frame; partial updates will send the whole drawn area");
45 return false;
46}
47
50 size_t index = 0;
51 while (index != this->buffer_.size()) {
52 size_t length;
53 const uint8_t *data = this->buffer_.get_span(index, length);
54 for (size_t i = 0; i != length; i++)
55 hash = fnv1a_hash_extend(hash, data[i]);
56 index += length;
57 }
58 return hash;
59}
60
62 this->x_low_ = 0;
63 this->y_low_ = 0;
64 this->x_high_ = this->width_;
65 this->y_high_ = this->height_;
66}
67
69 this->x_low_ = this->width_;
70 this->x_high_ = 0;
71 this->y_low_ = this->height_;
72 this->y_high_ = 0;
73}
74
76 for (auto *pin : this->enable_pins_) {
77 pin->setup();
78 pin->digital_write(true);
79 }
80 this->dc_pin_->setup(); // OUTPUT
81 this->dc_pin_->digital_write(false);
82
83 if (this->reset_pin_ != nullptr) {
84 this->reset_pin_->setup(); // OUTPUT
85 this->reset_pin_->digital_write(true);
86 }
87
88 if (this->busy_pin_ != nullptr) {
89 this->busy_pin_->setup(); // INPUT
90 }
91}
92
94
96 ESP_LOGV(TAG, "Command: 0x%02X", value);
97 this->dc_pin_->digital_write(false);
98 this->enable();
99 this->write_byte(value);
100 this->disable();
101}
102
103// write a command followed by zero or more bytes of data.
104void EPaperBase::cmd_data(uint8_t command, const uint8_t *ptr, size_t length) {
105#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE
106 char hex_buf[format_hex_pretty_size(EPAPER_MAX_CMD_LOG_BYTES)];
107 ESP_LOGV(TAG, "Command: 0x%02X, Length: %d, Data: %s", command, length,
108 format_hex_pretty_to(hex_buf, ptr, length, '.'));
109#endif
110
111 this->dc_pin_->digital_write(false);
112 this->enable();
113 this->write_byte(command);
114 if (length > 0) {
115 this->dc_pin_->digital_write(true);
116 this->write_array(ptr, length);
117 }
118 this->disable();
119}
120
122 if (this->busy_pin_ == nullptr) {
123 return true;
124 }
125 return !this->busy_pin_->digital_read();
126}
127
128bool EPaperBase::reset() { return this->hardware_reset_(); }
129
131 if (this->reset_pin_ != nullptr) {
132 if (this->state_ == EPaperState::RESET) {
133 this->reset_pin_->digital_write(false);
134 return false;
135 }
136 this->reset_pin_->digital_write(true);
137 }
138 return true;
139}
140
142 switch (this->rotation_) {
144 this->effective_transform_ = this->transform_ ^ (SWAP_XY | MIRROR_X);
145 break;
147 this->effective_transform_ = this->transform_ ^ (MIRROR_Y | MIRROR_X);
148 break;
150 this->effective_transform_ = this->transform_ ^ (SWAP_XY | MIRROR_Y);
151 break;
152 default:
153 this->effective_transform_ = this->transform_;
154 break;
155 }
156}
157
159 if (this->state_ != EPaperState::IDLE) {
160 ESP_LOGE(TAG, "Display already in state %s", LOG_STR_ARG(epaper_state_to_string_()));
161 return;
162 }
164 this->enable_loop();
165#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_DEBUG
166 this->update_start_time_ = millis();
167#endif
168}
169
170void EPaperBase::wait_for_idle_(bool should_wait) {
171 // The wait starts when the step's delay ends, or now for a wait in the middle of a step
172 const uint32_t now = millis();
173 this->waiting_for_idle_start_ = static_cast<int32_t>(this->delay_until_ - now) > 0 ? this->delay_until_ : now;
174 this->waiting_for_idle_ = should_wait;
175}
176
184 auto now = millis();
185 // using modulus arithmetic to handle wrap-around
186 int diff = now - this->delay_until_;
187 if (diff < 0) {
188 // Running the loop continuously cannot shorten a delay longer than one loop interval
189 if (-diff > static_cast<int>(App.get_loop_interval())) {
191 } else {
193 }
194 return;
195 }
196 if (this->waiting_for_idle_) {
197 if (this->is_idle_()) {
198 this->waiting_for_idle_ = false;
200#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE
201 ESP_LOGV(TAG, "Screen was busy for %u ms", (unsigned) (millis() - this->waiting_for_idle_start_));
202#endif
203 } else {
204 const uint32_t busy_for = now - this->waiting_for_idle_start_;
205 if (busy_for > this->busy_timeout_seconds_ * 1000u) {
206 this->abandon_update_();
207 return;
208 }
209 if (busy_for > FAST_BUSY_POLL_MS)
211#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE
212 if (now - this->waiting_for_idle_last_print_ >= 1000) {
213 ESP_LOGV(TAG, "Waiting for idle in state %s", LOG_STR_ARG(this->epaper_state_to_string_()));
215 }
216#endif
217 return;
218 }
219 }
220 this->process_state_();
221 if (this->is_failed())
223}
224
225// The busy pin never cleared: give up on this update so later ones are not refused, and make the next one full
227 ESP_LOGE(TAG, "Display stayed busy for %u s in state %s; check the busy pin", (unsigned) this->busy_timeout_seconds_,
228 LOG_STR_ARG(this->epaper_state_to_string_()));
229 this->status_set_warning(LOG_STR("Busy pin timeout"));
231 this->abort_transfer();
232 // Leave the panel powered down rather than with its high-voltage drivers enabled
233 this->power_off();
234 this->full_update_requested_ = true;
235 this->current_data_index_ = 0;
237}
238
248 ESP_LOGV(TAG, "Process state entered in state %s", LOG_STR_ARG(epaper_state_to_string_()));
249 switch (this->state_) {
250 default:
251 ESP_LOGE(TAG, "Display is in unhandled state %s", LOG_STR_ARG(epaper_state_to_string_()));
253 break;
255 this->disable_loop();
256 break;
259 if (this->reset()) {
261 } else {
263 }
264 break;
266 this->do_update_(); // Calls ESPHome (current page) lambda
267 if (this->full_update_requested_) {
268 // Refresh the whole panel even if nothing was drawn
269 this->full_update_requested_ = false;
270 this->update_count_ = 0;
271 this->set_full_bounds_();
272 }
275 return;
276 }
277 if (this->is_using_partial_update_()) {
278 const uint32_t frame_hash = this->buffer_hash_();
279 if (this->update_count_ != 0 && this->shown_hash_valid_ && frame_hash == this->shown_hash_) {
280 ESP_LOGD(TAG, "Frame unchanged, refresh skipped");
281 this->reset_bounds_();
283 return;
284 }
285 this->shown_hash_ = frame_hash;
286 }
287 this->drawn_since_hash_ = false;
288 // Valid again only once this frame is on the panel, so an abandoned update leaves nothing to match
289 this->shown_hash_valid_ = false;
290 // A full update resets update_count_ to zero, so a non-zero count marks a partial one
291 this->partial_ = this->update_count_ != 0;
292 this->sent_count_ = 0;
294 break;
296 if (!this->initialise(this->partial_)) {
297 return; // Not done yet, come back next loop
298 }
300 break;
302 if (!this->transfer_data()) {
303 return; // Not done yet, come back next loop
304 }
305 if (this->sent_.is_valid() && this->sent_count_ == this->sent_.size())
306 this->sent_valid_ = true;
307 // A draw during the chunked push may not have reached the panel, so the next update sends the whole frame
309 if (this->drawn_since_hash_) {
310 this->set_full_bounds_();
311 } else {
312 this->reset_bounds_();
313 }
315 break;
317 this->power_on();
319 break;
321 this->refresh_screen(this->partial_);
322 this->update_count_ = (this->update_count_ + 1) % this->full_update_every_;
324 break;
326 if (!this->after_refresh()) {
327 return; // Not done yet, come back next loop
328 }
329 this->power_off();
331 break;
333 this->deep_sleep();
335 this->status_clear_warning();
337 ESP_LOGD(TAG, "Display update took %" PRIu32 " ms", millis() - this->update_start_time_);
338 break;
339 }
340}
341
343 ESP_LOGV(TAG, "Exit state %s", LOG_STR_ARG(this->epaper_state_to_string_()));
344 this->state_ = state;
345 // allow subclasses to nominate delays
346 if (delay == 0)
347 delay = this->next_delay_;
348 this->next_delay_ = 0;
349 this->delay_until_ = millis() + delay;
351 ESP_LOGV(TAG, "Enter state %s, delay %u, wait_for_idle=%s", LOG_STR_ARG(this->epaper_state_to_string_()), delay,
352 TRUEFALSE(this->waiting_for_idle_));
353 // Each step of an update otherwise waits for the next loop iteration; loop() slows down again for long waits
354 if (state == EPaperState::IDLE) {
356 this->disable_loop();
357 } else {
359 }
360}
361
363 this->dc_pin_->digital_write(true);
364 this->enable();
365}
366
368
369void EPaperBase::send_init_sequence_(const uint8_t *sequence, size_t length) {
370 size_t index = 0;
371
372 while (index != length) {
373 if (length - index < 2) {
374 this->mark_failed(LOG_STR("Malformed init sequence"));
375 return;
376 }
377 const uint8_t cmd = sequence[index++];
378 if (const uint8_t x = sequence[index++]; x == DELAY_FLAG) {
379 ESP_LOGV(TAG, "Delay %dms", cmd);
380 delay(cmd);
381 } else {
382 const uint8_t num_args = x & 0x7F;
383 if (length - index < num_args) {
384 ESP_LOGE(TAG, "Malformed init sequence, cmd = %X, num_args = %u", cmd, num_args);
385 this->mark_failed();
386 return;
387 }
388 this->cmd_data(cmd, sequence + index, num_args);
389 index += num_args;
390 }
391 }
392}
393
394bool EPaperBase::initialise(bool partial) {
396 return true;
397}
398
406 if (this->is_point_clipped(x, y))
407 return false;
408 if (this->effective_transform_ & SWAP_XY)
409 std::swap(x, y);
410 if (this->effective_transform_ & MIRROR_X)
411 x = this->width_ - x - 1;
412 if (this->effective_transform_ & MIRROR_Y)
413 y = this->height_ - y - 1;
414 if (x >= this->width_ || y >= this->height_ || x < 0 || y < 0)
415 return false;
416 this->x_low_ = clamp_at_most(this->x_low_, x);
417 this->x_high_ = clamp_at_least(this->x_high_, x + 1);
418 this->y_low_ = clamp_at_most(this->y_low_, y);
419 this->y_high_ = clamp_at_least(this->y_high_, y + 1);
420 this->drawn_since_hash_ = true;
421 return true;
422}
423
430void HOT EPaperBase::draw_pixel_at(int x, int y, Color color) {
431 if (!rotate_coordinates_(x, y))
432 return;
433 const size_t byte_position = y * this->row_width_ + x / 8;
434 const uint8_t bit_position = x % 8;
435 const uint8_t pixel_bit = 0x80u >> bit_position;
436 const auto original = this->buffer_[byte_position];
437 if (color_to_mono(color) == 0) {
438 this->buffer_[byte_position] = original & ~pixel_bit;
439 } else {
440 this->buffer_[byte_position] = original | pixel_bit;
441 }
442}
443
444namespace {
445// One source row of an RGB565 block, written into a contiguous 1 bit per pixel buffer. Without SwapAxes the row lies
446// along a buffer row and the bit moves by step; with it the row lies along a bit column and the byte moves by step
447// rows.
448template<bool SwapAxes, bool BigEndianSource>
449void HOT write_rgb565_row(uint8_t *byte, uint8_t mask, int step, size_t row_width, const uint8_t *source, int count,
450 const Rgb565ToMono &to_mono) {
451 const ptrdiff_t byte_step = SwapAxes ? step * static_cast<ptrdiff_t>(row_width) : 0;
452 for (; count != 0; count--, source += 2) {
453 const uint16_t value = BigEndianSource ? encode_uint16(source[0], source[1]) : encode_value_le<uint16_t>(source);
454 if (to_mono(value)) {
455 *byte |= mask;
456 } else {
457 *byte &= ~mask;
458 }
459 if constexpr (SwapAxes) {
460 byte += byte_step;
461 } else if (step > 0) {
462 mask >>= 1;
463 if (mask == 0) {
464 mask = 0x80;
465 byte++;
466 }
467 } else {
468 mask <<= 1;
469 if (mask == 0) {
470 mask = 0x01;
471 byte--;
472 }
473 }
474 }
475}
476} // namespace
477
478// Each source column maps to one buffer coordinate and each source row to the other, each moving by 1 per pixel, so
479// the visible part of a block and its dirty area are worked out once for the whole block.
480void HOT EPaperBase::draw_rgb565_block_(uint8_t *buffer, int x_start, int y_start, int w, int h, const uint8_t *ptr,
481 bool big_endian, int x_offset, int y_offset, int x_pad) {
482 const bool swap = this->effective_transform_ & SWAP_XY;
483 const bool mirror_x = this->effective_transform_ & MIRROR_X;
484 const bool mirror_y = this->effective_transform_ & MIRROR_Y;
485 // The buffer axis a source column moves along, and the one a source row moves along
486 const int column_limit = swap ? this->height_ : this->width_;
487 const int row_limit = swap ? this->width_ : this->height_;
488 const bool column_mirrored = swap ? mirror_y : mirror_x;
489 const bool row_mirrored = swap ? mirror_x : mirror_y;
490 const int first_column = std::max(0, -x_start);
491 const int end_column = std::min(w, column_limit - x_start);
492 const int first_row = std::max(0, -y_start);
493 const int end_row = std::min(h, row_limit - y_start);
494 if (first_column >= end_column || first_row >= end_row)
495 return;
496 auto column_to_buffer = [&](int column) {
497 const int u = x_start + column;
498 return column_mirrored ? column_limit - 1 - u : u;
499 };
500 auto row_to_buffer = [&](int row) {
501 const int v = y_start + row;
502 return row_mirrored ? row_limit - 1 - v : v;
503 };
504
505 const int column_low = std::min(column_to_buffer(first_column), column_to_buffer(end_column - 1));
506 const int row_low = std::min(row_to_buffer(first_row), row_to_buffer(end_row - 1));
507 const int columns = end_column - first_column;
508 const int rows = end_row - first_row;
509 const int x_low = swap ? row_low : column_low;
510 const int y_low = swap ? column_low : row_low;
511 const int x_high = x_low + (swap ? rows : columns);
512 const int y_high = y_low + (swap ? columns : rows);
513
514 const Rgb565ToMono to_mono;
515 const size_t line_stride = x_offset + w + x_pad;
516 const size_t row_width = this->row_width_;
517 const int step = column_mirrored ? -1 : 1;
518 for (int row = first_row; row != end_row; row++) {
519 const uint8_t *source = ptr + ((y_offset + row) * line_stride + x_offset + first_column) * 2;
520 const int along = column_to_buffer(first_column);
521 const int across = row_to_buffer(row);
522 const int x = swap ? across : along;
523 const int y = swap ? along : across;
524 uint8_t *byte = buffer + y * row_width + x / 8;
525 const uint8_t mask = 0x80u >> (x % 8);
526 if (swap) {
527 if (big_endian) {
528 write_rgb565_row<true, true>(byte, mask, step, row_width, source, columns, to_mono);
529 } else {
530 write_rgb565_row<true, false>(byte, mask, step, row_width, source, columns, to_mono);
531 }
532 } else if (big_endian) {
533 write_rgb565_row<false, true>(byte, mask, step, row_width, source, columns, to_mono);
534 } else {
535 write_rgb565_row<false, false>(byte, mask, step, row_width, source, columns, to_mono);
536 }
537 }
538 this->x_low_ = clamp_at_most(this->x_low_, x_low);
539 this->x_high_ = clamp_at_least(this->x_high_, x_high);
540 this->y_low_ = clamp_at_most(this->y_low_, y_low);
541 this->y_high_ = clamp_at_least(this->y_high_, y_high);
542 this->drawn_since_hash_ = true;
543}
544
545// Writes an RGB565 block of pixels, as LVGL sends them, straight into a 1 bit per pixel buffer that is one block (the
546// usual case): the same result as draw_pixel_at() for each pixel. Anything else goes through draw_pixel_at().
547void HOT EPaperBase::draw_pixels_internal(int x_start, int y_start, int w, int h, const uint8_t *ptr,
549 int x_pad) {
550 size_t contiguous_length;
551 uint8_t *contiguous = this->buffer_.get_span(0, contiguous_length);
552 if (!this->buffer_is_mono_() || this->get_clipping().is_set() || bitness != COLOR_BITNESS_565 ||
553 contiguous_length != this->buffer_length_) {
555 return;
556 }
558}
559
561 LOG_DISPLAY("", "E-Paper SPI", this);
562 ESP_LOGCONFIG(TAG,
563 " Model: %s\n"
564 " SPI Data Rate: %uMHz\n"
565 " Full update every: %d\n"
566 " Swap X/Y: %s\n"
567 " Mirror X: %s\n"
568 " Mirror Y: %s",
569 this->name_, (unsigned) (this->data_rate_ / 1000000), this->full_update_every_,
570 YESNO(this->transform_ & SWAP_XY), YESNO(this->transform_ & MIRROR_X),
571 YESNO(this->transform_ & MIRROR_Y));
572 LOG_PIN(" Reset Pin: ", this->reset_pin_);
573 LOG_PIN(" DC Pin: ", this->dc_pin_);
574 LOG_PIN(" Busy Pin: ", this->busy_pin_);
575 LOG_PIN(" CS Pin: ", this->cs_);
576 LOG_UPDATE_INTERVAL(this);
577}
578
579} // namespace esphome::epaper_spi
uint32_t get_loop_interval() const
void mark_failed()
Mark this component as failed.
bool is_failed() const
Definition component.h:287
void enable_loop()
Enable this component's loop.
Definition component.h:261
void disable_loop()
Disable this component's loop.
void status_clear_warning()
Definition component.h:309
virtual void setup()=0
virtual void digital_write(bool value)=0
virtual bool digital_read()=0
void stop()
Stop running the loop continuously.
Definition helpers.cpp:841
void start()
Start running the loop continuously.
Definition helpers.cpp:835
int int int const uint8_t ColorOrder ColorBitness bitness
Definition display.h:392
int int int const uint8_t ColorOrder ColorBitness bool int int y_offset
Definition display.h:392
int int int const uint8_t ColorOrder ColorBitness bool int int int x_pad
Definition display.h:392
int int int const uint8_t * ptr
Definition display.h:391
bool ESPHOME_ALWAYS_INLINE is_point_clipped(int x, int y) const
Whether (x, y) falls outside the active clipping rectangle.
Definition display.h:810
int int int const uint8_t ColorOrder ColorBitness bool big_endian
Definition display.h:392
Rect get_clipping() const
Get the current the clipping rectangle.
Definition display.cpp:826
int int int const uint8_t ColorOrder ColorBitness bool int x_offset
Definition display.h:392
DisplayRotation rotation_
Definition display.h:863
virtual void draw_pixels_internal(int x_start, int y_start, int w, int h, const uint8_t *ptr, ColorBitness bitness, bool big_endian, int x_offset, int y_offset, int x_pad)
Draws a block for draw_pixels_at(); the parameters are the same.
Definition display.cpp:119
color_to_mono() of an RGB565 value as ColorUtil::to_color() reads it, from table lookups instead of a...
virtual void power_off()=0
Power the display off.
void command(uint8_t value)
const LogString * epaper_state_to_string_()
void process_state_()
Process the state machine.
virtual void deep_sleep()=0
Place the display into deep sleep.
void draw_pixel_at(int x, int y, Color color) override
Default implementation for monochrome displays where 8 pixels are packed to a byte.
bool init_sent_frame_(size_t length)
virtual bool after_refresh()
Called after the refresh, before power off, repeatedly until it returns true.
Definition epaper_spi.h:194
bool rotate_coordinates_(int &x, int &y)
Check and rotate coordinates based on the transform flags.
void loop() override
Called during the loop task.
virtual void refresh_screen(bool partial)=0
Refresh the screen after data transfer.
virtual bool initialise(bool partial)
void send_init_sequence_(const uint8_t *sequence, size_t length)
virtual bool transfer_data()=0
Methods that must be implemented by concrete classes to control the display.
split_buffer::SplitBuffer buffer_
Definition epaper_spi.h:218
void cmd_data(uint8_t command, const uint8_t *ptr, size_t length)
void draw_rgb565_block_(uint8_t *buffer, int x_start, int y_start, int w, int h, const uint8_t *ptr, bool big_endian, int x_offset, int y_offset, int x_pad)
split_buffer::SplitBuffer sent_
Definition epaper_spi.h:219
void set_state_(EPaperState state, uint16_t delay=0)
virtual void power_on()=0
Power the display on.
HighFrequencyLoopRequester high_frequency_loop_
Definition epaper_spi.h:232
void draw_pixels_internal(int x_start, int y_start, int w, int h, const uint8_t *ptr, ColorBitness bitness, bool big_endian, int x_offset, int y_offset, int x_pad) override
void wait_for_idle_(bool should_wait)
bool hardware_reset_()
The reset pin part of reset(), for a driver that must skip what its parent adds to it.
float get_setup_priority() const override
bool init_buffer_(size_t buffer_length)
std::vector< GPIOPin * > enable_pins_
Definition epaper_spi.h:230
uint32_t data_rate_
Definition spi.h:436
bool init(size_t total_length, size_t max_buffer_size=SIZE_MAX)
const uint8_t * get_span(size_t index, size_t &length) const
bool state
Definition fan.h:2
unsigned count
Definition gif.cpp:51
uint32_t buffer
Definition gif.cpp:50
@ DISPLAY_ROTATION_270_DEGREES
Definition display.h:139
@ DISPLAY_ROTATION_180_DEGREES
Definition display.h:138
@ DISPLAY_ROTATION_90_DEGREES
Definition display.h:137
static void int int int int const uint8_t ColorOrder ColorBitness bool big_endian
Definition display.cpp:101
static void int int int int const uint8_t ColorOrder ColorBitness bitness
Definition display.cpp:100
static void int x_start
Definition display.cpp:62
static void int int int int const uint8_t int x_offset
Definition display.cpp:63
static void int int y_start
Definition display.cpp:62
static void int int int int const uint8_t int int y_offset
Definition display.cpp:63
static void int int int w
Definition display.cpp:62
ESPHOME_LOG_TAG(TAG, "display")
constexpr uint8_t color_to_mono(Color color)
Map an RGB color to a single monochrome bit: 1 = white, 0 = black.
static void int int int int h
Definition display.cpp:62
static void int int int int const uint8_t * ptr
Definition display.cpp:63
static void int int int int const uint8_t int int int x_pad
Definition display.cpp:63
PROGMEM_STRING_TABLE(EPaperStateStrings, "IDLE", "UPDATE", "RESET", "RESET_END", "SHOULD_WAIT", "INITIALISE", "TRANSFER_DATA", "POWER_ON", "REFRESH_SCREEN", "POWER_OFF", "DEEP_SLEEP", "Unknown")
constexpr float PROCESSOR
For components that use data from sensors like displays.
Definition component.h:47
T clamp_at_most(T value, U max)
Definition helpers.h:2576
constexpr uint32_t fnv1a_hash_extend(uint32_t hash, const char *str)
Extend a FNV-1a hash with additional string data.
Definition helpers.h:995
constexpr uint32_t FNV1_OFFSET_BASIS
FNV-1 32-bit offset basis.
Definition helpers.h:968
uint32_t value
Definition hal.cpp:41
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).
Definition helpers.cpp:498
constexpr T encode_value_le(const uint8_t *bytes)
Encode a value from its constituent bytes (from least to most significant) in an array with length si...
Definition helpers.h:1084
T clamp_at_least(T value, U min)
Definition helpers.h:2571
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".
Definition helpers.h:1687
constexpr uint16_t encode_uint16(uint8_t msb, uint8_t lsb)
Encode a 16-bit value given the most and least significant byte.
Definition helpers.h:1043
void HOT delay(uint32_t ms)
Definition hal.cpp:85
uint32_t IRAM_ATTR HOT millis()
Definition hal.cpp:25
Application App
Global storage of Application pointer - only one Application can exist.
static void uint32_t
uint16_t length
Definition tt21100.cpp:0
uint16_t x
Definition tt21100.cpp:5
uint16_t y
Definition tt21100.cpp:6