9using namespace display;
26static constexpr uint8_t NONE = 0;
27static constexpr uint8_t MIRROR_X = 1;
28static constexpr uint8_t MIRROR_Y = 2;
29static constexpr uint8_t SWAP_XY = 4;
31static constexpr uint32_t MAX_TRANSFER_TIME = 10;
32static constexpr size_t MAX_TRANSFER_SIZE = 128;
33static constexpr uint8_t DELAY_FLAG = 0xFF;
36 public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING,
37 spi::DATA_RATE_2MHZ> {
39 EPaperBase(
const char *name, uint16_t width, uint16_t height,
const uint8_t *init_sequence,
57 void data(uint8_t value);
63 void setup()
override;
73 if ((
static_cast<int>(color.
r) + color.
g + color.
b) > 512) {
105 virtual bool reset();
167#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE
171#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_DEBUG
uint32_t update_start_time_
virtual void power_off()=0
Power the display off.
void command(uint8_t value)
const uint8_t * init_sequence_
void set_transform(uint8_t transform)
void fill(Color color) override
void process_state_()
Process the state machine.
virtual void deep_sleep()=0
Place the display into deep sleep.
DisplayType display_type_
void on_safe_shutdown() override
int get_height_internal() override
void draw_pixel_at(int x, int y, Color color) override
Default implementation for monochrome displays where 8 pixels are packed to a byte.
int get_height() override
uint32_t waiting_for_idle_start_
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.
uint8_t full_update_every_
void set_dc_pin(GPIOPin *dc_pin)
void dump_config() override
void set_reset_pin(GPIOPin *reset)
virtual bool transfer_data()=0
Methods that must be implemented by concrete classes to control the display.
split_buffer::SplitBuffer buffer_
void cmd_data(uint8_t command, const uint8_t *ptr, size_t length)
void set_state_(EPaperState state, uint16_t delay=0)
const char * epaper_state_to_string_()
virtual void power_on()=0
Power the display on.
void set_reset_duration(uint32_t reset_duration)
void set_full_update_every(uint8_t full_update_every)
DisplayType get_display_type() override
void wait_for_idle_(bool should_wait)
size_t current_data_index_
uint32_t waiting_for_idle_last_print_
size_t init_sequence_length_
float get_setup_priority() const override
bool init_buffer_(size_t buffer_length)
void set_busy_pin(GPIOPin *busy)
int get_width_internal() override
static uint8_t color_to_bit(Color color)
EPaperBase(const char *name, uint16_t width, uint16_t height, const uint8_t *init_sequence, size_t init_sequence_length, DisplayType display_type=DISPLAY_TYPE_BINARY)
The SPIDevice is what components using the SPI will create.
A SplitBuffer allocates a large memory buffer potentially as multiple smaller buffers to facilitate a...
void fill(uint8_t value) const
Fill the entire buffer with a single byte value.
const Color COLOR_ON(255, 255, 255, 255)
Turn the pixel ON.
void IRAM_ATTR HOT delay(uint32_t ms)