OneWire in Due

mantoui:
I rewrote write_bit() in OneWire.cpp to match (more or less) what was working on the maple. This seems to work for me without any delay(1);! Works on both the little ds18b20 sketch and the Examples>OneWire>DS18x20_temperature.

void OneWire::write_bit(uint8_t v)

{
IO_REG_TYPE mask=bitmask;
volatile IO_REG_TYPE *reg IO_REG_ASM = baseReg;

if (v & 1) {

// noInterrupts();
DIRECT_MODE_OUTPUT(reg, mask); // drive output low
DIRECT_WRITE_LOW(reg, mask);
delayMicroseconds(5);
// DIRECT_WRITE_HIGH(reg, mask); // drive output high
DIRECT_MODE_INPUT(reg, mask); // let pin float, pull up will raise
delayMicroseconds(60);
//interrupts();
} else {
//noInterrupts();
DIRECT_MODE_OUTPUT(reg, mask); // drive output low
DIRECT_WRITE_LOW(reg, mask);
delayMicroseconds(60);
DIRECT_MODE_INPUT(reg, mask); // let pin float, pull up will raise
//DIRECT_WRITE_HIGH(reg, mask); // drive output high
//interrupts();
}
delayMicroseconds(10); // 10uSec recovery time
}

Ok, nice!!!

I had something similar, but without the 10 uSec in the end. Unfortunatly I can't test it... arghh...