Read a bit. Port and bit is used to cut lookup time and provide more certain timing.
| 222 | // more certain timing. |
| 223 | // |
| 224 | uint8_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 |
no outgoing calls
no test coverage detected