New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for internal pull-up resistor #30
base: master
Are you sure you want to change the base?
Conversation
On platforms such as Arduino, a new #define can now be set in OneWire.h to enable the internal pull-up resistor. This means that no external resistor is needed to search for 1-wire devices. Do not expect this to work for temperature sensors and other such devices, that have higher power requirements than simple serial number devices.
Have this code been tested on any non-AVR chips? |
I have tried it on a chipKit MAX32 Controller with a PIC chip and didn't manage it to work. |
Any tried on any other non-AVR boards? (I'm pretty sure it will not work on any of them) |
If it only works on AVR boards (sorry, I only have Arduino here to test with), would it be an idea to update this to have some kind of #ifdef that limits its use to AVR? |
it will work on some controllers like AVR, but won't do harm on the others. the changes could be more minimal though. the digitalWrite() in constructor shouldn't be needed |
Which others have you tested? This code uses the AVR quirk where writing to the output register affects the input pullups. I do not intend to merge it as-is. |
-> I tested this code without the preprocessor-guards with atmega328p, teensy3.2 and the esp8266, works as expected on atmega. won't do harm on the others. but you are right. i wouldn't merge this either without some cleanup. what do you expect to happen on other architectures? we are using macros that rely on low level register access. there is no controller in your list that magically changes the pin-direction after the pin is set to input and the output-registers are written afterwards. here is a list of gpio-behaviors (compiled from the datasheets) for proving my point: (AVR)ReferenceDataSheet atmega328p
(MK20DX128) || (MK20DX256) || (MK66FX1M0) || (MK64FX512)K20 / Cortex M4 Reference Manual
MK64 / Cortex M4 Reference Manual K66 / Cortex M4 Reference Manual (MKL26Z64)KL2x Cortex M0 Reference Manual (SAM3X8E) || (SAM3A8C) || (SAM3A4C)SAM3X \ SAM3A Cortex M3 Datasheet
(PIC32MX)PIC32MX MIPS32 datasheet
(ARDUINO_ARCH_ESP8266)ESP8266 Datasheet page 17: Each GPIO can be configured with internal pull-up ESP8266 Technical Reference
(SAMD21G18A)SAMD21 Cortex M0+ Datasheet
DIR INEN PULLEN OUT Configuration (RBL_NRF51822)nRF51 Reference Manual
(arc) /* Arduino101/Genuino101 specifics */Intel Curie Module (Quark SE C1000) Datasheet
Quark SE C1000
else
|
Add the ability to use internal pull-up resistor for device search. Greatly reduces required components for the simple use case of detecting the presence of a DS1990 or similar unit