| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #pragma once
- // Minimal standalone Arduino.h stand-in for compiling one vendor GxEPD2
- // driver on a dev machine (plain g++/clang, not the ESP-IDF toolchain) so
- // its real command/data byte trace can be observed directly, instead of
- // statically parsed. Shape mirrors ../../third_party/arduino_compat/
- // Arduino.h (same symbols GxEPD2 needs), but every call here logs to
- // ../trace.h instead of touching real hardware via esphome.
- #include <cstdint>
- #include <cstdio>
- #include <sstream>
- #include <string>
- #include "../trace.h"
- // Vendor source branches on this to pick <pgmspace.h> over <avr/pgmspace.h>
- // - defining it is simpler than providing a fake avr/ include directory.
- #ifndef ESP32
- #define ESP32
- #endif
- #define HIGH 1
- #define LOW 0
- #define INPUT 0
- #define OUTPUT 1
- #define INPUT_PULLUP 2
- inline void pinMode(int16_t pin, uint8_t mode) { Trace::pin_mode(pin, mode); }
- inline void digitalWrite(int16_t pin, uint8_t value) {
- Trace::digital_write(pin, value);
- Trace::note_digital_write_for_dc(pin, value);
- }
- inline int digitalRead(int16_t pin) { return Trace::digital_read(pin); }
- inline void delay(uint32_t ms) { Trace::delay_ms(ms); }
- inline uint32_t millis() { return 0; }
- inline uint32_t micros() { return 0; }
- inline void yield() {}
- #define pgm_read_byte(addr) (*reinterpret_cast<const uint8_t *>(addr))
- // No PROGMEM distinction on a dev machine - expands to nothing, so vendor
- // definitions like `const unsigned char Cls::lut[] PROGMEM = {...}` (used by
- // the partial-refresh LUT tables in several drivers, e.g. GDEY075T7) compile
- // host-side. Harmless for drivers that don't use it.
- #define PROGMEM
- // GxEPD2_EPD::_waitWhileBusy()'s diagnostic prints (opt-in, never enabled
- // here since the harness passes serial_diag_bitrate=0 to init()) and the
- // unconditional "Busy Timeout!" warning both go through this - harmless to
- // drop for this pass, we already observe the busy-check via digitalRead().
- class HarnessSerialShim {
- public:
- void begin(uint32_t) {}
- template<typename T> void print(T value) {}
- template<typename T> void println(T value) {}
- void println() {}
- };
- inline HarnessSerialShim Serial;
|