25 #ifndef ACE_TMI_SIMPLE_TMI_1638_INTERFACE_H
26 #define ACE_TMI_SIMPLE_TMI_1638_INTERFACE_H
85 mDelayMicros(delayMicros)
100 pinMode(mClkPin, OUTPUT);
101 pinMode(mStbPin, OUTPUT);
107 pinMode(mClkPin, INPUT);
108 pinMode(mStbPin, INPUT);
136 for (uint8_t i = 0; i < 8; ++i) {
174 for (uint8_t i = 0; i < 8; ++i) {
177 uint8_t bit = dataRead();
180 data |= (bit & 0x1) ? 0x80 : 0x00;
190 void bitDelay()
const { delayMicroseconds(mDelayMicros); }
192 void clockHigh()
const { digitalWrite(mClkPin, HIGH); bitDelay(); }
194 void clockLow()
const { digitalWrite(mClkPin, LOW); bitDelay(); }
196 void dataHigh()
const { pinMode(mDioPin, INPUT); bitDelay(); }
198 void dataLow()
const { pinMode(mDioPin, OUTPUT); bitDelay(); }
200 void strobeHigh()
const { digitalWrite(mStbPin, HIGH); bitDelay(); }
202 void strobeLow()
const { digitalWrite(mStbPin, LOW); bitDelay(); }
204 uint8_t dataRead()
const {
205 uint8_t data = digitalRead(mDioPin);
211 uint8_t
const mDioPin;
212 uint8_t
const mClkPin;
213 uint8_t
const mStbPin;
214 uint8_t
const mDelayMicros;