PaulStoffregen / OneWire

Library for Dallas/Maxim 1-Wire Chips
http://www.pjrc.com/teensy/td_libs_OneWire.html
579 stars 382 forks source link

Change mode to INPUT_PULLUP #31

Open rojer opened 7 years ago

rojer commented 7 years ago

Is there a reason why here pin mode is set to INPUT and not INPUT_PULLUP? It see that the latter could eliminate the need for external pull-up if the MCU supports it, and won't hurt in other cases.

bneedhamia commented 6 years ago

One reason I can imagine: the internal pullup resistor may not be the right value for the 1-wire bus. The documentation of INPUT_PULLUP seems to say that the internal pullup resistor may be anywhere between 20K and 150K ohms, depending on the processor used. In contrast, the 1-wire guidelines recommend a 4.7K pullup resistor on the bus data line. So if the code used INPUT_PULLUP instead of an external 4.7K pullup resistor on the 1-wire data line, I'm not sure the 1-wire bus would work.