6#include <Adafruit_GFX.h>
8#include <driver/spi_master.h>
21class Ssd1681Display final :
public hal::IDisplay {
24 Ssd1681Display(
int cs,
int dc,
int rst,
int busy,
int sck,
int miso,
int mosi);
26 ~Ssd1681Display()
override;
29 Result<void> init()
override;
31 int16_t width()
const override;
33 int16_t height()
const override;
35 void clear(hal::Color color = hal::Color::Black)
override;
37 void drawPixel(int16_t x, int16_t y, hal::Color color)
override;
39 void drawLine(int16_t x1, int16_t y1, int16_t x2, int16_t y2, hal::Color color)
override;
41 void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, hal::Color color)
override;
43 void drawFastHLine(int16_t x, int16_t y, int16_t w, hal::Color color)
override;
45 void drawFastVLine(int16_t x, int16_t y, int16_t h, hal::Color color)
override;
47 void drawCircle(int16_t x, int16_t y, int16_t r, hal::Color color)
override;
49 void fillCircle(int16_t x, int16_t y, int16_t r, hal::Color color)
override;
51 void drawRoundRect(int16_t x, int16_t y, int16_t w, int16_t h, int16_t radius, hal::Color color)
override;
53 void fillRoundRect(int16_t x, int16_t y, int16_t w, int16_t h, int16_t radius, hal::Color color)
override;
55 void setFont(hal::FontFace face)
override;
57 void setTextSize(uint8_t
size)
override;
59 void setTextColor(hal::Color color)
override;
61 void setTextWrap(
bool wrap)
override;
63 void setCursor(int16_t x, int16_t y)
override;
65 size_t print(
const char* text)
override;
67 size_t print(uint8_t value)
override;
69 size_t print(int32_t value)
override;
71 size_t print(uint32_t value)
override;
73 void getTextBounds(
const char* text, int16_t x, int16_t y,
74 int16_t* x1, int16_t* y1, uint16_t* w, uint16_t* h)
override;
76 void refresh(
bool full =
false)
override;
78 void refreshRect(
const Rect& rect)
override;
80 bool isBusy()
const override;
82 void setBusyCallback(hal::DisplayBusyCallback cb,
void* userData =
nullptr)
override;
84 void powerOff()
override;
86 void powerOn()
override;
88 bool isPowered()
const override;
90 const uint8_t* getBuffer()
const override;
92 uint8_t* getBuffer()
override;
95 static constexpr int16_t kWidth = 200;
96 static constexpr int16_t kHeight = 200;
97 static constexpr size_t kBufferSize = kWidth * kHeight / 8;
100 class Canvas final :
public Adafruit_GFX {
102 explicit Canvas(uint8_t* buffer);
103 void drawPixel(int16_t x, int16_t y, uint16_t color)
override;
108 int cs_, dc_, rst_, busy_, sck_, miso_, mosi_;
109 spi_device_handle_t spiDevice_{
nullptr};
110 bool spiBusInitialized_{
false};
111 bool initialized_{
false};
112 bool powered_{
false};
113 bool baselineValid_{
false};
114 esp_err_t lastIoError_{ESP_OK};
115 uint8_t framebuffer_[kBufferSize]{};
117 hal::DisplayBusyCallback busyCallback_{
nullptr};
118 void* busyUserData_{
nullptr};
122 bool refreshWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
123 bool writeFull(uint8_t ramCommand);
124 bool writeData(
const uint8_t*
data,
size_t length);
125 bool writeCommand(uint8_t command);
126 bool writeCommandData(uint8_t command,
const uint8_t*
data,
size_t length);
127 bool writeCommandByte(uint8_t command, uint8_t
data);
128 bool setRamArea(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
129 bool waitBusy(uint32_t timeoutMs = 5000);
130 bool powerOffPanel();
131 void reportIoError();
Definition application.h:10
size_t size
Definition ota_service.cpp:47
char data[MANIFEST_LIMIT]
Definition ota_service.cpp:33
size_t length
Definition ota_service.cpp:34