MCPcopy Create free account
hub / github.com/WiringPi/WiringPi / maxDetectClockByte

Function maxDetectClockByte

devLib/maxdetect.c:84–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82 */
83
84static unsigned int maxDetectClockByte (const int pin)
85{
86 unsigned int byte = 0 ;
87 int bit ;
88
89 for (bit = 0 ; bit < 8 ; ++bit)
90 {
91 if (!maxDetectLowHighWait (pin))
92 return 0 ;
93
94// bit starting now - we need to time it.
95
96 delayMicroseconds (30) ;
97 byte <<= 1 ;
98 if (digitalRead (pin) == HIGH) // It's a 1
99 byte |= 1 ;
100 }
101
102 return byte ;
103}
104
105
106/*

Callers 1

maxDetectReadFunction · 0.70

Calls 3

delayMicrosecondsFunction · 0.85
digitalReadFunction · 0.85
maxDetectLowHighWaitFunction · 0.70

Tested by

no test coverage detected