/* Minimal host-only Arduino surface for exercising the real OLED renderer. */ #pragma once #include #include #include #include #include #include #include #define PROGMEM #define pgm_read_byte(address) (*reinterpret_cast(address)) template inline auto min(A a, B b) -> decltype(a + b) { return a < b ? a : b; } template inline auto max(A a, B b) -> decltype(a + b) { return a > b ? a : b; } inline void yield() {} class String { std::string value; public: String(const char *text) : value(text ? text : "") {} const char *c_str() const { return value.c_str(); } unsigned int length() const { return static_cast(value.size()); } void toCharArray(char *target, unsigned int capacity, unsigned int index = 0) const { if (!capacity) return; const size_t available = index < value.size() ? value.size() - index : 0; const size_t copied = std::min(capacity - 1, available); std::memcpy(target, value.data() + std::min(index, value.size()), copied); target[copied] = 0; } }; class Print { public: virtual ~Print() {} virtual size_t write(uint8_t byte) = 0; };