7static constexpr const char *
const TAG =
"epaper_spi.jd79660";
19 return color_to_bwyr(color, JD79660Color::BLACK, JD79660Color::WHITE, JD79660Color::YELLOW, JD79660Color::RED);
29 const auto pixel_color = color_to_hex(color);
32 this->
buffer_.
fill(pixel_color | (pixel_color << 2) | (pixel_color << 4) | (pixel_color << 6));
38 const auto pixel_bits = color_to_hex(color);
41 const uint32_t byte_position = pixel_position / 4;
42 const uint32_t bit_offset = 6 - ((pixel_position % 4) * 2);
43 const auto original = this->
buffer_[byte_position];
45 this->
buffer_[byte_position] = (original & (~(0b11 << bit_offset))) |
46 (pixel_bits << bit_offset);
55 switch (this->
step_) {
59 ESP_LOGVV(TAG,
"reset #0");
70 ESP_LOGVV(TAG,
"reset #1");
84 ESP_LOGVV(TAG,
"reset #2");
106 switch (this->
step_) {
109 ESP_LOGVV(TAG,
"init #0");
125 ESP_LOGVV(TAG,
"init #1");
140 uint8_t bytes_to_send[MAX_TRANSFER_SIZE];
146 if (buf_idx ==
sizeof bytes_to_send) {
150 ESP_LOGVV(TAG,
"Wrote %zu bytes at %ums", buf_idx, (
unsigned)
millis());
153 if (
millis() - start_time > MAX_TRANSFER_TIME) {
165 ESP_LOGVV(TAG,
"Wrote %zu bytes at %ums", buf_idx, (
unsigned)
millis());
197 ESP_LOGV(TAG,
"Refresh");
202 ESP_LOGV(TAG,
"Power off");
207 ESP_LOGV(TAG,
"Deep sleep");
uint32_t IRAM_ATTR HOT get_loop_component_start_time() const
Get the cached time in milliseconds from when the current component started its loop execution.
virtual void mark_failed()
Mark this component as failed.
virtual void digital_write(bool value)=0
Rect get_clipping() const
Get the current the clipping rectangle.
void command(uint8_t value)
void fill(Color color) override
bool rotate_coordinates_(int &x, int &y)
Check and rotate coordinates based on the transform flags.
virtual bool initialise(bool partial)
void send_init_sequence_(const uint8_t *sequence, size_t length)
split_buffer::SplitBuffer buffer_
void cmd_data(uint8_t command, const uint8_t *ptr, size_t length)
void wait_for_idle_(bool should_wait)
size_t current_data_index_
int get_width_internal() override
static constexpr uint16_t SLEEP_MS_RESET0
Wait time (millisec) for first reset phase: High.
void deep_sleep() override
Deepsleep: Must be used to avoid hardware wearout!
bool initialise(bool partial) override
Initialise (multistep sequence)
static constexpr uint8_t CMD_REFRESH
void write_fastinit_()
Internal: Send fast init sequence via undocumented vendor registers.
void power_off() override
Power off.
@ NONE
Initial/default value: Unused.
const uint16_t fast_update_length_
void fill(Color color) override
bool transfer_data() override
Buffer transfer.
static constexpr uint8_t CMD_POWEROFF
void draw_pixel_at(int x, int y, Color color) override
Draw colored pixel into frame buffer.
static constexpr uint16_t SLEEP_MS_RESET2
Wait time (millisec) for third reset phase: High.
bool transfer_buffer_chunks_()
Internal: Send raw buffer in chunks.
static constexpr uint8_t CMD_DEEPSLEEP
static constexpr uint16_t SLEEP_MS_RESET1
Wait time (millisec) for second reset phase: Low.
void refresh_screen(bool partial) override
Refresh screen.
static constexpr uint8_t CMD_TRANSFER
FSMState step_
Counter for tracking substeps within FSM state.
bool reset() override
Reset (multistep sequence)
const uint8_t *const fast_update_
void write_array(const uint8_t *data, size_t length)
void fill(uint8_t value) const
Fill the entire buffer with a single byte value.
constexpr NATIVE_COLOR color_to_bwyr(Color color, NATIVE_COLOR hw_black, NATIVE_COLOR hw_white, NATIVE_COLOR hw_yellow, NATIVE_COLOR hw_red)
Map RGB color to discrete BWYR hex 4 color key.
JD79660Color
Pixel color as 2bpp.
void IRAM_ATTR HOT delay(uint32_t ms)
uint32_t IRAM_ATTR HOT millis()
Application App
Global storage of Application pointer - only one Application can exist.