Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions OneWire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,33 @@ void OneWire::write_bit(uint8_t v)
DIRECT_WRITE_LOW(reg, mask);
DIRECT_MODE_OUTPUT(reg, mask); // drive output low
delayMicroseconds(10);
DIRECT_WRITE_HIGH(reg, mask); // drive output high
if (onlyPoolUp)
{
DIRECT_MODE_INPUT(reg, mask); // onlyPoolUp resistor pool pin at high value.
}
else
{
DIRECT_WRITE_HIGH(reg, mask); // drive output high
}
interrupts();
delayMicroseconds(55);
} else {
noInterrupts();
DIRECT_WRITE_LOW(reg, mask);
DIRECT_MODE_OUTPUT(reg, mask); // drive output low
delayMicroseconds(65);
DIRECT_WRITE_HIGH(reg, mask); // drive output high
if (onlyPoolUp)
{
DIRECT_MODE_INPUT(reg, mask); // onlyPoolUp resistor pool pin at high value.
}
else
{
DIRECT_WRITE_HIGH(reg, mask); // drive output high
}
interrupts();
delayMicroseconds(5);
}

}

//
Expand Down
5 changes: 3 additions & 2 deletions OneWire.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ class OneWire
#endif

public:
OneWire() { }
OneWire(uint8_t pin) { begin(pin); }
bool onlyPoolUp;
OneWire() { onlyPoolUp=false; }
OneWire(uint8_t pin) { onlyPoolUp=false; begin(pin); }
void begin(uint8_t pin);

// Perform a 1-Wire reset cycle. Returns 1 if a device responds
Expand Down