#pragma once #include "config.h" #include #include class WatchyDisplayBase : public GxEPD2_EPD { public: static const uint16_t WIDTH = DISPLAY_WIDTH; static const uint16_t HEIGHT = DISPLAY_HEIGHT; static const uint16_t WIDTH_VISIBLE = WIDTH; WatchyDisplayBase(); // init controller memory and screen (default white) void clearScreen(uint8_t value = 0xFF) override; // init controller memory (default white) void writeScreenBuffer(uint8_t value = 0xFF) override; void writeScreenBufferAgain(uint8_t value = 0xFF) override; void writeImage(const uint8_t * bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) override; void writeImageForFullRefresh(const uint8_t * bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) override; void writeImageAgain(const uint8_t * bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) override; // screen refresh from controller memory, partial screen void writeImagePart(const uint8_t * bitmap, int16_t x_part, int16_t y_part, int16_t w_bitmap, int16_t h_bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false) override; // screen refresh from controller memory to full screen void refresh(bool partial_update_mode = false) override; void refresh(int16_t x, int16_t y, int16_t w, int16_t h) override; void powerOff() override; void hibernate() override; void powerOn(); static const GxEPD2::Panel panel = GxEPD2::GDEH0154D67; private: static const uint16_t power_on_time = 100; // ms, e.g. 95583us static const uint16_t power_off_time = 150; // ms, e.g. 140621us static const uint16_t full_refresh_time = 2600; // ms, e.g. 2509602us static const uint16_t partial_refresh_time = 500; // ms, e.g. 457282us static const bool darkBorder = false; void writeImageInternal(uint8_t command, const uint8_t * bitmap, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false); void InitFull(); void InitPart(); void InitDisplay(); void UpdateFull(); void UpdatePart(); void TransferCommand(uint8_t value); void SetPartialRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h); }; typedef GxEPD2_BW WatchyDisplay;