Next, onewire_select() and onewire_skip() call onewire_write with the 3rd argument (power) set to zero, i.e.
void onewire_skip(uint8_t pin)
{
onewire_write(pin, 0xCC, 0); // Skip ROM
}
I noticed on my logic analyser, the output pin goes low at this point, which I believe it should not do. I believe the intent is for the pin to be tri-stated (high impedance) and the external resistor pulls up the pin to 3v3.
Looking at the code for onewire_write() ...
if ( !power) {
noInterrupts();
DIRECT_MODE_INPUT(pin);
DIRECT_WRITE_LOW(pin);
interrupts();
}
There seems to be a problem here. DIRECT_MODE_INPUT is defined as
GPIO_DIS_OUTPUT(pin_num[pin])
When I worked around the problem by calling onewire_write() myself with power = 1, the pin output anomaly vanished and my temp sensor worked.