25 #ifndef ACE_TMI_SOFT_TMI_FAST_INTERFACE_H
26 #define ACE_TMI_SOFT_TMI_FAST_INTERFACE_H
30 #if defined(ARDUINO_ARCH_AVR) || defined(EPOXY_DUINO)
78 uint8_t T_DELAY_MICROS
80 class SoftTmiFastInterface {
82 explicit SoftTmiFastInterface() =
default;
93 digitalWriteFast(T_CLK_PIN, LOW);
94 digitalWriteFast(T_DIO_PIN, LOW);
108 void startCondition()
const {
117 void stopCondition()
const {
135 uint8_t sendByte(uint8_t data)
const {
136 for (uint8_t i = 0; i < 8; ++i) {
155 uint8_t readAck()
const {
158 uint8_t ack = digitalReadFast(T_DIO_PIN);
170 void bitDelay()
const { delayMicroseconds(T_DELAY_MICROS); }
172 void clockHigh()
const { pinModeFast(T_CLK_PIN, INPUT); bitDelay(); }
174 void clockLow()
const { pinModeFast(T_CLK_PIN, OUTPUT); bitDelay(); }
176 void dataHigh()
const { pinModeFast(T_DIO_PIN, INPUT); bitDelay(); }
178 void dataLow()
const { pinModeFast(T_DIO_PIN, OUTPUT); bitDelay(); }
183 #endif // defined(ARDUINO_ARCH_AVR)