MCPcopy Create free account
hub / github.com/DanielOgorchock/ST_Anything / read_bit

Method read_bit

Arduino/libraries/OneWire/OneWire.cpp:224–240  ·  view source on GitHub ↗

Read a bit. Port and bit is used to cut lookup time and provide more certain timing.

Source from the content-addressed store, hash-verified

222// more certain timing.
223//
224uint8_t OneWire::read_bit(void)
225{
226 IO_REG_TYPE mask=bitmask;
227 volatile IO_REG_TYPE *reg IO_REG_ASM = baseReg;
228 uint8_t r;
229
230 noInterrupts();
231 DIRECT_MODE_OUTPUT(reg, mask);
232 DIRECT_WRITE_LOW(reg, mask);
233 delayMicroseconds(3);
234 DIRECT_MODE_INPUT(reg, mask); // let pin float, pull up will raise
235 delayMicroseconds(10);
236 r = DIRECT_READ(reg, mask);
237 interrupts();
238 delayMicroseconds(53);
239 return r;
240}
241
242//
243// Write a byte. The writing code uses the active drivers to raise the

Callers 2

readPowerSupplyMethod · 0.80
alarmSearchMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected