{"id":15011972,"url":"https://github.com/pstolarz/onewireng","last_synced_at":"2025-04-05T23:06:45.087Z","repository":{"id":34638758,"uuid":"179493910","full_name":"pstolarz/OneWireNg","owner":"pstolarz","description":"1-wire service library. OneWire compatible. Dallas thermometers support.","archived":false,"fork":false,"pushed_at":"2025-03-03T22:11:13.000Z","size":640,"stargazers_count":99,"open_issues_count":0,"forks_count":22,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-05T23:06:36.499Z","etag":null,"topics":["1-wire","arduino","avr","ds18b20","esp32","esp8266","iot","mbed-os","one-wire","pico","platformio","rp2040"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pstolarz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-04T12:33:50.000Z","updated_at":"2025-03-22T16:22:18.000Z","dependencies_parsed_at":"2023-12-28T15:27:45.179Z","dependency_job_id":"17d86042-df98-4957-be75-1454ff2c96b4","html_url":"https://github.com/pstolarz/OneWireNg","commit_stats":{"total_commits":274,"total_committers":4,"mean_commits":68.5,"dds":"0.014598540145985384","last_synced_commit":"f1ac17551677b5bf33bbff5c5db99a9992aba2f8"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pstolarz%2FOneWireNg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pstolarz%2FOneWireNg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pstolarz%2FOneWireNg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pstolarz%2FOneWireNg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pstolarz","download_url":"https://codeload.github.com/pstolarz/OneWireNg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411231,"owners_count":20934653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["1-wire","arduino","avr","ds18b20","esp32","esp8266","iot","mbed-os","one-wire","pico","platformio","rp2040"],"created_at":"2024-09-24T19:41:57.764Z","updated_at":"2025-04-05T23:06:45.062Z","avatar_url":"https://github.com/pstolarz.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OneWireNg\n\n[![Arduino builds](https://github.com/pstolarz/OneWireNg/actions/workflows/arduino-builds.yml/badge.svg?branch=master)](https://github.com/pstolarz/OneWireNg/actions/workflows/arduino-builds.yml)\n[![PlatformIO builds](https://github.com/pstolarz/OneWireNg/actions/workflows/platformio-builds.yml/badge.svg?branch=master)](https://github.com/pstolarz/OneWireNg/actions/workflows/platformio-builds.yml)\n[![ESP-IDF builds](https://github.com/pstolarz/OneWireNg/actions/workflows/espidf-builds.yml/badge.svg?branch=master)](https://github.com/pstolarz/OneWireNg/actions/workflows/espidf-builds.yml)\n[![Pico SDK builds](https://github.com/pstolarz/OneWireNg/actions/workflows/picosdk-builds.yml/badge.svg?branch=master)](https://github.com/pstolarz/OneWireNg/actions/workflows/picosdk-builds.yml)\n[![Mbed OS builds](https://github.com/pstolarz/OneWireNg/actions/workflows/mbedos-builds.yml/badge.svg?branch=master)](https://github.com/pstolarz/OneWireNg/actions/workflows/mbedos-builds.yml)\n[![Unit tests](https://github.com/pstolarz/OneWireNg/actions/workflows/ut.yml/badge.svg?branch=master)](https://github.com/pstolarz/OneWireNg/actions/workflows/ut.yml)\n[![PlatformIO Registry](https://badges.registry.platformio.org/packages/pstolarz/library/OneWireNg.svg)](https://registry.platformio.org/libraries/pstolarz/OneWireNg)\n\u003cbr\u003e\n\nThis is an 1-wire service library, intended as an alternative for the classic\n[OneWire](https://github.com/PaulStoffregen/OneWire) library. The library\nprovides basic 1-wire services (reset, search, touch, read, write, parasite\npowering) and may serve for further work while interfacing with various 1-wire\ndevices.\n\n## Table of Contents\n\n* [Features](#features)\n* [Usage](#usage)\n  * [ESP-IDF](#usage_idf)\n  * [Pico SDK](#usage_pico)\n  * [Mbed OS](#usage_mbed)\n* [Supported platforms](#supported_plats)\n* [Overdrive mode](#od_mode)\n* [Parasite powering](#parasite)\n* [Architecture details](#arch)\n  * [`OneWireNg`](#arch_owng)\n    * [Memory allocation caveat](#arch_owng_malloc)\n  * [`OneWireNg_BitBang`](#arch_bb)\n  * [`OneWireNg_PLATFORM`](#arch_plat)\n    * [RP2040 drivers](#arch_rp2040)\n      * [RP2040 PIO driver controlling many buses](#arch_rp2040pio_multi_bus)\n* [OneWire compatibility](#ow)\n  * [DallasTemperature library](#ow_dallas)\n* [License](#license)\n\n\u003ca name=\"features\"\u003e\u003c/a\u003e\n## Features\n\n* All bus activities are performed respecting open-drain character of the 1-wire\n  protocol.\n\n  During normal 1-wire activities, the master MCU GPIO controlling the bus is\n  never set high (providing direct voltage source on the bus) instead the GPIO\n  is switched to the reading mode causing the high state seen on the bus via\n  the pull-up resistor.\n\n* 1-wire touch support.\n\n  The 1-wire touch may substantially simplify complex bus activities consisting\n  of write-read pairs by combining them into a single touch activity. See\n  [examples](examples) for details.\n\n* Parasite powering support.\n\n  The 1-wire bus may be powered directly by the master MCU GPIO or via a switching\n  transistor controlled by a dedicated MCU GPIO. More details [below](#parasite-powering).\n\n* Search filtering.\n\n  Search algorithm allows efficient filtering basing on a selected set of family\n  codes. Maximum size of the set is configurable by `CONFIG_MAX_SEARCH_FILTERS`.\n\n* Overdrive (high-speed) mode support.\n\n  The overdrive mode enables speed up the 1-wire communication by a factor of 10.\n  Only limited number of 1-wire devices support this mode (e.g. DS2408, DS2431).\n\n* Dallas temperature sensors drivers.\n\n  [Generic Dallas thermometers](src/drivers/DSTherm.h) and\n  [MAX31850/MAX31851](src/drivers/MAX31850.h) drivers for handling Dallas\n  thermometers and thermocouples. See [examples](examples) for details.\n\n* OneWire compatibility interface.\n\n  The interface allows effortless switch into OneWireNg for projects using\n  OneWire library. See [below](#onewire-compatibility) for details.\n\n* Clear and flexible architecture.\n\n  The code architecture allows fast and easy porting for new Arduino platforms\n  or even usage core part of the library outside the Arduino environment.\n  See below for usage details on ESP-IDF, Pico SDK or Mbed OS based platforms.\n\n\u003ca name=\"usage\"\u003e\u003c/a\u003e\n## Usage\n\nRefer to [`examples`](examples) directory for usage details for each of the\nsupported frameworks: Arduino, ESP-IDF, Pico SDK and Mbed.\n\nFor API specification refer to sources inline documentation (mainly\n[`OneWireNg`](src/OneWireNg.h) class). For convenience it's possible to generate\nHTML/LaTeX [Doxygen](https://www.doxygen.nl/index.html) documentation by issuing\n`doxygen` from the main library directory. The documentation will be placed in\n`extras/doc`.\n\nFile [`src/OneWireNg_Config.h`](src/OneWireNg_Config.h) contains parameters\nconfiguring the library functionality. See the file for more details.\n\n\u003ca name=\"usage_idf\"\u003e\u003c/a\u003e\n### ESP-IDF (incl. ESP8266 RTOS SDK v3)\n\nPreferred way to add OneWireNg as a library for Espressif [ESP-IDF](https://github.com/espressif/esp-idf)\nframework is to add it as a git submodule located at project's `components`\nsubdirectory:\n\n```\ngit submodule add -- https://github.com/pstolarz/OneWireNg components/OneWireNg\n```\n\nNext checkout specific library `VERSION`:\n\n```\ncd components/OneWireNg\ngit checkout VERSION\n```\n\nWhile added the library shall be configured via ESP-IDF native configuration\n(see [`Kconfig`](Kconfig) for details), which shadows the `OneWireNg_Config.h`\nconfiguration file.\n\n\u003ca name=\"usage_pico\"\u003e\u003c/a\u003e\n### Pico SDK\n\nPreferred way to add OneWireNg as a library for [Raspberry Pi Pico SDK](https://github.com/raspberrypi/pico-sdk)\nframework is to add it as a git submodule:\n\n```\ngit submodule add -- https://github.com/pstolarz/OneWireNg OneWireNg\n```\n\nCheckout on a specific library `VERSION`:\n\n```\ncd OneWireNg\ngit checkout VERSION\n```\n\nFinally add OneWireNg as a library in a Pico SDK project's `CMakeLists.txt`\nfile as follows:\n\n```\ncmake_minimum_required(VERSION 3.13)\ninclude(pico_sdk_import.cmake)\n\nproject(some_project)\npico_sdk_init()\n\nadd_executable(some_project)\n\n...\n\nadd_subdirectory(OneWireNg)\ntarget_link_libraries(some_project PRIVATE OneWireNg)\n\npico_add_extra_outputs(some_project)\n```\n\n\u003ca name=\"usage_mbed\"\u003e\u003c/a\u003e\n### Mbed OS\n\n*NOTE: The library usage for [Mbed OS](https://os.mbed.com) is experimental.\nThe only board used for tests of this framework is NUCLEO-L552ZE-Q.*\n\nTo add OneWireNg as a library for Mbed framework project use (for specific\n`VERSION`):\n\n```\nmbed add https://github.com/pstolarz/OneWireNg#VERSION\n```\n\nWhile added the library shall be configured via Mbed native configuration (see\n[`mbed_lib.json`](mbed_lib.json) for details), which shadows the\n`OneWireNg_Config.h` configuration file.\n\n\u003ca name=\"supported_plats\"\u003e\u003c/a\u003e\n## Supported platforms\n\n* Arduino AVR.\n    * Platform class: `OneWireNg_ArduinoAVR`.\n    * Tested on Arduino UNO (ATmega328P).\n* Arduino megaAVR (recent Microchip AVR architecture).\n    * Platform class: `OneWireNg_ArduinoMegaAVR`.\n    * [Reported to be working.](https://github.com/SpenceKonde/megaTinyCore/blob/master/megaavr/extras/LibraryCompatibility.md)\n* Arduino ESP8266/ESP-IDF.\n    * Platform class: `OneWireNg_ArduinoIdfESP8266`.\n    * Tested on WemOS D1.\n* Arduino/ESP-IDF ESP32 (classic, S, C, H and P families).\n    * Platform class: `OneWireNg_ArduinoIdfESP32`.\n    * Tested on ESP32-WROOM-32, ESP32-S2-WROVER, ESP32-S3-WROOM-1, ESP32-C3-32S-Kit.\n* Arduino/Pico SDK RP2040.\n    * Platform classes: `OneWireNg_PicoRP2040`, `OneWireNg_PicoRP2040PIO`.\n    * Tested on Raspberry Pi Pico.\n* Arduino/Mbed OS based platforms (incl. Edge, Giga, Nano, Nicla, Portena, RP2040).\n    * Platform class: `OneWireNg_ArduinoMbedHAL`.\n    * Tested on Raspberry Pi Pico, Nucleo-144 (L552ZE-Q).\n* Arduino STM32.\n    * Platform class: `OneWireNg_ArduinoSTM32`.\n    * Tested on Nucleo-144 (L552ZE-Q).\n* Arduino SAM.\n    * Platform class: `OneWireNg_ArduinoSAM`.\n    * [Reported to be working.](https://github.com/pstolarz/OneWireNg/issues/33)\n* Arduino SAMD/SAMD-Beta.\n    * Platform class: `OneWireNg_ArduinoSAMD`.\n    * **Not tested**.\n\nNOTE: Expect more platforms support in the future. **I'm inviting all developers**\neager to help me with porting and testing the library for new platforms.\n\n\u003ca name=\"od_mode\"\u003e\u003c/a\u003e\n## Overdrive mode\n\nWhen configured with `CONFIG_OVERDRIVE_ENABLED` the library supports 1-wire\noverdrive mode. The mode requires very strict and short timings while bit-banging\ndata on the 1-wire bus, therefore is vulnerable for any inaccuracies.\n\nWhile configured with `CONFIG_BITBANG_DELAY_CCOUNT` the mode is confirmed to\nwork on the following platforms and CPU frequencies:\n\n* AVR\n    * Arduino UNO (ATmega328P); 16MHz.\n* ESP8266\n    * WemOS D1; 160,80MHz.\n* ESP32\n    * ESP32-WROOM-32; 240,160,80,40,20MHz\n    * ESP32-S2-WROVER; 240,160,80,40,20,10MHz\n    * ESP32-S3-WROOM-1; 240,160,80MHz (other freqs not tested)\n    * ESP32-C3-32S-Kit; 240,160MHz (other freqs not tested)\n* RP2040\n    * Raspberry Pi Pico; 50-250MHz (bit-banging and PIO drivers)\n* STM32\n    * NUCLEO-L552ZE-Q; 110MHz\n\n\u003ca name=\"parasite\"\u003e\u003c/a\u003e\n## Parasite powering\n\n**Bit-banging drivers**\n\nFor bit-banging type of drivers, the library supports two modes of providing\na direct voltage source on the 1-wire bus for parasitically powered slaves:\n\n1. If platform's GPIO set to the high-state (in the output mode) is able to\n   serve as a voltage source, the library may leverage this trait. The master\n   MCU GPIO controlling the 1-wire bus is set to the high-state powering the\n   bus when additional energy is needed for connected slaves.\n\n2. If platform's GPIO is of an open-drain type, then a GPIO is not able to\n   directly serve as a voltage source powering the connected slaves. In this\n   case an additional switching transistor is leveraged to control providing\n   an external power source to the bus and is controlled by a dedicated\n   power-control-GPIO as presented on the following figure.\n\n![Switching transistor parasite powering](extras/img/parasite.svg)\n\nTo enable the second mode the library needs to be configured with\n`CONFIG_PWR_CTRL_ENABLED`.\n\nChoice between the two types is made by selecting appropriate constructor of a\nplatform class. For example:\n\n```cpp\n#include \"OneWireNg_CurrentPlatform.h\"\n\nstatic OneWireNg *ow = NULL;\n\nvoid setup()\n{\n    /*\n     * Macro-defines used:\n     *\n     * OW_PIN: GPIO pin number used for bit-banging 1-wire bus.\n     * PWR_CTRL_PIN: power-control-GPIO pin number (optional).\n     */\n#ifdef PWR_CTRL_PIN\n# if CONFIG_PWR_CTRL_ENABLED\n#  error \"CONFIG_PWR_CTRL_ENABLED needs to be configured\"\n# endif\n    // switching transistor powering\n    ow = new OneWireNg_CurrentPlatform(OW_PIN, PWR_CTRL_PIN);\n#else\n    // GPIO bit-bang powering\n    ow = new OneWireNg_CurrentPlatform(OW_PIN);\n#endif\n\n    // ...\n\n    // write array of bytes and power the bus subsequently;\n    // the bus is powered until explicit unpowering or next 1-wire bus activity\n    ow-\u003ewriteBytes(bytes, bytes_len, true);\n\n    // wait for connected slaves to fulfill their task requiring extra powering\n    delay(750);\n\n    // unpower the bus explicitly\n    ow-\u003epowerBus(false);\n}\n```\n\nconfigures 1-wire service to work in one of the above modes.\n\n**RP2040 PIO driver**\n\nRP2040 PIO driver (`OneWireNg_PicoRP2040PIO` class) doesn't support\npower-control-GPIO configuration. Since RP2040 platform is able to provide\ndirect voltage source via its GPIO pads, parasitically powered devices need\nto be powered directly by GPIO controlling the 1-wire bus while using this\ndriver.\n\n**Caveats**\n\n* Parasite powered slaves are less stable (more error prone) than regularly\n  powered devices. If possible, try to avoid parasitically powered setups.\n\n* For legacy AVR (non mega-AVR) and ESP8266 platforms (especially working\n  in the parasitic mode) there are observed problems unless the parameter\n  `CONFIG_BUS_BLINK_PROTECTION` is configured.\n\n\u003ca name=\"arch\"\u003e\u003c/a\u003e\n## Architecture details\n\n![OneWirNg class diagram](extras/img/classOneWireNg__inherit__graph.png)\n\n\u003ca name=\"arch_owng\"\u003e\u003c/a\u003e\n### `OneWireNg`\n\nThe class provides public interface for 1-wire service. Object of this class\nisn't constructed directly rather than casted from a derived class object\nimplementing platform specific details.\n\nAs an example:\n\n```cpp\n#include \"OneWireNg_CurrentPlatform.h\"\n\nstatic OneWireNg *ow = NULL;\n\nvoid setup()\n{\n    OneWireNg::Id id;\n    ow = new OneWireNg_CurrentPlatform(10);\n\n    ow-\u003esearchReset();\n    while (ow-\u003esearch(id) == OneWireNg::EC_MORE) {\n        // 'id' contains 1-wire address of a connected slave\n    }\n}\n```\n\ncreates 1-wire service interface for current platform and performs search on\nthe bus. The bus is controlled by MCU pin number 10. Alternatively it is possible\nto use C++11 range loop to detect slaves connected to the 1-wire bus:\n\n```cpp\n#include \"OneWireNg_CurrentPlatform.h\"\n\nstatic OneWireNg *ow = NULL;\n\nvoid setup()\n{\n    ow = new OneWireNg_CurrentPlatform(10);\n\n    for (const auto\u0026 id: *ow) {\n        // 'id' contains 1-wire address of a connected slave\n    }\n}\n```\n\nNOTE: During creation of an `OneWireNg` object, the class constructor performs\nvarious platform specific activities required to setup the 1-wire service. For\nthis reason the `OneWireNg` object may be created only when the platform itself\nis fully started-up and initialized, e.g. in `setup()` method but not as a\nglobal variable initialized during its creation.\n\nAdditionally it is strongly recommended to maintain single `OneWireNg` service\nobject across all 1-wire activities handled by this service on a specific bus.\nOf course it is perfectly possible to created multiple `OneWireNg` services\nhandling different 1-wire buses.\n\n\u003ca name=\"arch_owng_malloc\"\u003e\u003c/a\u003e\n#### Memory allocation caveat\n\nIf heap allocation is inadvisable use in-place `new` operator:\n\n```cpp\n#include \"OneWireNg_CurrentPlatform.h\"\n\nALLOC_ALIGNED static uint8_t OneWireNg_buf[sizeof(OneWireNg_CurrentPlatform)];\nstatic OneWireNg *ow = NULL;\n\nvoid setup()\n{\n    ow = new (OneWireNg_buf) OneWireNg_CurrentPlatform(10);\n    // ...\n}\n```\n\nor use `Placeholder` utility template to store `OneWireNg` specialized object:\n\n```cpp\n#include \"OneWireNg_CurrentPlatform.h\"\n#include \"utils/Placeholder.h\"\n\nstatic Placeholder\u003cOneWireNg_CurrentPlatform\u003e ow;\n\nvoid setup()\n{\n    // initialize the placeholded object by in-place new\n    new (\u0026ow) OneWireNg_CurrentPlatform(10);\n    // ...\n}\n```\n\nRefer to [examples](examples) for more information how to use the `Placeholder`\nin the context of object stored within.\n\n\u003ca name=\"arch_bb\"\u003e\u003c/a\u003e\n### `OneWireNg_BitBang`\n\nThe class is derived from `OneWireNg` and implements the 1-wire interface basing\non GPIO bit-banging. Object of this class isn't constructed directly rather than\nthe class is intended to be inherited by a derived class providing protected\ninterface implementation for low level GPIO activities (set mode, read, write).\n\n\u003ca name=\"arch_plat\"\u003e\u003c/a\u003e\n### `OneWireNg_PLATFORM`\n\nAre family of classes providing platform specific implementation (`PLATFORM`\nstates for a platform name e.g. `OneWireNg_ArduinoAVR` provides AVR implementation\nfor Arduino environment).\n\nThe platform classes implement `OneWireNg` interface directly (via direct\n`OneWireNg` class inheritance) or indirectly (e.g. GPIO bit-banging implementation\nbases on `OneWireNg_BitBang`, which provides GPIO bit-banging 1-wire service\nimplementation leaving the platform class to provide platform specific low-level\nGPIO activities details).\n\nPlatform classes have a public constructor allowing to create 1-wire service for\na particular platform (see [above](#architecture-details)).\n\nNOTE: For the convenience there has been provided `OneWireNg_CurrentPlatform.h`\nheader which tries to detect platform the compilation is proceeded and:\n * include proper platform class header,\n * assign `OneWireNg_CurrentPlatform` macro-define to the detected platform class.\n\n\u003ca name=\"arch_rp2040\"\u003e\u003c/a\u003e\n### RP2040 drivers\n\n`OneWireNg_PicoRP2040PIO` is derived from `OneWireNg` and implements the 1-wire\ninterface for RP2040 MCU using Programmable I/O (PIO) peripheral. Second type\nof driver supporting RP2040 platform is `OneWireNg_PicoRP2040` bit-banging\ndriver. Use `CONFIG_RP2040_PIO_DRIVER` configuration parameter to setup a\nspecific driver for the platform (by default `CONFIG_RP2040_PIO_DRIVER` configures\nthe PIO driver as default one for RP2040 MCU).\n\nNOTE: There are observed problems with Pico SDK's serial output (USB,\nUART) while using the bit-banging driver in `TIMING_STRICT` mode (see\n`CONFIG_BITBANG_TIMING`).\n\n\u003ca name=\"arch_rp2040pio_multi_bus\"\u003e\u003c/a\u003e\n#### RP2040 PIO driver controlling many buses\n\nNumber of GPIOs which may be handled by `OneWireNg_PicoRP2040PIO` driver objects\nis limited to:\n\n* 8 - if `CONFIG_RP2040_PIOSM_NUM_USED` is set to `1`. In this is case 4 drivers\n  are handled by RP2040's `PIO0` and 4 by `PIO1`.\n* 4 - if `CONFIG_RP2040_PIOSM_NUM_USED` is set to `2`. In this is case 2 drivers\n  are handled by RP2040's `PIO0` and 2 by `PIO1`.\n\nNOTE: The above limits assume the RP2040's PIO is not used by other programs\noccupying its resources. In such case the limits are of course lower.\n\nThe following code presents how to create the PIO drivers controlling multiple\nbuses (dynamic allocation version).\n\n```cpp\nconstexpr bool INT_PULLUP = false;\n\n// the driver is handled by PIO0/SM0\nOneWireNg *ow1 = new OneWireNg_PicoRP2040PIO(PIN1, INT_PULLUP, 0);\n\n// create more drivers handled by PIO0/SM1..3\n// the drivers reuse PIO0 program loaded by driver ow1\nOneWireNg *ow2 = new OneWireNg_PicoRP2040PIO(PIN2, INT_PULLUP, (OneWireNg_PicoRP2040PIO\u0026)*ow1);\n#if CONFIG_RP2040_PIOSM_NUM_USED \u003c= 1\nOneWireNg *ow3 = new OneWireNg_PicoRP2040PIO(PIN3, INT_PULLUP, (OneWireNg_PicoRP2040PIO\u0026)*ow1);\nOneWireNg *ow4 = new OneWireNg_PicoRP2040PIO(PIN4, INT_PULLUP, (OneWireNg_PicoRP2040PIO\u0026)*ow1);\n#endif\n\n// the driver is handled by PIO1/SM0\nOneWireNg *ow5 = new OneWireNg_PicoRP2040PIO(PIN5, INT_PULLUP, 1);\n\n// create more drivers handled by PIO1/SM1..3\n// the drivers reuse PIO1 program loaded by driver ow5\nOneWireNg *ow6 = new OneWireNg_PicoRP2040PIO(PIN6, INT_PULLUP, (OneWireNg_PicoRP2040PIO\u0026)*ow5);\n#if CONFIG_RP2040_PIOSM_NUM_USED \u003c= 1\nOneWireNg *ow7 = new OneWireNg_PicoRP2040PIO(PIN7, INT_PULLUP, (OneWireNg_PicoRP2040PIO\u0026)*ow5);\nOneWireNg *ow8 = new OneWireNg_PicoRP2040PIO(PIN8, INT_PULLUP, (OneWireNg_PicoRP2040PIO\u0026)*ow5);\n#endif\n```\n\nNOTE: In the above example drivers `ow2`..`ow4` use `ow1` as a base driver,\nwhich means the `ow1` must live as long as the dependant drivers. Similarly\nwith `ow6`..`ow8` and `ow5` driver.\n\n\u003ca name=\"ow\"\u003e\u003c/a\u003e\n## OneWire compatibility\n\n[`OneWire`](src/OneWire.h) class provides compatibility interface between\nOneWireNg and [OneWire](https://github.com/PaulStoffregen/OneWire) library.\nThe main purpose of this class is to provide fast and effortless mechanism for\ndevelopers experiencing issues with OneWire and eager to give OneWireNg a try.\nFinally, it's strongly recommended to switch into OneWireNg interface rather\nthan stay with the OneWire due to OneWireNg's more mature and feature-rich API\n(search filtering, OD mode, touch support).\n\n\u003ca name=\"ow_dallas\"\u003e\u003c/a\u003e\n### DallasTemperature library\n\nAs an example of usage of the compatibility interface there has been created\nthe [following fork](https://github.com/pstolarz/Arduino-Temperature-Control-Library/tree/OneWireNg)\nof [DallasTemperature](https://github.com/milesburton/Arduino-Temperature-Control-Library)\nlibrary ported with OneWireNg.\n\n\u003ca name=\"license\"\u003e\u003c/a\u003e\n## License\n\n2 clause BSD license. See [`LICENSE`](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpstolarz%2Fonewireng","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpstolarz%2Fonewireng","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpstolarz%2Fonewireng/lists"}