{"id":19244389,"url":"https://github.com/nanoframework/nanoframework.device.onewire","last_synced_at":"2025-04-21T09:33:37.260Z","repository":{"id":42570159,"uuid":"156574933","full_name":"nanoframework/nanoFramework.Device.OneWire","owner":"nanoframework","description":":package: .NET nanoFramework 1-Wire Class Library","archived":false,"fork":false,"pushed_at":"2025-04-02T10:27:23.000Z","size":228,"stargazers_count":5,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-19T17:15:41.920Z","etag":null,"topics":["csharp","dotnet","hacktoberfest","library","nanoframework"],"latest_commit_sha":null,"homepage":"https://www.nanoframework.net","language":"C#","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nanoframework.png","metadata":{"funding":{"open_collective":"nanoframework","github":"nanoframework"},"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2018-11-07T16:21:13.000Z","updated_at":"2025-04-02T10:20:46.000Z","dependencies_parsed_at":"2023-12-18T22:24:45.398Z","dependency_job_id":"0e906d95-28a6-4ab6-b3a8-88e7232eea64","html_url":"https://github.com/nanoframework/nanoFramework.Device.OneWire","commit_stats":{"total_commits":208,"total_committers":11,"mean_commits":18.90909090909091,"dds":0.4375,"last_synced_commit":"b0641f8230bd96e9b4c930a38a8ef3d62b0feb6e"},"previous_names":["nanoframework/nanoframework.devices.onewire"],"tags_count":75,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoframework%2FnanoFramework.Device.OneWire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoframework%2FnanoFramework.Device.OneWire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoframework%2FnanoFramework.Device.OneWire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoframework%2FnanoFramework.Device.OneWire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nanoframework","download_url":"https://codeload.github.com/nanoframework/nanoFramework.Device.OneWire/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250032492,"owners_count":21363846,"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":["csharp","dotnet","hacktoberfest","library","nanoframework"],"created_at":"2024-11-09T17:23:13.774Z","updated_at":"2025-04-21T09:33:37.244Z","avatar_url":"https://github.com/nanoframework.png","language":"C#","funding_links":["https://opencollective.com/nanoframework","https://github.com/sponsors/nanoframework"],"categories":[],"sub_categories":[],"readme":"[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_nanoFramework.Device.OneWire\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=nanoframework_nanoFramework.Device.OneWire) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_nanoFramework.Device.OneWire\u0026metric=reliability_rating)](https://sonarcloud.io/dashboard?id=nanoframework_nanoFramework.Device.OneWire) [![NuGet](https://img.shields.io/nuget/dt/nanoFramework.Device.OneWire.svg?label=NuGet\u0026style=flat\u0026logo=nuget)](https://www.nuget.org/packages/nanoFramework.Device.OneWire/) [![#yourfirstpr](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://github.com/nanoframework/Home/blob/main/CONTRIBUTING.md) [![Discord](https://img.shields.io/discord/478725473862549535.svg?logo=discord\u0026logoColor=white\u0026label=Discord\u0026color=7289DA)](https://discord.gg/gCyBu8T)\n\n![nanoFramework logo](https://raw.githubusercontent.com/nanoframework/Home/main/resources/logo/nanoFramework-repo-logo.png)\n\n-----\n\n# Welcome to the .NET **nanoFramework** 1-Wire\u0026reg; Class Library repository\n\n## Build status\n\n| Component | Build Status | NuGet Package |\n|:-|---|---|\n| nanoFramework.Device.OneWire | [![Build Status](https://dev.azure.com/nanoframework/nanoFramework.Device.OneWire/_apis/build/status/nanoFramework.Devices.OneWire?repoName=nanoframework%2FnanoFramework.Device.OneWire\u0026branchName=main)](https://dev.azure.com/nanoframework/nanoFramework.Device.OneWire/_build/latest?definitionId=15\u0026repoName=nanoframework%2FnanoFramework.Device.OneWire\u0026branchName=main) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.Device.OneWire.svg?label=NuGet\u0026style=flat\u0026logo=nuget)](https://www.nuget.org/packages/nanoFramework.Device.OneWire/) |\n\n## 1-Wire\u0026reg; bus\n\n1-Wire\u0026reg; it's a communication protocol, property of Maxim Semiconductor. You can read the technical details about it on [this guide](https://www.maximintegrated.com/en/design/technical-documents/tutorials/1/1796.html).\n\n## .NET nanoFramework implementation\n\nOur low level implementation of the 1-Wire communication uses an UART to achieve precise timing with the less possible burden on the MCU.\nFor that reason it requires an UART and shunting together it's RX and TX pins. Depending on the bus length and impedance it may be required connecting an external pull-up resistor to provide the necessary signalling for 1-Wire communication.\n\n**Important**: If you're using an ESP32 device it's mandatory to configure the UART2 pins before creating the `OneWireHost`. To do that, you have to add a reference to [`nanoFramework.Hardware.ESP32`](https://www.nuget.org/packages/nanoFramework.Hardware.Esp32). In the code snippet below we're assigning GPIOs 21 and 22 to UART2. Also note that `UART2` it's referred as `COM3` in C#.\n\n```csharp\n////////////////////////////////////////////////////////////////////////\n// Configure pins 21 and 22 to be used in UART2 (that's refered as COM3)\nConfiguration.SetPinFunction(21, DeviceFunction.COM3_RX);\nConfiguration.SetPinFunction(22, DeviceFunction.COM3_TX);\n```\n\nTake note, on some ESP32 development kits, the pins you're planning on using for UART2 could be used for internal purposes.\nFor example, development kits based on either ESP32-WROOM-32 or ESP32-WROVER-E can have the same pinouts and silkscreen. If the kit is based on ESP32-WROVER-E the GPIOs 17 and 16 are used to address its extended memory (PSRAM), and cannot be used for other purposes, event though they are present as external pins.\nYou can use any other GPIO pins that's free for UART2 pins using Configuration.SetPinFunction.\n\nFor other devices, like STM32 ones, there is no need to configure the GPIO pins. You have to find in the respective device documentation what are the UART pins used for 1-Wire.\n\n## Usage examples\n\nTo connect to a 1-Wire bus and perform operations with the connected devices, one has to first instantiate the OneWireHost.\n\n```csharp\nOneWireHost _OneWireHost = new OneWireHost();\n```\n\nTo find the first device connected to the 1-Wire bus, and perform a reset on the bus before performing the search, the following call should be made:\n\n```csharp\n_OneWireHost.FindFirstDevice(true, false);\n```\n\nTo write a byte with the value 0x44 to the connected device:\n\n```csharp\n_OneWireHost.WriteByte(0x44);\n```\n\nTo get a list with the serial number of all the 1-Wire devices connected to the bus:\n\n```csharp\nvar deviceList = _OneWireHost.FindAllDevices();\n\nforeach(byte[] device in deviceList)\n{\n    string serial = \"\";\n\n    foreach (byte b in device)\n    {\n        serial += b.ToString(\"X2\");\n    }\n\n    Console.WriteLine($\"{serial}\");\n}\n```\n\n## Feedback and documentation\n\nFor documentation, providing feedback, issues and finding out how to contribute please refer to the [Home repo](https://github.com/nanoframework/Home).\n\nJoin our Discord community [here](https://discord.gg/gCyBu8T).\n\n## Credits\n\nThe list of contributors to this project can be found at [CONTRIBUTORS](https://github.com/nanoframework/Home/blob/main/CONTRIBUTORS.md).\n\n## License\n\nThe **nanoFramework** Class Libraries are licensed under the [MIT license](LICENSE.md).\n\n## Code of Conduct\n\nThis project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behaviour in our community.\nFor more information see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct).\n\n## .NET Foundation\n\nThis project is supported by the [.NET Foundation](https://dotnetfoundation.org).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnanoframework%2Fnanoframework.device.onewire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnanoframework%2Fnanoframework.device.onewire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnanoframework%2Fnanoframework.device.onewire/lists"}