25 #ifndef ACE_SEGMENT_SIMPLE_WIRE_INTERFACE_H
26 #define ACE_SEGMENT_SIMPLE_WIRE_INTERFACE_H
31 namespace ace_segment {
54 uint8_t addr, uint8_t dataPin, uint8_t clockPin, uint8_t delayMicros
59 mDelayMicros(delayMicros)
69 digitalWrite(mClockPin, LOW);
70 digitalWrite(mDataPin, LOW);
92 uint8_t effectiveAddr = (mAddr << 1) | 0x00;
109 for (uint8_t i = 0; i < 8; ++i) {
128 uint8_t readAck()
const {
131 uint8_t ack = digitalRead(mDataPin);
139 void bitDelay()
const { delayMicroseconds(mDelayMicros); }
141 void clockHigh()
const { pinMode(mClockPin, INPUT); bitDelay(); }
143 void clockLow()
const { pinMode(mClockPin, OUTPUT); bitDelay(); }
145 void dataHigh()
const { pinMode(mDataPin, INPUT); bitDelay(); }
147 void dataLow()
const { pinMode(mDataPin, OUTPUT); bitDelay(); }
151 uint8_t
const mDataPin;
152 uint8_t
const mClockPin;
153 uint8_t
const mDelayMicros;