WatchyWatchFace/src/WatchyDisplay.h

57 lines
2.4 KiB
C
Raw Normal View History

2023-05-29 13:03:05 +03:00
#pragma once
#include "config.h"
#include <GxEPD2_EPD.h>
#include <GxEPD2_BW.h>
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)
2023-05-29 18:10:06 +03:00
void writeScreenBuffer(uint8_t value = 0xFF) override;
void writeScreenBufferAgain(uint8_t value = 0xFF) override;
2023-05-29 13:03:05 +03:00
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;
2023-05-29 18:10:06 +03:00
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;
2023-05-29 23:34:10 +03:00
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;
2023-05-29 13:03:05 +03:00
// 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;
2023-05-29 18:10:06 +03:00
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);
2023-05-29 13:03:05 +03:00
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);
2023-05-29 18:10:06 +03:00
};
typedef GxEPD2_BW<WatchyDisplayBase, WatchyDisplayBase::HEIGHT> WatchyDisplay;