// Fake display driver for the native tests: records every call instead of flipping dots #pragma once #include #include #include "Arduino.h" struct DisplayCall { std::string what; int a, b, c; }; class BROSE9323 { public: std::vector calls; bool direct = false; BROSE9323(uint8_t, uint8_t, uint8_t, uint16_t) {} void begin() { log("begin"); } void display(bool force = false) { log("display", force); } void drawPixel(int16_t x, int16_t y, uint16_t color) { log(direct ? "directPixel" : "pixel", x, y, color); } void fillScreen(uint16_t color) { log("fill", color); } void setDirect(bool d) { direct = d; } void setTiming(uint16_t t) { log("timing", t); } void printBuffer() { log("printBuffer"); } void setCursor(int16_t x, int16_t y) { log("cursor", x, y); } void setTextColor(uint16_t color, uint16_t background) { log("textColor", color, background); } void setTextSize(uint8_t size) { log("textSize", size); } size_t write(uint8_t ch) { log("write", ch); return 1; } void println() { log("newline"); } // Helpers for the tests int count(const std::string &what) const { int n = 0; for (const DisplayCall &call : calls) n += call.what == what; return n; } const DisplayCall *last(const std::string &what) const { for (auto it = calls.rbegin(); it != calls.rend(); ++it) if (it->what == what) return &*it; return nullptr; } private: void log(const char *what, int a = 0, int b = 0, int c = 0) { calls.push_back({what, a, b, c}); } };