#pragma once #include constexpr int CHANNELS = 4; // Relay/input IO behind one tiny interface. Business code never touches pins, so // porting to the real Dingtian board (74HC595 relays / 74HC165 inputs) swaps only // the Io implementation file. class Io { public: void begin(); void setRelay(int ch, bool on); // 1-based bool relay(int ch) const; // 1-based bool inputHigh(int ch); // raw line level, 1-based uint8_t relayMask() const; // bit0 = relay 1 uint8_t inputMask(); // bit0 = input 1, bit set = line HIGH private: bool relays_[CHANNELS] = {}; };