Write a bit. Port and bit is used to cut lookup time and provide more certain timing.
| 211 | // more certain timing. |
| 212 | // |
| 213 | void CRIT_TIMING OneWire::write_bit(uint8_t v) |
| 214 | { |
| 215 | IO_REG_TYPE mask IO_REG_MASK_ATTR = bitmask; |
| 216 | __attribute__((unused)) volatile IO_REG_TYPE *reg IO_REG_BASE_ATTR = baseReg; |
| 217 | |
| 218 | if (v & 1) { |
| 219 | noInterrupts(); |
| 220 | DIRECT_WRITE_LOW(reg, mask); |
| 221 | DIRECT_MODE_OUTPUT(reg, mask); // drive output low |
| 222 | delayMicroseconds(10); |
| 223 | DIRECT_WRITE_HIGH(reg, mask); // drive output high |
| 224 | interrupts(); |
| 225 | delayMicroseconds(55); |
| 226 | } else { |
| 227 | noInterrupts(); |
| 228 | DIRECT_WRITE_LOW(reg, mask); |
| 229 | DIRECT_MODE_OUTPUT(reg, mask); // drive output low |
| 230 | delayMicroseconds(65); |
| 231 | DIRECT_WRITE_HIGH(reg, mask); // drive output high |
| 232 | interrupts(); |
| 233 | delayMicroseconds(5); |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | // |
| 238 | // Read a bit. Port and bit is used to cut lookup time and provide |
nothing calls this directly
no outgoing calls
no test coverage detected