MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / read

Method read

libraries/shiftInSlow/ShiftInSlow.cpp:27–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25
26
27int ShiftInSlow::read()
28{
29 _value = 0;
30 for (uint8_t i = 0; i < 8; ++i)
31 {
32 digitalWrite(_clockPin, HIGH);
33 if (_delay > 0) delayMicroseconds(_delay/2);
34 yield();
35 if (_bitOrder == LSBFIRST)
36 _value |= digitalRead(_dataPin) << i;
37 else
38 _value |= digitalRead(_dataPin) << (7 - i);
39 digitalWrite(_clockPin, LOW);
40 if (_delay > 0) delayMicroseconds(_delay/2);
41 }
42 return _value;
43}
44
45
46bool ShiftInSlow::setBitOrder(const uint8_t bitOrder)

Callers 1

unittestFunction · 0.45

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.36