25 #ifndef ACE_WIRE_SIMPLE_WIRE_FAST_INTERFACE_H
26 #define ACE_WIRE_SIMPLE_WIRE_FAST_INTERFACE_H
30 #if defined(ARDUINO_ARCH_AVR) || defined(EPOXY_DUINO)
55 uint8_t T_DELAY_MICROS
57 class SimpleWireFastInterface {
60 SimpleWireFastInterface() =
default;
72 digitalWriteFast(T_CLOCK_PIN, LOW);
73 digitalWriteFast(T_DATA_PIN, LOW);
90 void beginTransmission(uint8_t addr)
const {
98 uint8_t effectiveAddr = (addr << 1) | 0x00;
103 void endTransmission()
const {
120 uint8_t write(uint8_t data)
const {
121 for (uint8_t i = 0; i < 8; ++i) {
140 uint8_t readAck()
const {
143 uint8_t ack = digitalReadFast(T_DATA_PIN);
155 void bitDelay()
const { delayMicroseconds(T_DELAY_MICROS); }
157 void clockHigh()
const { pinModeFast(T_CLOCK_PIN, INPUT); bitDelay(); }
159 void clockLow()
const { pinModeFast(T_CLOCK_PIN, OUTPUT); bitDelay(); }
161 void dataHigh()
const { pinModeFast(T_DATA_PIN, INPUT); bitDelay(); }
163 void dataLow()
const { pinModeFast(T_DATA_PIN, OUTPUT); bitDelay(); }
168 #endif // defined(ARDUINO_ARCH_AVR)