25 #ifndef ACE_SEGMENT_SIMPLE_WIRE_FAST_INTERFACE_H
26 #define ACE_SEGMENT_SIMPLE_WIRE_FAST_INTERFACE_H
30 #if defined(ARDUINO_ARCH_AVR) || defined(EPOXY_DUINO)
35 namespace ace_segment {
50 uint8_t T_DELAY_MICROS
52 class SimpleWireFastInterface {
58 SimpleWireFastInterface(uint8_t addr) : mAddr(addr) {}
67 digitalWriteFast(T_CLOCK_PIN, LOW);
68 digitalWriteFast(T_DATA_PIN, LOW);
82 void beginTransmission()
const {
90 uint8_t effectiveAddr = (mAddr << 1) | 0x00;
95 void endTransmission()
const {
106 uint8_t write(uint8_t data)
const {
107 for (uint8_t i = 0; i < 8; ++i) {
126 uint8_t readAck()
const {
129 uint8_t ack = digitalReadFast(T_DATA_PIN);
141 void bitDelay()
const { delayMicroseconds(T_DELAY_MICROS); }
143 void clockHigh()
const { pinModeFast(T_CLOCK_PIN, INPUT); bitDelay(); }
145 void clockLow()
const { pinModeFast(T_CLOCK_PIN, OUTPUT); bitDelay(); }
147 void dataHigh()
const { pinModeFast(T_DATA_PIN, INPUT); bitDelay(); }
149 void dataLow()
const { pinModeFast(T_DATA_PIN, OUTPUT); bitDelay(); }
157 #endif // defined(ARDUINO_ARCH_AVR)