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

Function maxDetectClockByte

wiringPi/rht03.c:82–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

maxDetectReadFunction · 0.70

Calls 3

delayMicrosecondsFunction · 0.85
digitalReadFunction · 0.85
maxDetectLowHighWaitFunction · 0.70

Tested by

no test coverage detected