| 80 | */ |
| 81 | |
| 82 | static 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 | /* |
no test coverage detected