// Host doubles for panel libraries only. The test appends real driver headers // and real drawing methods; no coordinate or font mapping is reimplemented. #include #include #include #include #include #include #define pgm_read_byte(p) (*(const uint8_t*)(p)) #define PROGMEM #define HSPI 1 #define GEOMETRY_RAWMODE 0 #define PIN_TFT_CS 1 #define PIN_TFT_DC 2 #define PIN_TFT_SDA 3 #define PIN_TFT_SCL 4 #define PIN_TFT_RST 5 #define ST7789_RESET 1 #define ST7789_RS 2 #define ST7789_CS 3 #define ST7789_SDA 4 #define ST7789_MISO 5 #define ST7789_SCK 6 #define PIN_DISPLAY_CS 1 #define PIN_DISPLAY_DC 2 #define PIN_DISPLAY_RST 3 #define PIN_DISPLAY_BUSY 4 #define DISP_CS 1 #define DISP_DC 2 #define DISP_RST 3 #define DISP_BUSY 4 #define ST77XX_WHITE 1 #define ST77XX_BLACK 0 struct SPIClass { explicit SPIClass(int = 0) {} } SPI, SPI1; struct TwoWire {}; struct RefCountedDigitalPin {}; enum OLEDDISPLAY_COLOR { BLACK, WHITE }; const int ArialMT_Plain_16 = 16, ArialMT_Plain_24 = 24; const int FreeSans9pt7b = 13, FreeSansBold12pt7b = 18, FreeSans18pt7b = 26; struct CRC32 { template void update(T) {} template void update(const T*, size_t) {} }; ColorVal UIColor::window_bkg=0, UIColor::title_bkg=0, UIColor::title_txt=1; ColorVal UIColor::primary_txt=1, UIColor::secondary_txt=1, UIColor::warning_txt=1; ColorVal UIColor::popup_bkg=0, UIColor::popup_txt=1, UIColor::corp_blue=1; struct Canvas { static Canvas* active; int w=EXPECTED_WIDTH, h=EXPECTED_HEIGHT, x=0, y=0, size=1, ascent=0; std::vector pixels = std::vector(w*h); Canvas() { active=this; } int width() const { return w; } int height() const { return h; } void setCursor(int xx, int yy) { x=xx; y=yy; } void setTextSize(int s) { size=s; } void setTextColor(int) {} void setColor(OLEDDISPLAY_COLOR) {} void setRGB(int) {} void setFont(int) {} void setFont(const int* font) { ascent=*font; } void print(const char*) {} void drawString(int xx,int yy,const char*) { x=xx; y=yy; } void drawStringMaxWidth(int xx,int yy,int ww,const char*) { x=xx; y=yy; assert(ww==w); } int getStringWidth(const char* s) { return std::strlen(s)*6*size; } void getTextBounds(const char* s,int,int,int16_t* xx,int16_t* yy,uint16_t* ww,uint16_t* hh) { *xx=0; *yy=-ascent; *ww=getStringWidth(s); *hh=ascent ? ascent+4 : 8*size; } void fillRect(int xx,int yy,int ww,int hh,int=1) { for(int row=std::max(yy,0); row>(col&7))) fillRect(xx+col,yy+row,1,1,c); } void reset() { std::fill(pixels.begin(),pixels.end(),0); } }; Canvas* Canvas::active=nullptr; struct ST7789Spi : Canvas { template ST7789Spi(T...) {} }; struct Adafruit_ST7789 : Canvas { template Adafruit_ST7789(T...) {} }; struct GxEPD2_150_BN { static const int WIDTH=200,HEIGHT=200; template GxEPD2_150_BN(T...) {} }; struct WidePanel { static const int WIDTH=122,HEIGHT=250; template WidePanel(T...) {} }; struct TallPanel { static const int WIDTH=192,HEIGHT=256; template TallPanel(T...) {} }; template struct GxEPD2_BW : Canvas { explicit GxEPD2_BW(T) {} };