From e56fde2a9f5f156995d1d0564af17fd4b2214568 Mon Sep 17 00:00:00 2001 From: josesimoes Date: Thu, 1 Oct 2020 10:01:34 +0100 Subject: [PATCH 01/51] Initial commit - Import files from Windows.Devices.I2c. - Renames in CD-CI files. ***NO_CI*** --- .github/workflows/update-dependencies.yml | 50 +++ .github_changelog_generator | 13 + .gitignore | 255 +++++++++++++ CHANGELOG.md | 0 CODE_OF_CONDUCT.md | 3 + CONTRIBUTING.md | 3 + LICENSE | 21 ++ NuGet.Config | 7 + README.md | 38 +- Windows.Devices.I2c/I2cBusSpeed.cs | 23 ++ Windows.Devices.I2c/I2cConnectionSettings.cs | 93 +++++ Windows.Devices.I2c/I2cController.cs | 157 ++++++++ Windows.Devices.I2c/I2cControllerManager.cs | 53 +++ Windows.Devices.I2c/I2cDevice.cs | 348 ++++++++++++++++++ Windows.Devices.I2c/I2cSharingMode.cs | 26 ++ Windows.Devices.I2c/I2cTransferResult.cs | 31 ++ Windows.Devices.I2c/I2cTransferStatus.cs | 38 ++ Windows.Devices.I2c/II2cDeviceStatics.cs | 40 ++ .../Properties/AssemblyInfo.cs | 25 ++ .../Windows.Devices.I2c.nfproj | 81 ++++ Windows.Devices.I2c/key.snk | Bin 0 -> 596 bytes Windows.Devices.I2c/packages.config | 5 + azure-pipelines.yml | 44 +++ ...rk.Windows.Devices.I2c.DELIVERABLES.nuspec | 32 ++ nanoFramework.Windows.Devices.I2c.nuspec | 35 ++ nanoFramework.Windows.Devices.I2c.sln | 33 ++ readme.txt | 21 ++ template.vssettings | 74 ++++ version.json | 24 ++ 29 files changed, 1572 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/update-dependencies.yml create mode 100644 .github_changelog_generator create mode 100644 .gitignore create mode 100644 CHANGELOG.md create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 NuGet.Config create mode 100644 Windows.Devices.I2c/I2cBusSpeed.cs create mode 100644 Windows.Devices.I2c/I2cConnectionSettings.cs create mode 100644 Windows.Devices.I2c/I2cController.cs create mode 100644 Windows.Devices.I2c/I2cControllerManager.cs create mode 100644 Windows.Devices.I2c/I2cDevice.cs create mode 100644 Windows.Devices.I2c/I2cSharingMode.cs create mode 100644 Windows.Devices.I2c/I2cTransferResult.cs create mode 100644 Windows.Devices.I2c/I2cTransferStatus.cs create mode 100644 Windows.Devices.I2c/II2cDeviceStatics.cs create mode 100644 Windows.Devices.I2c/Properties/AssemblyInfo.cs create mode 100644 Windows.Devices.I2c/Windows.Devices.I2c.nfproj create mode 100644 Windows.Devices.I2c/key.snk create mode 100644 Windows.Devices.I2c/packages.config create mode 100644 azure-pipelines.yml create mode 100644 nanoFramework.Windows.Devices.I2c.DELIVERABLES.nuspec create mode 100644 nanoFramework.Windows.Devices.I2c.nuspec create mode 100644 nanoFramework.Windows.Devices.I2c.sln create mode 100644 readme.txt create mode 100644 template.vssettings create mode 100644 version.json diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml new file mode 100644 index 0000000..a2c2cf3 --- /dev/null +++ b/.github/workflows/update-dependencies.yml @@ -0,0 +1,50 @@ +# Copyright (c) .NET Foundation and Contributors +# See LICENSE file in the project root for full license information. + +# This workflow will periodically check .NET nanoFramework dependencies and updates them in the repository it's running. + +name: Daily update dependencies + +on: + schedule: + # At 00:00 UTC every day. + - cron: '00 00 * * *' + repository_dispatch: + types: update-dependencies + +defaults: + run: + shell: pwsh + +jobs: + update-dotnet-preview: + name: Update .NET nanoFramework dependencies + timeout-minutes: 15 + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v2.3.1 + with: + path: main + - name: Checkout tools repo + uses: actions/checkout@v2.3.1 + with: + repository: nanoframework/nf-tools + path: tools + - name: Update dependencies + run: ./github-actions/update-nf-dependencies.ps1 + working-directory: tools + - name: Create Pull Request + uses: peter-evans/create-pull-request@v2.8.1 + if: env.CREATE_PR == 'true' + with: + title: '${{ env.PR_TITLE }}' + body: | + ${{ env.PR_MESSAGE }} + + [version update] + + ### :warning: This is an automated update. :warning: + committer: 'nfbot ' + branch: ${{ env.BRANCH_NAME }} + path: main diff --git a/.github_changelog_generator b/.github_changelog_generator new file mode 100644 index 0000000..ebbfebc --- /dev/null +++ b/.github_changelog_generator @@ -0,0 +1,13 @@ +user=nanoframework +project=lib-System.Device.I2c +issues=true +add_issues_wo_labels=false +add_pr_wo_labels=false +add_issues_wo_labels=false +filter_issues_by_milestone=false +exclude_labels=Area: Config-and-Build,Area: Infrastructure-and-Organization,reverted +enhancement_labels=Type: enhancement +bug_labels=Type: bug +merge_prefix=**Documentation and other chores:** +unreleased_label=**Changes available only in 'Preview' NuGet packages:** +author=false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ce3e1b1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,255 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +#SoundCloud +*.sonarqube/ diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e69de29 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..7feff0a --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,3 @@ +# Contributor Code of Conduct + +Please refer to the contributor Code of Conduct at the Home repository [here](https://github.com/nanoframework/Home/blob/master/CODE_OF_CONDUCT.md. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..5a6a6c1 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,3 @@ +# Contributing to **nanoFramework** + +Please refer to the contribution guidelines at the Home repository [here](https://github.com/nanoframework/Home/blob/master/CONTRIBUTING.md). diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..94286c9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) .NET Foundation and Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/NuGet.Config b/NuGet.Config new file mode 100644 index 0000000..ef0bacf --- /dev/null +++ b/NuGet.Config @@ -0,0 +1,7 @@ + + + + + + + diff --git a/README.md b/README.md index fc563ed..45d0dad 100644 --- a/README.md +++ b/README.md @@ -1 +1,37 @@ -# lib-System.Device.I2c \ No newline at end of file +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-Windows.Devices.I2c&metric=alert_status)](https://sonarcloud.io/dashboard?id=nanoframework_lib-Windows.Devices.I2c) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-Windows.Devices.I2c&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=nanoframework_lib-Windows.Devices.I2c) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![NuGet](https://img.shields.io/nuget/dt/nanoFramework.Windows.Devices.I2c.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.Windows.Devices.I2c/) [![#yourfirstpr](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://github.com/nanoframework/Home/blob/master/CONTRIBUTING.md) [![Discord](https://img.shields.io/discord/478725473862549535.svg?logo=discord&logoColor=white&label=Discord&color=7289DA)](https://discord.gg/gCyBu8T) + +![nanoFramework logo](https://github.com/nanoframework/Home/blob/master/resources/logo/nanoFramework-repo-logo.png) + +----- + +### Welcome to the **nanoFramework** Windows.Devices.I2c Library repository! + +## Build status + +| Component | Build Status | NuGet Package | +|:-|---|---| +| Windows.Devices.I2c | [![Build Status](https://dev.azure.com/nanoframework/Windows.Devices.I2c/_apis/build/status/nanoframework.lib-Windows.Devices.I2c?branchName=develop)](https://dev.azure.com/nanoframework/Windows.Devices.I2c/_build/latest?definitionId=28?branchName=master) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.Windows.Devices.I2c.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.Windows.Devices.I2c/) | +| Windows.Devices.I2c (preview) | [![Build Status](https://dev.azure.com/nanoframework/Windows.Devices.I2c/_apis/build/status/nanoframework.lib-Windows.Devices.I2c?branchName=develop)](https://dev.azure.com/nanoframework/Windows.Devices.I2c/_build/latest?definitionId=28?branchName=develop) | [![](https://badgen.net/badge/NuGet/preview/D7B023?icon=https://simpleicons.now.sh/azuredevops/fff)](https://dev.azure.com/nanoframework/feed/_packaging?_a=package&feed=sandbox&package=nanoFramework.Windows.Devices.I2c&protocolType=NuGet&view=overview) | + +## Feedback and documentation + +For documentation, providing feedback, issues and finding out how to contribute please refer to the [Home repo](https://github.com/nanoframework/Home). + +Join our Discord community [here](https://discord.gg/gCyBu8T). + +## Credits + +The list of contributors to this project can be found at [CONTRIBUTORS](https://github.com/nanoframework/Home/blob/master/CONTRIBUTORS.md). + +## License + +The **nanoFramework** Class Libraries are licensed under the [MIT license](LICENSE.md). + +## Code of Conduct + +This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. +For more information see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct). + +### .NET Foundation + +This project is supported by the [.NET Foundation](https://dotnetfoundation.org). diff --git a/Windows.Devices.I2c/I2cBusSpeed.cs b/Windows.Devices.I2c/I2cBusSpeed.cs new file mode 100644 index 0000000..d0b4466 --- /dev/null +++ b/Windows.Devices.I2c/I2cBusSpeed.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) .NET Foundation and Contributors +// See LICENSE file in the project root for full license information. +// + +namespace Windows.Devices.I2c +{ + /// + /// Describes the bus speeds that are available for connecting to an inter-integrated circuit (I2C) device. + /// The bus speed is the frequency at which to clock the I2C bus when accessing the device. + /// + public enum I2cBusSpeed + { + /// + /// The standard speed of 100 kilohertz (kHz). This speed is the default. + /// + StandardMode, + /// + /// A fast speed of 400 kHz. + /// + FastMode + } +} diff --git a/Windows.Devices.I2c/I2cConnectionSettings.cs b/Windows.Devices.I2c/I2cConnectionSettings.cs new file mode 100644 index 0000000..7f42001 --- /dev/null +++ b/Windows.Devices.I2c/I2cConnectionSettings.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) .NET Foundation and Contributors +// See LICENSE file in the project root for full license information. +// + +using System; + +namespace Windows.Devices.I2c +{ + /// + /// Represents the connection settings you want to use for an inter-integrated circuit (I2C) device. + /// + public sealed class I2cConnectionSettings + { + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + private Int32 _slaveAddress; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + private I2cBusSpeed _busSpeed; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + private I2cSharingMode _sharingMode; + + /// + /// Creates and initializes a new instance of the I2cConnectionSettings class for inter-integrated circuit (I2C) device with specified bus address, + /// using the default settings of the standard mode for the bus speed and exclusive sharing mode. + /// + /// The bus address of the inter-integrated circuit (I2C) device to which the settings of the I2cConnectionSettings should apply. + /// Only 7-bit addressing is supported, so the range of values that are valid is from 8 to 119 (that's 0x08 and 0x77). + public I2cConnectionSettings(Int32 slaveAddress) + { + SlaveAddress = slaveAddress; + } + + /// + /// Initializes a copy of a object. + /// + /// Object to copy from. + internal I2cConnectionSettings(I2cConnectionSettings settings) + { + _slaveAddress = settings.SlaveAddress; + _busSpeed = settings.BusSpeed; + _sharingMode = settings.SharingMode; + } + + /// + /// Gets or sets the bus speed to use for connecting to an inter-integrated circuit (I2C) device. The bus speed is the frequency at which to clock the I2C bus when accessing the device. + /// + /// + /// The bus speed to use for connecting to anI2C device. + /// + public I2cBusSpeed BusSpeed + { + get { return _busSpeed; } + set { _busSpeed = value; } + } + + /// + /// Gets or sets the sharing mode to use to connect to the inter-integrated circuit (I2C) bus address. This mode determines whether other connections to the I2C bus address can be opened + /// while you are connect to the I2C bus address. + /// + /// + /// The sharing mode to use to connect to the I2C bus address. + /// + public I2cSharingMode SharingMode + { + get { return _sharingMode; } + set { _sharingMode = value; } + } + + /// + /// Gets or sets the bus address of the inter-integrated circuit (I2C) device. + /// + /// + /// The bus address of the I2C device. Only 7-bit addressing is supported, so the range of values that are valid is from 8 to 119 (that's 0x08 and 0x77). + /// + public int SlaveAddress + { + get { return _slaveAddress; } + set + { + // better validate the address + // 0 is a valid address : General Call. Special usage but valid. + if (value != 0 && (value < 8 || value > 119)) + { + throw new ArgumentOutOfRangeException(); + } + + _slaveAddress = value; + } + } + } +} diff --git a/Windows.Devices.I2c/I2cController.cs b/Windows.Devices.I2c/I2cController.cs new file mode 100644 index 0000000..a5024cc --- /dev/null +++ b/Windows.Devices.I2c/I2cController.cs @@ -0,0 +1,157 @@ +// +// Copyright (c) .NET Foundation and Contributors +// See LICENSE file in the project root for full license information. +// + +using System; +using System.Collections; +using System.Runtime.CompilerServices; + +namespace Windows.Devices.I2c +{ + /// + /// Represents the I2C controller for the system. + /// + public sealed class I2cController + { + // this is used as the lock object + // a lock is required because multiple threads can access the I2cController + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + private object _syncLock; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + internal readonly int _controllerId; + + // backing field for DeviceCollection + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + private ArrayList s_deviceCollection; + + /// + /// Device collection associated with this . + /// + /// + /// This collection is for internal use only. + /// + internal ArrayList DeviceCollection + { + get + { + if (s_deviceCollection == null) + { + if (_syncLock == null) + { + _syncLock = new object(); + } + + lock (_syncLock) + { + if (s_deviceCollection == null) + { + s_deviceCollection = new ArrayList(); + } + } + } + + return s_deviceCollection; + } + + set + { + s_deviceCollection = value; + } + } + + internal I2cController(string controller) + { + // the I2C id is an ASCII string with the format 'I2Cn' + // need to grab 'n' from the string and convert that to the integer value from the ASCII code (do this by subtracting 48 from the char value) + _controllerId = controller[3] - '0'; + + // check if this controller is already opened + if (FindController(_controllerId) == null) + { + _syncLock = new object(); + + // call native init to allow HAL/PAL inits related with I2C hardware + // this is also used to check if the requested ADC actually exists + NativeInit(); + + // add controller to collection, with the ID as key + // *** just the index number *** + I2cControllerManager.ControllersCollection.Add(this); + } + else + { + // this controller already exists: throw an exception + throw new ArgumentException(); + } + } + + /// + /// Gets the default I2C controller on the system. + /// + /// The default I2C controller on the system, or null if the system has no I2C controller. + public static I2cController GetDefault() + { + string controllersAqs = GetDeviceSelector(); + string[] controllers = controllersAqs.Split(','); + + if (controllers.Length > 0) + { + // the I2C id is an ASCII string with the format 'I2Cn' + // need to grab 'n' from the string and convert that to the integer value from the ASCII code (do this by subtracting 48 from the char value) + var controllerId = controllers[0][3] - '0'; + + var myController = FindController(controllerId); + + if (myController != null) + { + // controller is already open + return (I2cController)I2cControllerManager.ControllersCollection[controllerId]; + } + else + { + // this controller is not in the collection, create it + return new I2cController(controllers[0]); + } + } + + // the system has no I2C controller + return null; + } + + /// + /// Gets the I2C device with the specified settings. + /// + /// + /// The desired connection settings. + public I2cDevice GetDevice(I2cConnectionSettings settings) + { + //TODO: fix return value. Should return an existing device (if any) + return new I2cDevice(String.Empty, settings); + } + + internal static I2cController FindController(int index) + { + for (int i = 0; i < I2cControllerManager.ControllersCollection.Count; i++) + { + if (((I2cController)I2cControllerManager.ControllersCollection[i])._controllerId == index) + { + return (I2cController)I2cControllerManager.ControllersCollection[i]; + } + } + + return null; + } + + #region Native Calls + + [MethodImpl(MethodImplOptions.InternalCall)] + private extern void NativeInit(); + + [MethodImpl(MethodImplOptions.InternalCall)] + internal static extern string GetDeviceSelector(); + + #endregion + } +} diff --git a/Windows.Devices.I2c/I2cControllerManager.cs b/Windows.Devices.I2c/I2cControllerManager.cs new file mode 100644 index 0000000..f6274cf --- /dev/null +++ b/Windows.Devices.I2c/I2cControllerManager.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) .NET Foundation and Contributors +// See LICENSE file in the project root for full license information. +// + +using System.Collections; + +namespace Windows.Devices.I2c +{ + internal sealed class I2cControllerManager + { + private static object _syncLock; + + // backing field for ControllersCollection + // to store the controllers that are open + private static ArrayList s_controllersCollection; + + /// + /// collection. + /// + /// + /// This collection is for internal use only. + /// + internal static ArrayList ControllersCollection + { + get + { + if (s_controllersCollection == null) + { + if(_syncLock == null) + { + _syncLock = new object(); + } + + lock (_syncLock) + { + if (s_controllersCollection == null) + { + s_controllersCollection = new ArrayList(); + } + } + } + + return s_controllersCollection; + } + + set + { + s_controllersCollection = value; + } + } + } +} diff --git a/Windows.Devices.I2c/I2cDevice.cs b/Windows.Devices.I2c/I2cDevice.cs new file mode 100644 index 0000000..52a6c31 --- /dev/null +++ b/Windows.Devices.I2c/I2cDevice.cs @@ -0,0 +1,348 @@ +// +// Copyright (c) .NET Foundation and Contributors +// See LICENSE file in the project root for full license information. +// + +using System; +using System.Runtime.CompilerServices; + +namespace Windows.Devices.I2c +{ + /// + /// Represents a communications channel to a device on an inter-integrated circuit (I2C) bus. + /// + public sealed class I2cDevice : IDisposable + { + // the device unique ID for the device is achieve by joining the I2C bus ID and the slave address + // should be unique enough by encoding it as: (I2C bus number x 1000 + slave address) + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + private const int deviceUniqueIdMultiplier = 1000; + + // this is used as the lock object + // a lock is required because multiple threads can access the device + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + private object _syncLock; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + private readonly int _deviceId; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + private readonly I2cConnectionSettings _connectionSettings; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + private bool _disposed; + + internal I2cDevice(string i2cBus, I2cConnectionSettings settings) + { + // generate a unique ID for the device by joining the I2C bus ID and the slave address, should be pretty unique + // the encoding is (I2C bus number x 1000 + slave address) + // i2cBus is an ASCII string with the bus name in format 'I2Cn' + // need to grab 'n' from the string and convert that to the integer value from the ASCII code (do this by subtracting 48 from the char value) + var controllerId = i2cBus[3] - 48; + var deviceId = (controllerId * deviceUniqueIdMultiplier) + settings.SlaveAddress; + + I2cController controller = I2cController.FindController(controllerId); + + if (controller == null) + { + // this controller doesn't exist yet, create it... + controller = new I2cController(i2cBus); + } + + // check if this device ID already exists + var device = FindDevice(controller, deviceId); + + if (device == null) + { + // device doesn't exist, create it... + _connectionSettings = new I2cConnectionSettings(settings.SlaveAddress) + { + BusSpeed = settings.BusSpeed, + SharingMode = settings.SharingMode + }; + + // save device ID + _deviceId = deviceId; + + // call native init to allow HAL/PAL inits related with I2C hardware + NativeInit(); + + // ... and add this device + controller.DeviceCollection.Add(this); + + _syncLock = new object(); + } + else + { + // this device already exists, throw an exception + throw new I2cDeviceAlreadyInUseException(); + } + } + + /// + /// Gets the connection settings used for communication with the inter-integrated circuit (I2C) device. + /// + /// + /// The connection settings used for communication with the inter-integrated circuit (I2C) device. + /// + public I2cConnectionSettings ConnectionSettings + { + get + { + lock (_syncLock) + { + // check if device has been disposed + if (!_disposed) + { + // need to return a copy so that the caller doesn't change the settings + return new I2cConnectionSettings(_connectionSettings); + } + + throw new ObjectDisposedException(); + } + } + } + + /// + /// Gets the plug and play device identifier of the inter-integrated circuit (I2C) bus controller for the device. + /// + /// + /// The plug and play device identifier of the inter-integrated circuit (I2C) bus controller for the device. + /// + public string DeviceId + { + get + { + lock (_syncLock) + { + // check if device has been disposed + if (!_disposed) { return _deviceId.ToString(); } + + throw new ObjectDisposedException(); + } + } + } + + /// + /// Retrieves an object for the inter-integrated circuit (I2C) bus controller that has the specified plug and play device identifier, using the specified connection settings. + /// + /// The plug and play device identifier of the I2C bus controller for which you want to create an object. + /// The connection settings to use for communication with the I2C bus controller that deviceId specifies. + /// An operation that returns the I2cDevice object. + /// + /// This method is specific to nanoFramework. The equivalent method in the UWP API is: FromIdAsync. + /// + /// T + public static I2cDevice FromId(String i2cBus, I2cConnectionSettings settings) + { + return new I2cDevice(i2cBus, settings); + } + + /// + /// Retrieves an Advanced Query Syntax (AQS) string for the inter-integrated circuit (I2C) bus that has the specified friendly name. You can use this string with the DeviceInformation.FindAll + /// method to get a DeviceInformation object for that bus. + /// + /// A friendly name for the particular I2C bus on a particular hardware platform for which you want to get the AQS string. + /// An AQS string for the I2C bus that friendlyName specifies, which you can use with the DeviceInformation.FindAllAsync method to get a DeviceInformation object for that bus. + public static string GetDeviceSelector(String friendlyName) + { + return GetDeviceSelector(); + } + + /// + /// Retrieves an Advanced Query Syntax (AQS) string for all of the inter-integrated circuit (I2C) bus controllers on the system. You can use this string with the DeviceInformation.FindAll + /// method to get DeviceInformation objects for those bus controllers. + /// + /// An AQS string for all of the I2C bus controllers on the system, which you can use with the DeviceInformation.FindAllAsync method to get DeviceInformation + /// objects for those bus controllers. + public static string GetDeviceSelector() + { + return I2cController.GetDeviceSelector(); + } + + /// + /// Reads data from the inter-integrated circuit (I2C) bus on which the device is connected into the specified buffer. + /// + /// The buffer to which you want to read the data from the I2C bus. The length of the buffer determines how much data to request from the device. + public void Read(Byte[] buffer) + { + ReadPartial(buffer); + } + + /// + /// Reads data from the inter-integrated circuit (I2C) bus on which the device is connected into the specified buffer, and returns information about the success of the + /// operation that you can use for error handling. + /// + /// The buffer to which you want to read the data from the I2C bus. The length of the buffer determines how much data to request from the device. + /// A structure that contains information about the success of the read operation and the actual number of bytes that the operation read into the buffer. + public I2cTransferResult ReadPartial(Byte[] buffer) + { + lock (_syncLock) + { + // check if device has been disposed + if (_disposed) throw new ObjectDisposedException(); + + return NativeTransmit(null, buffer); + } + } + + /// + /// Writes data to the inter-integrated circuit (I2C) bus on which the device is connected, based on the bus address specified in the I2cConnectionSetting s object + /// that you used to create the I2cDevice object. + /// + /// A buffer that contains the data that you want to write to the I2C device. This data should not include the bus address. + public void Write(Byte[] buffer) + { + WritePartial(buffer); + } + + /// + /// Writes data to the inter-integrated circuit (I2C) bus on which the device is connected, and returns information about the success of the operation that you can use for error handling. + /// + /// A buffer that contains the data that you want to write to the I2C device. This data should not include the bus address. + /// A structure that contains information about the success of the write operation and the actual number of bytes that the operation wrote into the buffer. + public I2cTransferResult WritePartial(Byte[] buffer) + { + lock (_syncLock) + { + // check if device has been disposed + if (_disposed) throw new ObjectDisposedException(); + + return NativeTransmit(buffer, null); + } + } + + /// + /// Performs an atomic operation to write data to and then read data from the inter-integrated circuit (I2C) bus on which the device is connected, and sends a restart + /// condition between the write and read operations. + /// + /// A buffer that contains the data that you want to write to the I2C device. This data should not include the bus address. + /// The buffer to which you want to read the data from the I2C bus. The length of the buffer determines how much data to request from the device. + public void WriteRead(Byte[] writeBuffer, Byte[] readBuffer) + { + WriteReadPartial(writeBuffer, readBuffer); + } + + /// + /// Performs an atomic operation to write data to and then read data from the inter-integrated circuit (I2C) bus on which the device is connected, and returns information about the + /// success of the operation that you can use for error handling. + /// + /// A buffer that contains the data that you want to write to the I2C device. This data should not include the bus address. + /// The buffer to which you want to read the data from the I2C bus. The length of the buffer determines how much data to request from the device. + /// A structure that contains information about whether both the read and write parts of the operation succeeded and the sum of the actual number of bytes that the + /// operation wrote and the actual number of bytes that the operation read. + public I2cTransferResult WriteReadPartial(Byte[] writeBuffer, Byte[] readBuffer) + { + lock (_syncLock) + { + // check if device has been disposed + if (_disposed) throw new ObjectDisposedException(); + + return NativeTransmit(writeBuffer, readBuffer); + } + } + + #region IDisposable Support + + private void Dispose(bool disposing) + { + if (!_disposed) + { + bool disposeController = false; + + if (disposing) + { + // get the controller + var controller = I2cController.FindController(_deviceId / deviceUniqueIdMultiplier); + + if (controller != null) + { + // find device + var device = FindDevice(controller, _deviceId); + + if (device != null) + { + // remove from device collection + controller.DeviceCollection.Remove(device); + + // it's OK to also remove the controller, if there is no other device associated + if (controller.DeviceCollection.Count == 0) + { + I2cControllerManager.ControllersCollection.Remove(controller); + + // flag this to native dispose + disposeController = true; + } + } + } + } + + NativeDispose(disposeController); + + _disposed = true; + } + } + + #pragma warning disable 1591 + ~I2cDevice() + { + Dispose(false); + } + + public void Dispose() + { + lock (_syncLock) + { + if (!_disposed) + { + Dispose(true); + + GC.SuppressFinalize(this); + } + } + } + + #endregion + + internal static I2cDevice FindDevice(I2cController controller, int index) + { + for (int i = 0; i < controller.DeviceCollection.Count; i++) + { + if (((I2cDevice)controller.DeviceCollection[i])._deviceId == index) + { + return (I2cDevice)controller.DeviceCollection[i]; + } + } + + return null; + } + + #region external calls to native implementations + + [MethodImpl(MethodImplOptions.InternalCall)] + private extern void NativeInit(); + + [MethodImpl(MethodImplOptions.InternalCall)] + private extern void NativeDispose(bool disposeController); + + [MethodImpl(MethodImplOptions.InternalCall)] + private extern I2cTransferResult NativeTransmit(byte[] writeBuffer, byte[] readBuffer); + + #endregion + } + + /// + /// Exception thrown when a check in driver's constructor finds a device that already exists with the same settings (I2C bus AND slave address) + /// + [Serializable] + public class I2cDeviceAlreadyInUseException : Exception + { + /// + /// Returns a that represents this instance. + /// + /// + /// A that represents this instance. + /// + public override string ToString() { return base.Message; } + } +} diff --git a/Windows.Devices.I2c/I2cSharingMode.cs b/Windows.Devices.I2c/I2cSharingMode.cs new file mode 100644 index 0000000..b95c2dc --- /dev/null +++ b/Windows.Devices.I2c/I2cSharingMode.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) .NET Foundation and Contributors +// See LICENSE file in the project root for full license information. +// + +namespace Windows.Devices.I2c +{ + /// + /// Describes the modes in which you can connect to an inter-integrated circuit (I2C) bus address. + /// These modes determine whether other connections to the I2C bus address can be opened while you are connected to the I2C bus address. + /// + public enum I2cSharingMode + { + /// + /// Connects to the I2C bus address exclusively, so that no other connection to the I2C bus address can be made while you remain connected. This mode is the default mode. + /// + Exclusive, + /// + /// Connects to the I2C bus address in shared mode, so that other connections to the I2C bus address can be made while you remain connected. + /// You can perform all operations on shared connections, but use such connections with care. When multiple client apps change the global state of the I2C device, + /// race conditions can result. + /// An example use case for using a shared connection is a sensor that obtains readings without changing the state of the device. + /// + Shared + } +} diff --git a/Windows.Devices.I2c/I2cTransferResult.cs b/Windows.Devices.I2c/I2cTransferResult.cs new file mode 100644 index 0000000..ef44b83 --- /dev/null +++ b/Windows.Devices.I2c/I2cTransferResult.cs @@ -0,0 +1,31 @@ +// +// Copyright (c) .NET Foundation and Contributors +// See LICENSE file in the project root for full license information. +// + +namespace Windows.Devices.I2c +{ + /// + /// Provides information about whether the data transfers that the ReadPartial, WritePartial, or WriteReadPartial method performed succeeded, and the actual number + /// of bytes the method transferred. + /// + public struct I2cTransferResult + { + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + private uint _bytesTransferred; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + private I2cTransferStatus _status; + + /// + /// The actual number of bytes that the operation actually transferred. The following table describes what this value represents for each method. + /// + public uint BytesTransferred { get => _bytesTransferred; set => _bytesTransferred = value; } + + /// + /// An enumeration value that indicates if the read or write operation transferred the full number of bytes that the method requested, or the reason + /// that the full transfer did not succeed. For WriteReadPartial, the value indicates whether the data for both the write and the read operations was entirely transferred. + /// + public I2cTransferStatus Status { get => _status; set => _status = value; } + } +} diff --git a/Windows.Devices.I2c/I2cTransferStatus.cs b/Windows.Devices.I2c/I2cTransferStatus.cs new file mode 100644 index 0000000..b95aaa9 --- /dev/null +++ b/Windows.Devices.I2c/I2cTransferStatus.cs @@ -0,0 +1,38 @@ +// +// Copyright (c) .NET Foundation and Contributors +// See LICENSE file in the project root for full license information. +// + +namespace Windows.Devices.I2c +{ + /// + /// Describes whether the data transfers that the ReadPartial, WritePartial, or WriteReadPartial method performed succeeded, or provides the reason that the transfers did not succeed. + /// + public enum I2cTransferStatus + { + /// + /// The data was entirely transferred. For WriteReadPartial, the data for both the write and the read operations was entirely transferred. + /// For this status code, the value of the I2cTransferResult.BytesTransferred member that the method returns is the same as the size of the buffer + /// you specified when you called the method, or is equal to the sum of the sizes of two buffers that you specified for WriteReadPartial. + /// + FullTransfer = 0, + /// + /// The transfer failed due to the clock being stretched for too long. Ensure the clock line is not being held low. + /// + ClockStretchTimeout, + /// + /// The I2C device negatively acknowledged the data transfer before all of the data was transferred. + /// For this status code, the value of the I2cTransferResult.BytesTransferred member that the method returns is the number of bytes actually transferred. + /// For WriteReadPartial, the value is the sum of the number of bytes that the operation wrote and the number of bytes that the operation read. + /// + PartialTransfer, + /// + /// The bus address was not acknowledged. For this status code, the value of the I2cTransferResult.BytesTransferred member that the method returns of the method is 0. + /// + SlaveAddressNotAcknowledged, + /// + /// The transfer failed for an unknown reason. + /// + UnknownError + } +} diff --git a/Windows.Devices.I2c/II2cDeviceStatics.cs b/Windows.Devices.I2c/II2cDeviceStatics.cs new file mode 100644 index 0000000..848e95a --- /dev/null +++ b/Windows.Devices.I2c/II2cDeviceStatics.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) .NET Foundation and Contributors +// See LICENSE file in the project root for full license information. +// + +using System; + +namespace Windows.Devices.I2c +{ + /// + /// Provides ways to open a communications channel to a device on an inter-integrated circuit (I2C) bus. + /// + public interface II2cDeviceStatics + { + /// + /// Retrieves an I2cDevice object asynchronously for the inter-integrated circuit (I2C) bus controller that has the specified plug and play device identifier, + /// using the specified connection settings. + /// + /// The plug and play device identifier of the I2C bus controller for which you want to create an I2cDevice object. + /// The connection settings to use for communication with the I2C bus controller that deviceId specifies. + /// An operation that returns the I2cDevice object. + I2cDevice FromId(String deviceId, I2cConnectionSettings settings); + + /// + /// Retrieves an Advanced Query Syntax (AQS) string for all of the inter-integrated circuit (I2C) bus controllers on the system. You can use this string with the + /// DeviceInformation.FindAllAsync method to get DeviceInformation objects for those bus controllers. + /// + /// An AQS string for all of the I2C bus controllers on the system, which you can use with the DeviceInformation.FindAll method to get DeviceInformation + /// objects for those bus controllers. + string GetDeviceSelector(); + + /// + /// Retrieves an Advanced Query Syntax (AQS) string for the inter-integrated circuit (I2C) bus that has the specified friendly name. You can use this string with the + /// DeviceInformation.FindAll method to get a DeviceInformation object for that bus. + /// + /// A friendly name for the particular I2C bus on a particular hardware platform for which you want to get the AQS string. + /// An AQS string for the I2C bus that friendlyName specifies, which you can use with the DeviceInformation.FindAll method to get a DeviceInformation object for that bus. + string GetDeviceSelector(String friendlyName); + } +} diff --git a/Windows.Devices.I2c/Properties/AssemblyInfo.cs b/Windows.Devices.I2c/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3175068 --- /dev/null +++ b/Windows.Devices.I2c/Properties/AssemblyInfo.cs @@ -0,0 +1,25 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.BlankApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("nanoFramework Contributors")] +[assembly: AssemblyProduct("nanoFramework System.Device.I2c")] +[assembly: AssemblyCopyright("Copyright (c) .NET Foundation and Contributors")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +//////////////////////////////////////////////////////////////// +// update this whenever the native assembly signature changes // +[assembly: AssemblyNativeVersion("100.1.0.0")] +//////////////////////////////////////////////////////////////// + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] diff --git a/Windows.Devices.I2c/Windows.Devices.I2c.nfproj b/Windows.Devices.I2c/Windows.Devices.I2c.nfproj new file mode 100644 index 0000000..ac87e13 --- /dev/null +++ b/Windows.Devices.I2c/Windows.Devices.I2c.nfproj @@ -0,0 +1,81 @@ + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + d74a7890-8a23-417b-ab74-923d57e987ea + Library + 512 + + + Windows.Devices.I2c + v1.0 + True + bin\$(Configuration)\Windows.Devices.I2c.xml + + + true + + + key.snk + + + false + + + + bin\$(Configuration)\Stubs + win_dev_i2c_native + + + + false + + + + + false + + + + + + + + + + + + + + + + + + + + + + ..\packages\nanoFramework.CoreLibrary.1.9.0-preview.5\lib\mscorlib.dll + True + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. + + + + diff --git a/Windows.Devices.I2c/key.snk b/Windows.Devices.I2c/key.snk new file mode 100644 index 0000000000000000000000000000000000000000..67c9bb0ad77fd9cfb31a5fe1f8e4f6537f8883f8 GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50096IAgVrqn?0oVUK<}}z@wqRV>QE=V9G(P zv&4>n;N)r`28$iZ}__~(k83t)%SuJd!((DT{8XK)X~rK64E`*F3l z_5^K&AM;wi;^44^3SyC?622Htvk|)gU+)k0iCdaqB2%u@FR*KYku>(Zol_KusD7d= zA40qu=-~L94PXsGJ#eO@FlCr&O~0PO!6o-*GQq`zy7)g4B)IFgLhI0vfH=+L6i;`a zn(iWy{`8{{oj}vGf9S9M=48~NC!$coEAg@m^H3NXd_JrnT}HOd0AR%m^g zLg4+2jC7g-iYgo9N=!v@nv=I99O}eXu|AyULz5*Z*LDuQt4pP~UX|Zf`1Y#v4}kU8;^ac8l5!?oeMbz%wA_dHw*Ud81*FK}w1r zw3t~`4#bY+anQY5XU!i9#lc>IiLAxX~!c5@{0(|Buf%3XVh2FE%G?X~1 z7e5uWO?|rx0b=vcr3gpq3{-d$I8fk&Qrx<8j#tO3HOsxjGMJn4IT0*|11Oqu{gBd3 z&+6?KA|)R~alAn@8a!Y9Eq$TwFM@mu$U=dJ?PzCQY8jWLBlv^YEFIb8Fvhr*vMTOc zG+a5pRFEs9BT_>6MCF{WdN&DTsp^F!N=e1<>cRNkafH_Fr3`v9f%5G2(}LQ$j`vCM iwz?1qR;-^j3D_^H<{zl%^r6ivhR`zlIvhi1+jkY8izavg literal 0 HcmV?d00001 diff --git a/Windows.Devices.I2c/packages.config b/Windows.Devices.I2c/packages.config new file mode 100644 index 0000000..825f4c7 --- /dev/null +++ b/Windows.Devices.I2c/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..f7e9eef --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,44 @@ +trigger: + branches: + include: [master, develop, "release-*" ] + paths: + exclude: ["*.md", .gitignore] + tags: + include: ["v*"] + +# PR always trigger build + +# add nf-tools repo to resources (for Azure Pipelines templates) +resources: + repositories: + - repository: templates + type: github + name: nanoframework/nf-tools + endpoint: nanoframework + +pool: + vmImage: 'VS2017-Win2016' + +variables: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + solution: '**/*.sln' + buildPlatform: 'Any CPU' + buildConfiguration: 'Release' + nugetPackageName: 'nanoFramework.System.Device.I2c' + repoName: 'lib-System.Device.I2c' + +steps: + +# step from template @ nf-tools repo +# all build, update and publish steps +- template: azure-pipelines-templates/class-lib-build.yml@templates + parameters: + sonarCloudProject: 'nanoframework_lib-System.Device.I2c' + +# step from template @ nf-tools repo +# report error +- template: azure-pipelines-templates/discord-webhook-task.yml@templates + parameters: + status: 'failure' + webhookUrl: '$(DiscordWebhook)' + message: '' diff --git a/nanoFramework.Windows.Devices.I2c.DELIVERABLES.nuspec b/nanoFramework.Windows.Devices.I2c.DELIVERABLES.nuspec new file mode 100644 index 0000000..c48662f --- /dev/null +++ b/nanoFramework.Windows.Devices.I2c.DELIVERABLES.nuspec @@ -0,0 +1,32 @@ + + + + nanoFramework.Windows.Devices.I2c.DELIVERABLES + $version$ + nanoFramework.Windows.Devices.I2c.DELIVERABLES + nanoFramework project contributors + nanoFramework project contributors + false + + + false + https://github.com/nanoframework/lib-Windows.Devices.I2c + https://secure.gravatar.com/avatar/97d0e092247f0716db6d4b47b7d1d1ad + Copyright (c) .NET Foundation and Contributors + ** DON'T REFERENCE THIS PACKAGE ** Not meant for development. This package includes the deliverable artifacts of the Windows.Devices.I2c assembly for nanoFramework. These are for testing purposes and for updating the native code base of the library. + Windows.Devices.I2c.DELIVERABLES is not meant for development. + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nanoFramework.Windows.Devices.I2c.nuspec b/nanoFramework.Windows.Devices.I2c.nuspec new file mode 100644 index 0000000..773a505 --- /dev/null +++ b/nanoFramework.Windows.Devices.I2c.nuspec @@ -0,0 +1,35 @@ + + + + nanoFramework.Windows.Devices.I2c + $version$ + nanoFramework.Windows.Devices.I2c + nanoFramework project contributors + nanoFramework project contributors + false + MIT + + + false + https://github.com/nanoframework/lib-Windows.Devices.I2c + https://secure.gravatar.com/avatar/97d0e092247f0716db6d4b47b7d1d1ad + + Copyright (c) .NET Foundation and Contributors + This package includes the Windows.Devices.I2c assembly for nanoFramework C# projects. +This package requires a target with Windows.Devices.I2c v$nativeVersion$ (checksum $checksum$). + Windows.Devices.I2c assembly for .NET nanoFramework C# projects + nanoFramework C# csharp netmf netnf Windows.Devices.I2c + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nanoFramework.Windows.Devices.I2c.sln b/nanoFramework.Windows.Devices.I2c.sln new file mode 100644 index 0000000..d3e1691 --- /dev/null +++ b/nanoFramework.Windows.Devices.I2c.sln @@ -0,0 +1,33 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2010 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "Windows.Devices.I2c", "Windows.Devices.I2c\Windows.Devices.I2c.nfproj", "{D74A7890-8A23-417B-AB74-923D57E987EA}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0660B91C-D1F7-4940-8BD4-688D84E666D2}" + ProjectSection(SolutionItems) = preProject + nanoFramework.Windows.Devices.I2c.DELIVERABLES.nuspec = nanoFramework.Windows.Devices.I2c.DELIVERABLES.nuspec + nanoFramework.Windows.Devices.I2c.nuspec = nanoFramework.Windows.Devices.I2c.nuspec + NuGet.Config = NuGet.Config + version.json = version.json + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D74A7890-8A23-417B-AB74-923D57E987EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D74A7890-8A23-417B-AB74-923D57E987EA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D74A7890-8A23-417B-AB74-923D57E987EA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D74A7890-8A23-417B-AB74-923D57E987EA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C8231C9F-4CB4-4EA4-9760-0BB50E83EEC4} + EndGlobalSection +EndGlobal diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..58d52be --- /dev/null +++ b/readme.txt @@ -0,0 +1,21 @@ + _____ _ + _ __ __ _ _ __ ___ | ___| __ __ _ _ __ ___ _____ _____ _ __| | __ + | '_ \ / _` | '_ \ / _ \| |_ | '__/ _` | '_ ` _ \ / _ \ \ /\ / / _ \| '__| |/ / + | | | | (_| | | | | (_) | _|| | | (_| | | | | | | __/\ V V / (_) | | | < + |_| |_|\__,_|_| |_|\___/|_| |_| \__,_|_| |_| |_|\___| \_/\_/ \___/|_| |_|\_\ + +=================================================================================== + +API docs: https://docs.nanoframework.net/api/Windows.Devices.I2c.html + +Browse our samples repository: https://github.com/nanoframework/samples + +Check our documentation online: https://docs.nanoframework.net/ + +Join our lively Discord community: https://discord.gg/gCyBu8T + +Report issues: https://github.com/nanoframework/Home/issues + +Follow us on Twitter: https://twitter.com/nanoframework + +Follow our YouTube channel: https://www.youtube.com/c/nanoFramework diff --git a/template.vssettings b/template.vssettings new file mode 100644 index 0000000..0485070 --- /dev/null +++ b/template.vssettings @@ -0,0 +1,74 @@ + + + + + + + 4 + false + 4 + true + + + 1 + 0 + 1 + 1 + 1 + 1 + 1 + 2 + 1 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 1 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 1 + 0 + 0 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 1 + 0 + 1 + 1 + 0 + 0 + 0 + 1 + 1 + 1 + 1 + + + + diff --git a/version.json b/version.json new file mode 100644 index 0000000..6c5cf89 --- /dev/null +++ b/version.json @@ -0,0 +1,24 @@ +{ + "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", + "version": "1.0.0-preview.{height}", + "assemblyVersion": { + "precision": "revision" + }, + "semVer1NumericIdentifierPadding": 3, + "nuGetPackageVersion": { + "semVer": 2.0 + }, + "publicReleaseRefSpec": [ + "^refs/heads/master$", + "^refs/heads/v\\d+(?:\\.\\d+)?$" + ], + "cloudBuild": { + "setAllVariables": true, + "buildNumber": null + }, + "release": { + "branchName": "release-v{version}", + "versionIncrement": "build", + "firstUnstableTag": "preview" + } +} \ No newline at end of file From aad662186a8cd28fe58412375b40b488c94e9360 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Thu, 1 Oct 2020 14:09:45 +0200 Subject: [PATCH 02/51] Initial project setup, empty class, naming --- README.md | 8 +- .../System.Device.I2c.nfproj | 12 - .../key.snk | Bin .../packages.config | 0 Windows.Devices.I2c/I2cBusSpeed.cs | 23 -- Windows.Devices.I2c/I2cConnectionSettings.cs | 93 ----- Windows.Devices.I2c/I2cController.cs | 157 -------- Windows.Devices.I2c/I2cControllerManager.cs | 53 --- Windows.Devices.I2c/I2cDevice.cs | 348 ------------------ Windows.Devices.I2c/I2cSharingMode.cs | 26 -- Windows.Devices.I2c/I2cTransferResult.cs | 31 -- Windows.Devices.I2c/I2cTransferStatus.cs | 38 -- Windows.Devices.I2c/II2cDeviceStatics.cs | 40 -- .../Properties/AssemblyInfo.cs | 25 -- ...work.System.Device.I2c.DELIVERABLES.nuspec | 32 ++ nanoFramework.System.Device.I2c.nuspec | 35 ++ ...sln => nanoFramework.System.Device.I2c.sln | 6 +- ...rk.Windows.Devices.I2c.DELIVERABLES.nuspec | 32 -- nanoFramework.Windows.Devices.I2c.nuspec | 35 -- readme.txt | 2 +- 20 files changed, 75 insertions(+), 921 deletions(-) rename Windows.Devices.I2c/Windows.Devices.I2c.nfproj => System.Device.I2c/System.Device.I2c.nfproj (88%) rename {Windows.Devices.I2c => System.Device.I2c}/key.snk (100%) rename {Windows.Devices.I2c => System.Device.I2c}/packages.config (100%) delete mode 100644 Windows.Devices.I2c/I2cBusSpeed.cs delete mode 100644 Windows.Devices.I2c/I2cConnectionSettings.cs delete mode 100644 Windows.Devices.I2c/I2cController.cs delete mode 100644 Windows.Devices.I2c/I2cControllerManager.cs delete mode 100644 Windows.Devices.I2c/I2cDevice.cs delete mode 100644 Windows.Devices.I2c/I2cSharingMode.cs delete mode 100644 Windows.Devices.I2c/I2cTransferResult.cs delete mode 100644 Windows.Devices.I2c/I2cTransferStatus.cs delete mode 100644 Windows.Devices.I2c/II2cDeviceStatics.cs delete mode 100644 Windows.Devices.I2c/Properties/AssemblyInfo.cs create mode 100644 nanoFramework.System.Device.I2c.DELIVERABLES.nuspec create mode 100644 nanoFramework.System.Device.I2c.nuspec rename nanoFramework.Windows.Devices.I2c.sln => nanoFramework.System.Device.I2c.sln (77%) delete mode 100644 nanoFramework.Windows.Devices.I2c.DELIVERABLES.nuspec delete mode 100644 nanoFramework.Windows.Devices.I2c.nuspec diff --git a/README.md b/README.md index 45d0dad..db47323 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-Windows.Devices.I2c&metric=alert_status)](https://sonarcloud.io/dashboard?id=nanoframework_lib-Windows.Devices.I2c) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-Windows.Devices.I2c&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=nanoframework_lib-Windows.Devices.I2c) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![NuGet](https://img.shields.io/nuget/dt/nanoFramework.Windows.Devices.I2c.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.Windows.Devices.I2c/) [![#yourfirstpr](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://github.com/nanoframework/Home/blob/master/CONTRIBUTING.md) [![Discord](https://img.shields.io/discord/478725473862549535.svg?logo=discord&logoColor=white&label=Discord&color=7289DA)](https://discord.gg/gCyBu8T) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-System.Device.I2c&metric=alert_status)](https://sonarcloud.io/dashboard?id=nanoframework_lib-System.Device.I2c) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-System.Device.I2c&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=nanoframework_lib-System.Device.I2c) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![NuGet](https://img.shields.io/nuget/dt/nanoFramework.System.Device.I2c.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.System.Device.I2c/) [![#yourfirstpr](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://github.com/nanoframework/Home/blob/master/CONTRIBUTING.md) [![Discord](https://img.shields.io/discord/478725473862549535.svg?logo=discord&logoColor=white&label=Discord&color=7289DA)](https://discord.gg/gCyBu8T) ![nanoFramework logo](https://github.com/nanoframework/Home/blob/master/resources/logo/nanoFramework-repo-logo.png) ----- -### Welcome to the **nanoFramework** Windows.Devices.I2c Library repository! +### Welcome to the **nanoFramework** System.Device.I2c Library repository! ## Build status | Component | Build Status | NuGet Package | |:-|---|---| -| Windows.Devices.I2c | [![Build Status](https://dev.azure.com/nanoframework/Windows.Devices.I2c/_apis/build/status/nanoframework.lib-Windows.Devices.I2c?branchName=develop)](https://dev.azure.com/nanoframework/Windows.Devices.I2c/_build/latest?definitionId=28?branchName=master) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.Windows.Devices.I2c.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.Windows.Devices.I2c/) | -| Windows.Devices.I2c (preview) | [![Build Status](https://dev.azure.com/nanoframework/Windows.Devices.I2c/_apis/build/status/nanoframework.lib-Windows.Devices.I2c?branchName=develop)](https://dev.azure.com/nanoframework/Windows.Devices.I2c/_build/latest?definitionId=28?branchName=develop) | [![](https://badgen.net/badge/NuGet/preview/D7B023?icon=https://simpleicons.now.sh/azuredevops/fff)](https://dev.azure.com/nanoframework/feed/_packaging?_a=package&feed=sandbox&package=nanoFramework.Windows.Devices.I2c&protocolType=NuGet&view=overview) | +| System.Device.I2c | [![Build Status](https://dev.azure.com/nanoframework/System.Device.I2c/_apis/build/status/nanoframework.lib-System.Device.I2c?branchName=develop)](https://dev.azure.com/nanoframework/System.Device.I2c/_build/latest?definitionId=28?branchName=master) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.System.Device.I2c.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.System.Device.I2c/) | +| System.Device.I2c (preview) | [![Build Status](https://dev.azure.com/nanoframework/System.Device.I2c/_apis/build/status/nanoframework.lib-System.Device.I2c?branchName=develop)](https://dev.azure.com/nanoframework/System.Device.I2c/_build/latest?definitionId=28?branchName=develop) | [![](https://badgen.net/badge/NuGet/preview/D7B023?icon=https://simpleicons.now.sh/azuredevops/fff)](https://dev.azure.com/nanoframework/feed/_packaging?_a=package&feed=sandbox&package=nanoFramework.System.Device.I2c&protocolType=NuGet&view=overview) | ## Feedback and documentation diff --git a/Windows.Devices.I2c/Windows.Devices.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj similarity index 88% rename from Windows.Devices.I2c/Windows.Devices.I2c.nfproj rename to System.Device.I2c/System.Device.I2c.nfproj index ac87e13..256d99b 100644 --- a/Windows.Devices.I2c/Windows.Devices.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -43,18 +43,6 @@ - - - - - - - - - - - - diff --git a/Windows.Devices.I2c/key.snk b/System.Device.I2c/key.snk similarity index 100% rename from Windows.Devices.I2c/key.snk rename to System.Device.I2c/key.snk diff --git a/Windows.Devices.I2c/packages.config b/System.Device.I2c/packages.config similarity index 100% rename from Windows.Devices.I2c/packages.config rename to System.Device.I2c/packages.config diff --git a/Windows.Devices.I2c/I2cBusSpeed.cs b/Windows.Devices.I2c/I2cBusSpeed.cs deleted file mode 100644 index d0b4466..0000000 --- a/Windows.Devices.I2c/I2cBusSpeed.cs +++ /dev/null @@ -1,23 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -namespace Windows.Devices.I2c -{ - /// - /// Describes the bus speeds that are available for connecting to an inter-integrated circuit (I2C) device. - /// The bus speed is the frequency at which to clock the I2C bus when accessing the device. - /// - public enum I2cBusSpeed - { - /// - /// The standard speed of 100 kilohertz (kHz). This speed is the default. - /// - StandardMode, - /// - /// A fast speed of 400 kHz. - /// - FastMode - } -} diff --git a/Windows.Devices.I2c/I2cConnectionSettings.cs b/Windows.Devices.I2c/I2cConnectionSettings.cs deleted file mode 100644 index 7f42001..0000000 --- a/Windows.Devices.I2c/I2cConnectionSettings.cs +++ /dev/null @@ -1,93 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -using System; - -namespace Windows.Devices.I2c -{ - /// - /// Represents the connection settings you want to use for an inter-integrated circuit (I2C) device. - /// - public sealed class I2cConnectionSettings - { - [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] - private Int32 _slaveAddress; - - [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] - private I2cBusSpeed _busSpeed; - - [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] - private I2cSharingMode _sharingMode; - - /// - /// Creates and initializes a new instance of the I2cConnectionSettings class for inter-integrated circuit (I2C) device with specified bus address, - /// using the default settings of the standard mode for the bus speed and exclusive sharing mode. - /// - /// The bus address of the inter-integrated circuit (I2C) device to which the settings of the I2cConnectionSettings should apply. - /// Only 7-bit addressing is supported, so the range of values that are valid is from 8 to 119 (that's 0x08 and 0x77). - public I2cConnectionSettings(Int32 slaveAddress) - { - SlaveAddress = slaveAddress; - } - - /// - /// Initializes a copy of a object. - /// - /// Object to copy from. - internal I2cConnectionSettings(I2cConnectionSettings settings) - { - _slaveAddress = settings.SlaveAddress; - _busSpeed = settings.BusSpeed; - _sharingMode = settings.SharingMode; - } - - /// - /// Gets or sets the bus speed to use for connecting to an inter-integrated circuit (I2C) device. The bus speed is the frequency at which to clock the I2C bus when accessing the device. - /// - /// - /// The bus speed to use for connecting to anI2C device. - /// - public I2cBusSpeed BusSpeed - { - get { return _busSpeed; } - set { _busSpeed = value; } - } - - /// - /// Gets or sets the sharing mode to use to connect to the inter-integrated circuit (I2C) bus address. This mode determines whether other connections to the I2C bus address can be opened - /// while you are connect to the I2C bus address. - /// - /// - /// The sharing mode to use to connect to the I2C bus address. - /// - public I2cSharingMode SharingMode - { - get { return _sharingMode; } - set { _sharingMode = value; } - } - - /// - /// Gets or sets the bus address of the inter-integrated circuit (I2C) device. - /// - /// - /// The bus address of the I2C device. Only 7-bit addressing is supported, so the range of values that are valid is from 8 to 119 (that's 0x08 and 0x77). - /// - public int SlaveAddress - { - get { return _slaveAddress; } - set - { - // better validate the address - // 0 is a valid address : General Call. Special usage but valid. - if (value != 0 && (value < 8 || value > 119)) - { - throw new ArgumentOutOfRangeException(); - } - - _slaveAddress = value; - } - } - } -} diff --git a/Windows.Devices.I2c/I2cController.cs b/Windows.Devices.I2c/I2cController.cs deleted file mode 100644 index a5024cc..0000000 --- a/Windows.Devices.I2c/I2cController.cs +++ /dev/null @@ -1,157 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -using System; -using System.Collections; -using System.Runtime.CompilerServices; - -namespace Windows.Devices.I2c -{ - /// - /// Represents the I2C controller for the system. - /// - public sealed class I2cController - { - // this is used as the lock object - // a lock is required because multiple threads can access the I2cController - [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] - private object _syncLock; - - [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] - internal readonly int _controllerId; - - // backing field for DeviceCollection - [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] - private ArrayList s_deviceCollection; - - /// - /// Device collection associated with this . - /// - /// - /// This collection is for internal use only. - /// - internal ArrayList DeviceCollection - { - get - { - if (s_deviceCollection == null) - { - if (_syncLock == null) - { - _syncLock = new object(); - } - - lock (_syncLock) - { - if (s_deviceCollection == null) - { - s_deviceCollection = new ArrayList(); - } - } - } - - return s_deviceCollection; - } - - set - { - s_deviceCollection = value; - } - } - - internal I2cController(string controller) - { - // the I2C id is an ASCII string with the format 'I2Cn' - // need to grab 'n' from the string and convert that to the integer value from the ASCII code (do this by subtracting 48 from the char value) - _controllerId = controller[3] - '0'; - - // check if this controller is already opened - if (FindController(_controllerId) == null) - { - _syncLock = new object(); - - // call native init to allow HAL/PAL inits related with I2C hardware - // this is also used to check if the requested ADC actually exists - NativeInit(); - - // add controller to collection, with the ID as key - // *** just the index number *** - I2cControllerManager.ControllersCollection.Add(this); - } - else - { - // this controller already exists: throw an exception - throw new ArgumentException(); - } - } - - /// - /// Gets the default I2C controller on the system. - /// - /// The default I2C controller on the system, or null if the system has no I2C controller. - public static I2cController GetDefault() - { - string controllersAqs = GetDeviceSelector(); - string[] controllers = controllersAqs.Split(','); - - if (controllers.Length > 0) - { - // the I2C id is an ASCII string with the format 'I2Cn' - // need to grab 'n' from the string and convert that to the integer value from the ASCII code (do this by subtracting 48 from the char value) - var controllerId = controllers[0][3] - '0'; - - var myController = FindController(controllerId); - - if (myController != null) - { - // controller is already open - return (I2cController)I2cControllerManager.ControllersCollection[controllerId]; - } - else - { - // this controller is not in the collection, create it - return new I2cController(controllers[0]); - } - } - - // the system has no I2C controller - return null; - } - - /// - /// Gets the I2C device with the specified settings. - /// - /// - /// The desired connection settings. - public I2cDevice GetDevice(I2cConnectionSettings settings) - { - //TODO: fix return value. Should return an existing device (if any) - return new I2cDevice(String.Empty, settings); - } - - internal static I2cController FindController(int index) - { - for (int i = 0; i < I2cControllerManager.ControllersCollection.Count; i++) - { - if (((I2cController)I2cControllerManager.ControllersCollection[i])._controllerId == index) - { - return (I2cController)I2cControllerManager.ControllersCollection[i]; - } - } - - return null; - } - - #region Native Calls - - [MethodImpl(MethodImplOptions.InternalCall)] - private extern void NativeInit(); - - [MethodImpl(MethodImplOptions.InternalCall)] - internal static extern string GetDeviceSelector(); - - #endregion - } -} diff --git a/Windows.Devices.I2c/I2cControllerManager.cs b/Windows.Devices.I2c/I2cControllerManager.cs deleted file mode 100644 index f6274cf..0000000 --- a/Windows.Devices.I2c/I2cControllerManager.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -using System.Collections; - -namespace Windows.Devices.I2c -{ - internal sealed class I2cControllerManager - { - private static object _syncLock; - - // backing field for ControllersCollection - // to store the controllers that are open - private static ArrayList s_controllersCollection; - - /// - /// collection. - /// - /// - /// This collection is for internal use only. - /// - internal static ArrayList ControllersCollection - { - get - { - if (s_controllersCollection == null) - { - if(_syncLock == null) - { - _syncLock = new object(); - } - - lock (_syncLock) - { - if (s_controllersCollection == null) - { - s_controllersCollection = new ArrayList(); - } - } - } - - return s_controllersCollection; - } - - set - { - s_controllersCollection = value; - } - } - } -} diff --git a/Windows.Devices.I2c/I2cDevice.cs b/Windows.Devices.I2c/I2cDevice.cs deleted file mode 100644 index 52a6c31..0000000 --- a/Windows.Devices.I2c/I2cDevice.cs +++ /dev/null @@ -1,348 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -using System; -using System.Runtime.CompilerServices; - -namespace Windows.Devices.I2c -{ - /// - /// Represents a communications channel to a device on an inter-integrated circuit (I2C) bus. - /// - public sealed class I2cDevice : IDisposable - { - // the device unique ID for the device is achieve by joining the I2C bus ID and the slave address - // should be unique enough by encoding it as: (I2C bus number x 1000 + slave address) - [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] - private const int deviceUniqueIdMultiplier = 1000; - - // this is used as the lock object - // a lock is required because multiple threads can access the device - [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] - private object _syncLock; - - [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] - private readonly int _deviceId; - - [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] - private readonly I2cConnectionSettings _connectionSettings; - - [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] - private bool _disposed; - - internal I2cDevice(string i2cBus, I2cConnectionSettings settings) - { - // generate a unique ID for the device by joining the I2C bus ID and the slave address, should be pretty unique - // the encoding is (I2C bus number x 1000 + slave address) - // i2cBus is an ASCII string with the bus name in format 'I2Cn' - // need to grab 'n' from the string and convert that to the integer value from the ASCII code (do this by subtracting 48 from the char value) - var controllerId = i2cBus[3] - 48; - var deviceId = (controllerId * deviceUniqueIdMultiplier) + settings.SlaveAddress; - - I2cController controller = I2cController.FindController(controllerId); - - if (controller == null) - { - // this controller doesn't exist yet, create it... - controller = new I2cController(i2cBus); - } - - // check if this device ID already exists - var device = FindDevice(controller, deviceId); - - if (device == null) - { - // device doesn't exist, create it... - _connectionSettings = new I2cConnectionSettings(settings.SlaveAddress) - { - BusSpeed = settings.BusSpeed, - SharingMode = settings.SharingMode - }; - - // save device ID - _deviceId = deviceId; - - // call native init to allow HAL/PAL inits related with I2C hardware - NativeInit(); - - // ... and add this device - controller.DeviceCollection.Add(this); - - _syncLock = new object(); - } - else - { - // this device already exists, throw an exception - throw new I2cDeviceAlreadyInUseException(); - } - } - - /// - /// Gets the connection settings used for communication with the inter-integrated circuit (I2C) device. - /// - /// - /// The connection settings used for communication with the inter-integrated circuit (I2C) device. - /// - public I2cConnectionSettings ConnectionSettings - { - get - { - lock (_syncLock) - { - // check if device has been disposed - if (!_disposed) - { - // need to return a copy so that the caller doesn't change the settings - return new I2cConnectionSettings(_connectionSettings); - } - - throw new ObjectDisposedException(); - } - } - } - - /// - /// Gets the plug and play device identifier of the inter-integrated circuit (I2C) bus controller for the device. - /// - /// - /// The plug and play device identifier of the inter-integrated circuit (I2C) bus controller for the device. - /// - public string DeviceId - { - get - { - lock (_syncLock) - { - // check if device has been disposed - if (!_disposed) { return _deviceId.ToString(); } - - throw new ObjectDisposedException(); - } - } - } - - /// - /// Retrieves an object for the inter-integrated circuit (I2C) bus controller that has the specified plug and play device identifier, using the specified connection settings. - /// - /// The plug and play device identifier of the I2C bus controller for which you want to create an object. - /// The connection settings to use for communication with the I2C bus controller that deviceId specifies. - /// An operation that returns the I2cDevice object. - /// - /// This method is specific to nanoFramework. The equivalent method in the UWP API is: FromIdAsync. - /// - /// T - public static I2cDevice FromId(String i2cBus, I2cConnectionSettings settings) - { - return new I2cDevice(i2cBus, settings); - } - - /// - /// Retrieves an Advanced Query Syntax (AQS) string for the inter-integrated circuit (I2C) bus that has the specified friendly name. You can use this string with the DeviceInformation.FindAll - /// method to get a DeviceInformation object for that bus. - /// - /// A friendly name for the particular I2C bus on a particular hardware platform for which you want to get the AQS string. - /// An AQS string for the I2C bus that friendlyName specifies, which you can use with the DeviceInformation.FindAllAsync method to get a DeviceInformation object for that bus. - public static string GetDeviceSelector(String friendlyName) - { - return GetDeviceSelector(); - } - - /// - /// Retrieves an Advanced Query Syntax (AQS) string for all of the inter-integrated circuit (I2C) bus controllers on the system. You can use this string with the DeviceInformation.FindAll - /// method to get DeviceInformation objects for those bus controllers. - /// - /// An AQS string for all of the I2C bus controllers on the system, which you can use with the DeviceInformation.FindAllAsync method to get DeviceInformation - /// objects for those bus controllers. - public static string GetDeviceSelector() - { - return I2cController.GetDeviceSelector(); - } - - /// - /// Reads data from the inter-integrated circuit (I2C) bus on which the device is connected into the specified buffer. - /// - /// The buffer to which you want to read the data from the I2C bus. The length of the buffer determines how much data to request from the device. - public void Read(Byte[] buffer) - { - ReadPartial(buffer); - } - - /// - /// Reads data from the inter-integrated circuit (I2C) bus on which the device is connected into the specified buffer, and returns information about the success of the - /// operation that you can use for error handling. - /// - /// The buffer to which you want to read the data from the I2C bus. The length of the buffer determines how much data to request from the device. - /// A structure that contains information about the success of the read operation and the actual number of bytes that the operation read into the buffer. - public I2cTransferResult ReadPartial(Byte[] buffer) - { - lock (_syncLock) - { - // check if device has been disposed - if (_disposed) throw new ObjectDisposedException(); - - return NativeTransmit(null, buffer); - } - } - - /// - /// Writes data to the inter-integrated circuit (I2C) bus on which the device is connected, based on the bus address specified in the I2cConnectionSetting s object - /// that you used to create the I2cDevice object. - /// - /// A buffer that contains the data that you want to write to the I2C device. This data should not include the bus address. - public void Write(Byte[] buffer) - { - WritePartial(buffer); - } - - /// - /// Writes data to the inter-integrated circuit (I2C) bus on which the device is connected, and returns information about the success of the operation that you can use for error handling. - /// - /// A buffer that contains the data that you want to write to the I2C device. This data should not include the bus address. - /// A structure that contains information about the success of the write operation and the actual number of bytes that the operation wrote into the buffer. - public I2cTransferResult WritePartial(Byte[] buffer) - { - lock (_syncLock) - { - // check if device has been disposed - if (_disposed) throw new ObjectDisposedException(); - - return NativeTransmit(buffer, null); - } - } - - /// - /// Performs an atomic operation to write data to and then read data from the inter-integrated circuit (I2C) bus on which the device is connected, and sends a restart - /// condition between the write and read operations. - /// - /// A buffer that contains the data that you want to write to the I2C device. This data should not include the bus address. - /// The buffer to which you want to read the data from the I2C bus. The length of the buffer determines how much data to request from the device. - public void WriteRead(Byte[] writeBuffer, Byte[] readBuffer) - { - WriteReadPartial(writeBuffer, readBuffer); - } - - /// - /// Performs an atomic operation to write data to and then read data from the inter-integrated circuit (I2C) bus on which the device is connected, and returns information about the - /// success of the operation that you can use for error handling. - /// - /// A buffer that contains the data that you want to write to the I2C device. This data should not include the bus address. - /// The buffer to which you want to read the data from the I2C bus. The length of the buffer determines how much data to request from the device. - /// A structure that contains information about whether both the read and write parts of the operation succeeded and the sum of the actual number of bytes that the - /// operation wrote and the actual number of bytes that the operation read. - public I2cTransferResult WriteReadPartial(Byte[] writeBuffer, Byte[] readBuffer) - { - lock (_syncLock) - { - // check if device has been disposed - if (_disposed) throw new ObjectDisposedException(); - - return NativeTransmit(writeBuffer, readBuffer); - } - } - - #region IDisposable Support - - private void Dispose(bool disposing) - { - if (!_disposed) - { - bool disposeController = false; - - if (disposing) - { - // get the controller - var controller = I2cController.FindController(_deviceId / deviceUniqueIdMultiplier); - - if (controller != null) - { - // find device - var device = FindDevice(controller, _deviceId); - - if (device != null) - { - // remove from device collection - controller.DeviceCollection.Remove(device); - - // it's OK to also remove the controller, if there is no other device associated - if (controller.DeviceCollection.Count == 0) - { - I2cControllerManager.ControllersCollection.Remove(controller); - - // flag this to native dispose - disposeController = true; - } - } - } - } - - NativeDispose(disposeController); - - _disposed = true; - } - } - - #pragma warning disable 1591 - ~I2cDevice() - { - Dispose(false); - } - - public void Dispose() - { - lock (_syncLock) - { - if (!_disposed) - { - Dispose(true); - - GC.SuppressFinalize(this); - } - } - } - - #endregion - - internal static I2cDevice FindDevice(I2cController controller, int index) - { - for (int i = 0; i < controller.DeviceCollection.Count; i++) - { - if (((I2cDevice)controller.DeviceCollection[i])._deviceId == index) - { - return (I2cDevice)controller.DeviceCollection[i]; - } - } - - return null; - } - - #region external calls to native implementations - - [MethodImpl(MethodImplOptions.InternalCall)] - private extern void NativeInit(); - - [MethodImpl(MethodImplOptions.InternalCall)] - private extern void NativeDispose(bool disposeController); - - [MethodImpl(MethodImplOptions.InternalCall)] - private extern I2cTransferResult NativeTransmit(byte[] writeBuffer, byte[] readBuffer); - - #endregion - } - - /// - /// Exception thrown when a check in driver's constructor finds a device that already exists with the same settings (I2C bus AND slave address) - /// - [Serializable] - public class I2cDeviceAlreadyInUseException : Exception - { - /// - /// Returns a that represents this instance. - /// - /// - /// A that represents this instance. - /// - public override string ToString() { return base.Message; } - } -} diff --git a/Windows.Devices.I2c/I2cSharingMode.cs b/Windows.Devices.I2c/I2cSharingMode.cs deleted file mode 100644 index b95c2dc..0000000 --- a/Windows.Devices.I2c/I2cSharingMode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -namespace Windows.Devices.I2c -{ - /// - /// Describes the modes in which you can connect to an inter-integrated circuit (I2C) bus address. - /// These modes determine whether other connections to the I2C bus address can be opened while you are connected to the I2C bus address. - /// - public enum I2cSharingMode - { - /// - /// Connects to the I2C bus address exclusively, so that no other connection to the I2C bus address can be made while you remain connected. This mode is the default mode. - /// - Exclusive, - /// - /// Connects to the I2C bus address in shared mode, so that other connections to the I2C bus address can be made while you remain connected. - /// You can perform all operations on shared connections, but use such connections with care. When multiple client apps change the global state of the I2C device, - /// race conditions can result. - /// An example use case for using a shared connection is a sensor that obtains readings without changing the state of the device. - /// - Shared - } -} diff --git a/Windows.Devices.I2c/I2cTransferResult.cs b/Windows.Devices.I2c/I2cTransferResult.cs deleted file mode 100644 index ef44b83..0000000 --- a/Windows.Devices.I2c/I2cTransferResult.cs +++ /dev/null @@ -1,31 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -namespace Windows.Devices.I2c -{ - /// - /// Provides information about whether the data transfers that the ReadPartial, WritePartial, or WriteReadPartial method performed succeeded, and the actual number - /// of bytes the method transferred. - /// - public struct I2cTransferResult - { - [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] - private uint _bytesTransferred; - - [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] - private I2cTransferStatus _status; - - /// - /// The actual number of bytes that the operation actually transferred. The following table describes what this value represents for each method. - /// - public uint BytesTransferred { get => _bytesTransferred; set => _bytesTransferred = value; } - - /// - /// An enumeration value that indicates if the read or write operation transferred the full number of bytes that the method requested, or the reason - /// that the full transfer did not succeed. For WriteReadPartial, the value indicates whether the data for both the write and the read operations was entirely transferred. - /// - public I2cTransferStatus Status { get => _status; set => _status = value; } - } -} diff --git a/Windows.Devices.I2c/I2cTransferStatus.cs b/Windows.Devices.I2c/I2cTransferStatus.cs deleted file mode 100644 index b95aaa9..0000000 --- a/Windows.Devices.I2c/I2cTransferStatus.cs +++ /dev/null @@ -1,38 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -namespace Windows.Devices.I2c -{ - /// - /// Describes whether the data transfers that the ReadPartial, WritePartial, or WriteReadPartial method performed succeeded, or provides the reason that the transfers did not succeed. - /// - public enum I2cTransferStatus - { - /// - /// The data was entirely transferred. For WriteReadPartial, the data for both the write and the read operations was entirely transferred. - /// For this status code, the value of the I2cTransferResult.BytesTransferred member that the method returns is the same as the size of the buffer - /// you specified when you called the method, or is equal to the sum of the sizes of two buffers that you specified for WriteReadPartial. - /// - FullTransfer = 0, - /// - /// The transfer failed due to the clock being stretched for too long. Ensure the clock line is not being held low. - /// - ClockStretchTimeout, - /// - /// The I2C device negatively acknowledged the data transfer before all of the data was transferred. - /// For this status code, the value of the I2cTransferResult.BytesTransferred member that the method returns is the number of bytes actually transferred. - /// For WriteReadPartial, the value is the sum of the number of bytes that the operation wrote and the number of bytes that the operation read. - /// - PartialTransfer, - /// - /// The bus address was not acknowledged. For this status code, the value of the I2cTransferResult.BytesTransferred member that the method returns of the method is 0. - /// - SlaveAddressNotAcknowledged, - /// - /// The transfer failed for an unknown reason. - /// - UnknownError - } -} diff --git a/Windows.Devices.I2c/II2cDeviceStatics.cs b/Windows.Devices.I2c/II2cDeviceStatics.cs deleted file mode 100644 index 848e95a..0000000 --- a/Windows.Devices.I2c/II2cDeviceStatics.cs +++ /dev/null @@ -1,40 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -using System; - -namespace Windows.Devices.I2c -{ - /// - /// Provides ways to open a communications channel to a device on an inter-integrated circuit (I2C) bus. - /// - public interface II2cDeviceStatics - { - /// - /// Retrieves an I2cDevice object asynchronously for the inter-integrated circuit (I2C) bus controller that has the specified plug and play device identifier, - /// using the specified connection settings. - /// - /// The plug and play device identifier of the I2C bus controller for which you want to create an I2cDevice object. - /// The connection settings to use for communication with the I2C bus controller that deviceId specifies. - /// An operation that returns the I2cDevice object. - I2cDevice FromId(String deviceId, I2cConnectionSettings settings); - - /// - /// Retrieves an Advanced Query Syntax (AQS) string for all of the inter-integrated circuit (I2C) bus controllers on the system. You can use this string with the - /// DeviceInformation.FindAllAsync method to get DeviceInformation objects for those bus controllers. - /// - /// An AQS string for all of the I2C bus controllers on the system, which you can use with the DeviceInformation.FindAll method to get DeviceInformation - /// objects for those bus controllers. - string GetDeviceSelector(); - - /// - /// Retrieves an Advanced Query Syntax (AQS) string for the inter-integrated circuit (I2C) bus that has the specified friendly name. You can use this string with the - /// DeviceInformation.FindAll method to get a DeviceInformation object for that bus. - /// - /// A friendly name for the particular I2C bus on a particular hardware platform for which you want to get the AQS string. - /// An AQS string for the I2C bus that friendlyName specifies, which you can use with the DeviceInformation.FindAll method to get a DeviceInformation object for that bus. - string GetDeviceSelector(String friendlyName); - } -} diff --git a/Windows.Devices.I2c/Properties/AssemblyInfo.cs b/Windows.Devices.I2c/Properties/AssemblyInfo.cs deleted file mode 100644 index 3175068..0000000 --- a/Windows.Devices.I2c/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("CSharp.BlankApplication")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("nanoFramework Contributors")] -[assembly: AssemblyProduct("nanoFramework System.Device.I2c")] -[assembly: AssemblyCopyright("Copyright (c) .NET Foundation and Contributors")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -//////////////////////////////////////////////////////////////// -// update this whenever the native assembly signature changes // -[assembly: AssemblyNativeVersion("100.1.0.0")] -//////////////////////////////////////////////////////////////// - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] diff --git a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec new file mode 100644 index 0000000..c13d116 --- /dev/null +++ b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec @@ -0,0 +1,32 @@ + + + + nanoFramework.System.Device.I2c.DELIVERABLES + $version$ + nanoFramework.System.Device.I2c.DELIVERABLES + nanoFramework project contributors + nanoFramework project contributors + false + + + false + https://github.com/nanoframework/lib-System.Device.I2c + https://secure.gravatar.com/avatar/97d0e092247f0716db6d4b47b7d1d1ad + Copyright (c) .NET Foundation and Contributors + ** DON'T REFERENCE THIS PACKAGE ** Not meant for development. This package includes the deliverable artifacts of the System.Device.I2c assembly for nanoFramework. These are for testing purposes and for updating the native code base of the library. + System.Device.I2c.DELIVERABLES is not meant for development. + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nanoFramework.System.Device.I2c.nuspec b/nanoFramework.System.Device.I2c.nuspec new file mode 100644 index 0000000..28a286d --- /dev/null +++ b/nanoFramework.System.Device.I2c.nuspec @@ -0,0 +1,35 @@ + + + + nanoFramework.System.Device.I2c + $version$ + nanoFramework.System.Device.I2c + nanoFramework project contributors + nanoFramework project contributors + false + MIT + + + false + https://github.com/nanoframework/lib-System.Device.I2c + https://secure.gravatar.com/avatar/97d0e092247f0716db6d4b47b7d1d1ad + + Copyright (c) .NET Foundation and Contributors + This package includes the System.Device.I2c assembly for nanoFramework C# projects. +This package requires a target with System.Device.I2c v$nativeVersion$ (checksum $checksum$). + System.Device.I2c assembly for .NET nanoFramework C# projects + nanoFramework C# csharp netmf netnf System.Device.I2c + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nanoFramework.Windows.Devices.I2c.sln b/nanoFramework.System.Device.I2c.sln similarity index 77% rename from nanoFramework.Windows.Devices.I2c.sln rename to nanoFramework.System.Device.I2c.sln index d3e1691..452f90e 100644 --- a/nanoFramework.Windows.Devices.I2c.sln +++ b/nanoFramework.System.Device.I2c.sln @@ -3,12 +3,12 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27130.2010 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "Windows.Devices.I2c", "Windows.Devices.I2c\Windows.Devices.I2c.nfproj", "{D74A7890-8A23-417B-AB74-923D57E987EA}" +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "System.Device.I2c", "System.Device.I2c\System.Device.I2c.nfproj", "{D74A7890-8A23-417B-AB74-923D57E987EA}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0660B91C-D1F7-4940-8BD4-688D84E666D2}" ProjectSection(SolutionItems) = preProject - nanoFramework.Windows.Devices.I2c.DELIVERABLES.nuspec = nanoFramework.Windows.Devices.I2c.DELIVERABLES.nuspec - nanoFramework.Windows.Devices.I2c.nuspec = nanoFramework.Windows.Devices.I2c.nuspec + nanoFramework.System.Device.I2c.DELIVERABLES.nuspec = nanoFramework.System.Device.I2c.DELIVERABLES.nuspec + nanoFramework.System.Device.I2c.nuspec = nanoFramework.System.Device.I2c.nuspec NuGet.Config = NuGet.Config version.json = version.json EndProjectSection diff --git a/nanoFramework.Windows.Devices.I2c.DELIVERABLES.nuspec b/nanoFramework.Windows.Devices.I2c.DELIVERABLES.nuspec deleted file mode 100644 index c48662f..0000000 --- a/nanoFramework.Windows.Devices.I2c.DELIVERABLES.nuspec +++ /dev/null @@ -1,32 +0,0 @@ - - - - nanoFramework.Windows.Devices.I2c.DELIVERABLES - $version$ - nanoFramework.Windows.Devices.I2c.DELIVERABLES - nanoFramework project contributors - nanoFramework project contributors - false - - - false - https://github.com/nanoframework/lib-Windows.Devices.I2c - https://secure.gravatar.com/avatar/97d0e092247f0716db6d4b47b7d1d1ad - Copyright (c) .NET Foundation and Contributors - ** DON'T REFERENCE THIS PACKAGE ** Not meant for development. This package includes the deliverable artifacts of the Windows.Devices.I2c assembly for nanoFramework. These are for testing purposes and for updating the native code base of the library. - Windows.Devices.I2c.DELIVERABLES is not meant for development. - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/nanoFramework.Windows.Devices.I2c.nuspec b/nanoFramework.Windows.Devices.I2c.nuspec deleted file mode 100644 index 773a505..0000000 --- a/nanoFramework.Windows.Devices.I2c.nuspec +++ /dev/null @@ -1,35 +0,0 @@ - - - - nanoFramework.Windows.Devices.I2c - $version$ - nanoFramework.Windows.Devices.I2c - nanoFramework project contributors - nanoFramework project contributors - false - MIT - - - false - https://github.com/nanoframework/lib-Windows.Devices.I2c - https://secure.gravatar.com/avatar/97d0e092247f0716db6d4b47b7d1d1ad - - Copyright (c) .NET Foundation and Contributors - This package includes the Windows.Devices.I2c assembly for nanoFramework C# projects. -This package requires a target with Windows.Devices.I2c v$nativeVersion$ (checksum $checksum$). - Windows.Devices.I2c assembly for .NET nanoFramework C# projects - nanoFramework C# csharp netmf netnf Windows.Devices.I2c - - - - - - - - - - - - - - \ No newline at end of file diff --git a/readme.txt b/readme.txt index 58d52be..650afd2 100644 --- a/readme.txt +++ b/readme.txt @@ -6,7 +6,7 @@ =================================================================================== -API docs: https://docs.nanoframework.net/api/Windows.Devices.I2c.html +API docs: https://docs.nanoframework.net/api/System.Device.I2c.html Browse our samples repository: https://github.com/nanoframework/samples From 0166061fac2b9c84bb2b19c27bd5031fd18500ed Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Fri, 2 Oct 2020 12:28:48 +0200 Subject: [PATCH 03/51] Initial commit adding System.Device.I2c managed implementation (#1) --- System.Device.I2c/I2cBusSpeed.cs | 24 +++ System.Device.I2c/I2cConnectionSettings.cs | 79 ++++++++++ System.Device.I2c/I2cDevice.cs | 139 ++++++++++++++++++ System.Device.I2c/I2cSharingMode.cs | 27 ++++ System.Device.I2c/Properties/AssemblyInfo.cs | 30 ++++ System.Device.I2c/System.Device.I2c.nfproj | 20 ++- System.Device.I2c/packages.config | 1 + ...work.System.Device.I2c.DELIVERABLES.nuspec | 1 + nanoFramework.System.Device.I2c.nuspec | 1 + 9 files changed, 318 insertions(+), 4 deletions(-) create mode 100644 System.Device.I2c/I2cBusSpeed.cs create mode 100644 System.Device.I2c/I2cConnectionSettings.cs create mode 100644 System.Device.I2c/I2cDevice.cs create mode 100644 System.Device.I2c/I2cSharingMode.cs create mode 100644 System.Device.I2c/Properties/AssemblyInfo.cs diff --git a/System.Device.I2c/I2cBusSpeed.cs b/System.Device.I2c/I2cBusSpeed.cs new file mode 100644 index 0000000..a0f5f91 --- /dev/null +++ b/System.Device.I2c/I2cBusSpeed.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) .NET Foundation and Contributors +// See LICENSE file in the project root for full license information. +// + +namespace System.Device.I2c +{ + /// + /// Describes the bus speeds that are available for connecting to an inter-integrated circuit (I2C) device. + /// The bus speed is the frequency at which to clock the I2C bus when accessing the device. + /// + public enum I2cBusSpeed + { + /// + /// The standard speed of 100 kilohertz (kHz). This speed is the default. + /// + StandardMode, + + /// + /// A fast speed of 400 kHz. + /// + FastMode + } +} diff --git a/System.Device.I2c/I2cConnectionSettings.cs b/System.Device.I2c/I2cConnectionSettings.cs new file mode 100644 index 0000000..b51d86a --- /dev/null +++ b/System.Device.I2c/I2cConnectionSettings.cs @@ -0,0 +1,79 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Device.I2c +{ + /// + /// The connection settings of a device on an I2C bus. + /// + public sealed class I2cConnectionSettings + { + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + private int _deviceAddress; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + private I2cBusSpeed _busSpeed; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + private I2cSharingMode _sharingMode; + + [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] + private int _busId; + + private I2cConnectionSettings() + { } + + /// + /// Initializes a new instance of the class. + /// + /// The bus ID the I2C device is connected to. + /// The bus address of the I2C device. + public I2cConnectionSettings(int busId, int deviceAddress) : this(busId, deviceAddress, I2cBusSpeed.FastMode, I2cSharingMode.Shared) + { } + + /// + /// Initializes a new instance of the class. + /// + /// The bus ID the I2C device is connected to. + /// The bus address of the I2C device. + /// The bus speed of the I2C device. + /// The sharing mode of the I2C device. + public I2cConnectionSettings(int busId, int deviceAddress, I2cBusSpeed busSpeed, I2cSharingMode sharingMode) + { + _busId = busId; + _deviceAddress = deviceAddress; + _busSpeed = busSpeed; + _sharingMode = sharingMode; + } + + internal I2cConnectionSettings(I2cConnectionSettings other) + { + _busId = other.BusId; + _deviceAddress = other.DeviceAddress; + _busSpeed = other.BusSpeed; + _sharingMode = other.SharingMode; + } + + /// + /// The bus ID the I2C device is connected to. + /// + public int BusId { get => _busId; } + + /// + /// The bus address of the I2C device. + /// + public int DeviceAddress { get => _deviceAddress; } + + /// + /// The bus speed of the I2C device + /// + public I2cBusSpeed BusSpeed { get => _busSpeed; } + + /// + /// Sharing mode of the I2C device + /// + public I2cSharingMode SharingMode { get => _sharingMode; } + } +} diff --git a/System.Device.I2c/I2cDevice.cs b/System.Device.I2c/I2cDevice.cs new file mode 100644 index 0000000..daf891f --- /dev/null +++ b/System.Device.I2c/I2cDevice.cs @@ -0,0 +1,139 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; + +namespace System.Device.I2c +{ + /// + /// The communications channel to a device on an I2C bus. + /// + public class I2cDevice : IDisposable + { + + private Windows.Devices.I2c.I2cDevice _device; + // For the ReadByte and WriteByte operations + private byte[] bufferSingleOperation = new byte[1]; + + /// + /// The connection settings of a device on an I2C bus. The connection settings are immutable after the device is created + /// so the object returned will be a clone of the settings object. + /// + public I2cConnectionSettings ConnectionSettings { get; } + + /// + /// Reads a byte from the I2C device. + /// + /// A byte read from the I2C device. + public byte ReadByte() + { + _device.Read(bufferSingleOperation); + return bufferSingleOperation[0]; + } + + /// + /// Reads data from the I2C device. + /// + /// + /// The buffer to read the data from the I2C device. + /// The length of the buffer determines how much data to read from the I2C device. + /// + public void Read(SpanByte buffer) + { + // This is allocating an intermediate buffer and then copy back the data to + // the SpanByte. This is intend to be changed in a native implementation + byte[] toRead = new byte[buffer.Length]; + _device.Read(toRead); + for (int i = 0; i < toRead.Length; i++) + { + buffer[i] = toRead[i]; + } + } + + /// + /// Writes a byte to the I2C device. + /// + /// The byte to be written to the I2C device. + public void WriteByte(byte value) + { + bufferSingleOperation[0] = value; + _device.Write(bufferSingleOperation); + } + + /// + /// Writes data to the I2C device. + /// + /// + /// The buffer that contains the data to be written to the I2C device. + /// The data should not include the I2C device address. + /// + public void Write(SpanByte buffer) + { + // This is allocating an intermediate buffer using the buffer of + // the SpanByte. This is intend to be changed in a native implementation + _device.Write(buffer.ToArray()); + } + + /// + /// Performs an atomic operation to write data to and then read data from the I2C bus on which the device is connected, + /// and sends a restart condition between the write and read operations. + /// + /// + /// The buffer that contains the data to be written to the I2C device. + /// The data should not include the I2C device address. + /// + /// The buffer to read the data from the I2C device. + /// The length of the buffer determines how much data to read from the I2C device. + /// + public void WriteRead(SpanByte writeBuffer, SpanByte readBuffer) + { + // This is allocating an intermediate buffer and then copy back the data to + // the SpanByte. This is intend to be changed in a native implementation + byte[] toRead = new byte[readBuffer.Length]; + _device.WriteRead(writeBuffer.ToArray(), toRead); + for (int i = 0; i < toRead.Length; i++) + { + readBuffer[i] = toRead[i]; + } + } + + /// + /// Creates a communications channel to a device on an I2C bus running on the current platform + /// + /// The connection settings of a device on an I2C bus. + /// A communications channel to a device on an I2C bus + public static I2cDevice Create(I2cConnectionSettings settings) + { + return new I2cDevice(settings); + } + + /// + /// Create an I2C Device + /// + /// Connection settings + public I2cDevice(I2cConnectionSettings settings) + { + ConnectionSettings = settings; + _device = Windows.Devices.I2c.I2cDevice.FromId($"I2C{settings.BusId}", new Windows.Devices.I2c.I2cConnectionSettings(settings.DeviceAddress) + { + BusSpeed = (Windows.Devices.I2c.I2cBusSpeed)settings.BusSpeed, + SharingMode = (Windows.Devices.I2c.I2cSharingMode)settings.SharingMode + }); + } + + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Disposes this instance + /// + /// if explicitly disposing, if in finalizer + void Dispose(bool disposing) + { } + } +} \ No newline at end of file diff --git a/System.Device.I2c/I2cSharingMode.cs b/System.Device.I2c/I2cSharingMode.cs new file mode 100644 index 0000000..9a25354 --- /dev/null +++ b/System.Device.I2c/I2cSharingMode.cs @@ -0,0 +1,27 @@ +// +// Copyright (c) .NET Foundation and Contributors +// See LICENSE file in the project root for full license information. +// + +namespace System.Device.I2c +{ + /// + /// Describes the modes in which you can connect to an inter-integrated circuit (I2C) bus address. + /// These modes determine whether other connections to the I2C bus address can be opened while you are connected to the I2C bus address. + /// + public enum I2cSharingMode + { + /// + /// Connects to the I2C bus address exclusively, so that no other connection to the I2C bus address can be made while you remain connected. This mode is the default mode. + /// + Exclusive, + + /// + /// Connects to the I2C bus address in shared mode, so that other connections to the I2C bus address can be made while you remain connected. + /// You can perform all operations on shared connections, but use such connections with care. When multiple client apps change the global state of the I2C device, + /// race conditions can result. + /// An example use case for using a shared connection is a sensor that obtains readings without changing the state of the device. + /// + Shared + } +} diff --git a/System.Device.I2c/Properties/AssemblyInfo.cs b/System.Device.I2c/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2ed3506 --- /dev/null +++ b/System.Device.I2c/Properties/AssemblyInfo.cs @@ -0,0 +1,30 @@ +// +// Copyright (c) .NET Foundation and Contributors +// See LICENSE file in the project root for full license information. +// + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.BlankApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.BlankApplication")] +[assembly: AssemblyCopyright("Copyright (c) .NET Foundation and Contributors")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +//////////////////////////////////////////////////////////////// +// update this whenever the native assembly signature changes // +[assembly: AssemblyNativeVersion("100.2.0.2")] +//////////////////////////////////////////////////////////////// + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index 256d99b..5d08db0 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -13,10 +13,10 @@ 512 - Windows.Devices.I2c + System.Device.I2c v1.0 - True - bin\$(Configuration)\Windows.Devices.I2c.xml + + bin\$(Configuration)\System.Device.I2c.xml true @@ -30,7 +30,7 @@ bin\$(Configuration)\Stubs - win_dev_i2c_native + sys_dev_i2c_native @@ -43,6 +43,13 @@ + + + + + + + @@ -52,6 +59,11 @@ ..\packages\nanoFramework.CoreLibrary.1.9.0-preview.5\lib\mscorlib.dll True + + ..\packages\nanoFramework.Windows.Devices.I2c.1.4.1-preview.11\lib\Windows.Devices.I2c.dll + True + True + diff --git a/System.Device.I2c/packages.config b/System.Device.I2c/packages.config index 825f4c7..f59bc44 100644 --- a/System.Device.I2c/packages.config +++ b/System.Device.I2c/packages.config @@ -1,5 +1,6 @@  + \ No newline at end of file diff --git a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec index c13d116..62bef94 100644 --- a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec +++ b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec @@ -19,6 +19,7 @@ + diff --git a/nanoFramework.System.Device.I2c.nuspec b/nanoFramework.System.Device.I2c.nuspec index 28a286d..07d8e73 100644 --- a/nanoFramework.System.Device.I2c.nuspec +++ b/nanoFramework.System.Device.I2c.nuspec @@ -21,6 +21,7 @@ This package requires a target with System.Device.I2c v$nativeVersion$ (checksum nanoFramework C# csharp netmf netnf System.Device.I2c + From 9f20dd384443adaf526b827cbc7e3a13012be688 Mon Sep 17 00:00:00 2001 From: Andrew Fahrenholtz Date: Mon, 12 Oct 2020 05:06:22 -0500 Subject: [PATCH 04/51] Fix broken links in documentation (#2) ***NO_CI*** --- CODE_OF_CONDUCT.md | 2 +- CONTRIBUTING.md | 2 +- README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 7feff0a..4c232b7 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,3 +1,3 @@ # Contributor Code of Conduct -Please refer to the contributor Code of Conduct at the Home repository [here](https://github.com/nanoframework/Home/blob/master/CODE_OF_CONDUCT.md. +Please refer to the contributor Code of Conduct at the Home repository [here](https://github.com/nanoframework/.github/blob/master/CODE_OF_CONDUCT.md). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5a6a6c1..97e8783 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,3 @@ # Contributing to **nanoFramework** -Please refer to the contribution guidelines at the Home repository [here](https://github.com/nanoframework/Home/blob/master/CONTRIBUTING.md). +Please refer to the contribution guidelines at the Home repository [here](https://github.com/nanoframework/.github/blob/master/CONTRIBUTING.md). diff --git a/README.md b/README.md index db47323..7dfe5b3 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The list of contributors to this project can be found at [CONTRIBUTORS](https:// ## License -The **nanoFramework** Class Libraries are licensed under the [MIT license](LICENSE.md). +The **nanoFramework** Class Libraries are licensed under the [MIT license](LICENSE). ## Code of Conduct From 55251279de1b904e3141e7de2d1a236b36fe7bb8 Mon Sep 17 00:00:00 2001 From: josesimoes Date: Mon, 26 Oct 2020 15:51:26 +0000 Subject: [PATCH 05/51] Remove I2cSharingMode --- System.Device.I2c/I2cConnectionSettings.cs | 15 ++---------- System.Device.I2c/I2cSharingMode.cs | 27 ---------------------- System.Device.I2c/System.Device.I2c.nfproj | 3 +-- 3 files changed, 3 insertions(+), 42 deletions(-) delete mode 100644 System.Device.I2c/I2cSharingMode.cs diff --git a/System.Device.I2c/I2cConnectionSettings.cs b/System.Device.I2c/I2cConnectionSettings.cs index b51d86a..c0528fc 100644 --- a/System.Device.I2c/I2cConnectionSettings.cs +++ b/System.Device.I2c/I2cConnectionSettings.cs @@ -16,9 +16,6 @@ public sealed class I2cConnectionSettings [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] private I2cBusSpeed _busSpeed; - [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] - private I2cSharingMode _sharingMode; - [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] private int _busId; @@ -30,7 +27,7 @@ private I2cConnectionSettings() /// /// The bus ID the I2C device is connected to. /// The bus address of the I2C device. - public I2cConnectionSettings(int busId, int deviceAddress) : this(busId, deviceAddress, I2cBusSpeed.FastMode, I2cSharingMode.Shared) + public I2cConnectionSettings(int busId, int deviceAddress) : this(busId, deviceAddress, I2cBusSpeed.FastMode) { } /// @@ -39,13 +36,11 @@ public I2cConnectionSettings(int busId, int deviceAddress) : this(busId, deviceA /// The bus ID the I2C device is connected to. /// The bus address of the I2C device. /// The bus speed of the I2C device. - /// The sharing mode of the I2C device. - public I2cConnectionSettings(int busId, int deviceAddress, I2cBusSpeed busSpeed, I2cSharingMode sharingMode) + public I2cConnectionSettings(int busId, int deviceAddress, I2cBusSpeed busSpeed) { _busId = busId; _deviceAddress = deviceAddress; _busSpeed = busSpeed; - _sharingMode = sharingMode; } internal I2cConnectionSettings(I2cConnectionSettings other) @@ -53,7 +48,6 @@ internal I2cConnectionSettings(I2cConnectionSettings other) _busId = other.BusId; _deviceAddress = other.DeviceAddress; _busSpeed = other.BusSpeed; - _sharingMode = other.SharingMode; } /// @@ -70,10 +64,5 @@ internal I2cConnectionSettings(I2cConnectionSettings other) /// The bus speed of the I2C device /// public I2cBusSpeed BusSpeed { get => _busSpeed; } - - /// - /// Sharing mode of the I2C device - /// - public I2cSharingMode SharingMode { get => _sharingMode; } } } diff --git a/System.Device.I2c/I2cSharingMode.cs b/System.Device.I2c/I2cSharingMode.cs deleted file mode 100644 index 9a25354..0000000 --- a/System.Device.I2c/I2cSharingMode.cs +++ /dev/null @@ -1,27 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// See LICENSE file in the project root for full license information. -// - -namespace System.Device.I2c -{ - /// - /// Describes the modes in which you can connect to an inter-integrated circuit (I2C) bus address. - /// These modes determine whether other connections to the I2C bus address can be opened while you are connected to the I2C bus address. - /// - public enum I2cSharingMode - { - /// - /// Connects to the I2C bus address exclusively, so that no other connection to the I2C bus address can be made while you remain connected. This mode is the default mode. - /// - Exclusive, - - /// - /// Connects to the I2C bus address in shared mode, so that other connections to the I2C bus address can be made while you remain connected. - /// You can perform all operations on shared connections, but use such connections with care. When multiple client apps change the global state of the I2C device, - /// race conditions can result. - /// An example use case for using a shared connection is a sensor that obtains readings without changing the state of the device. - /// - Shared - } -} diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index 5d08db0..834e54e 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -47,7 +47,6 @@ - @@ -78,4 +77,4 @@ - + \ No newline at end of file From 5f03e581e4836359390cf1fa70e7460dcba415b5 Mon Sep 17 00:00:00 2001 From: josesimoes Date: Mon, 26 Oct 2020 15:53:29 +0000 Subject: [PATCH 06/51] Minor improvements in code style --- System.Device.I2c/I2cConnectionSettings.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/System.Device.I2c/I2cConnectionSettings.cs b/System.Device.I2c/I2cConnectionSettings.cs index c0528fc..621066b 100644 --- a/System.Device.I2c/I2cConnectionSettings.cs +++ b/System.Device.I2c/I2cConnectionSettings.cs @@ -10,14 +10,14 @@ namespace System.Device.I2c public sealed class I2cConnectionSettings { - [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] - private int _deviceAddress; + [Diagnostics.DebuggerBrowsable(Diagnostics.DebuggerBrowsableState.Never)] + private readonly int _deviceAddress; - [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] - private I2cBusSpeed _busSpeed; + [Diagnostics.DebuggerBrowsable(Diagnostics.DebuggerBrowsableState.Never)] + private readonly I2cBusSpeed _busSpeed; - [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)] - private int _busId; + [Diagnostics.DebuggerBrowsable(Diagnostics.DebuggerBrowsableState.Never)] + private readonly int _busId; private I2cConnectionSettings() { } From aab49d8dbfc751879aa3fadfc0deec28d271a7f7 Mon Sep 17 00:00:00 2001 From: josesimoes Date: Tue, 27 Oct 2020 08:36:54 +0000 Subject: [PATCH 07/51] Remove dependency of Windows.Device.I2c --- System.Device.I2c/System.Device.I2c.nfproj | 5 ----- System.Device.I2c/packages.config | 1 - nanoFramework.System.Device.I2c.DELIVERABLES.nuspec | 1 - nanoFramework.System.Device.I2c.nuspec | 1 - 4 files changed, 8 deletions(-) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index 834e54e..f53d8ab 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -58,11 +58,6 @@ ..\packages\nanoFramework.CoreLibrary.1.9.0-preview.5\lib\mscorlib.dll True - - ..\packages\nanoFramework.Windows.Devices.I2c.1.4.1-preview.11\lib\Windows.Devices.I2c.dll - True - True - diff --git a/System.Device.I2c/packages.config b/System.Device.I2c/packages.config index f59bc44..825f4c7 100644 --- a/System.Device.I2c/packages.config +++ b/System.Device.I2c/packages.config @@ -1,6 +1,5 @@  - \ No newline at end of file diff --git a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec index 62bef94..c13d116 100644 --- a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec +++ b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec @@ -19,7 +19,6 @@ - diff --git a/nanoFramework.System.Device.I2c.nuspec b/nanoFramework.System.Device.I2c.nuspec index 07d8e73..28a286d 100644 --- a/nanoFramework.System.Device.I2c.nuspec +++ b/nanoFramework.System.Device.I2c.nuspec @@ -21,7 +21,6 @@ This package requires a target with System.Device.I2c v$nativeVersion$ (checksum nanoFramework C# csharp netmf netnf System.Device.I2c - From b388ba4bb7e873d6feb5b0a48089ddc972c1391c Mon Sep 17 00:00:00 2001 From: josesimoes Date: Tue, 27 Oct 2020 12:05:02 +0000 Subject: [PATCH 08/51] Update build status badge ***NO_CI*** --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7dfe5b3..e045559 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ | Component | Build Status | NuGet Package | |:-|---|---| -| System.Device.I2c | [![Build Status](https://dev.azure.com/nanoframework/System.Device.I2c/_apis/build/status/nanoframework.lib-System.Device.I2c?branchName=develop)](https://dev.azure.com/nanoframework/System.Device.I2c/_build/latest?definitionId=28?branchName=master) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.System.Device.I2c.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.System.Device.I2c/) | -| System.Device.I2c (preview) | [![Build Status](https://dev.azure.com/nanoframework/System.Device.I2c/_apis/build/status/nanoframework.lib-System.Device.I2c?branchName=develop)](https://dev.azure.com/nanoframework/System.Device.I2c/_build/latest?definitionId=28?branchName=develop) | [![](https://badgen.net/badge/NuGet/preview/D7B023?icon=https://simpleicons.now.sh/azuredevops/fff)](https://dev.azure.com/nanoframework/feed/_packaging?_a=package&feed=sandbox&package=nanoFramework.System.Device.I2c&protocolType=NuGet&view=overview) | +| System.Device.I2c | [![Build Status](https://dev.azure.com/nanoframework/System.Device.I2c/_apis/build/status/nanoframework.lib-System.Device.I2c?branchName=develop)](https://dev.azure.com/nanoframework/System.Device.I2c/_build/latest?definitionId=64&branchName=master) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.System.Device.I2c.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.System.Device.I2c/) | +| System.Device.I2c (preview) | [![Build Status](https://dev.azure.com/nanoframework/System.Device.I2c/_apis/build/status/nanoframework.lib-System.Device.I2c?branchName=develop)](https://dev.azure.com/nanoframework/System.Device.I2c/_build/latest?definitionId=64&branchName=develop) | [![](https://badgen.net/badge/NuGet/preview/D7B023?icon=https://simpleicons.now.sh/azuredevops/fff)](https://dev.azure.com/nanoframework/feed/_packaging?_a=package&feed=sandbox&package=nanoFramework.System.Device.I2c&protocolType=NuGet&view=overview) | ## Feedback and documentation From 96aab044a75bf544772bb1aedcf273ebbabbc83b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Tue, 27 Oct 2020 18:17:14 +0000 Subject: [PATCH 09/51] Add I2cTransferResult and I2cTransferStatus (#11) --- System.Device.I2c/I2cDevice.cs | 134 +++++++++++++------ System.Device.I2c/I2cTransferResult.cs | 30 +++++ System.Device.I2c/I2cTransferStatus.cs | 41 ++++++ System.Device.I2c/Properties/AssemblyInfo.cs | 9 +- System.Device.I2c/System.Device.I2c.nfproj | 4 +- 5 files changed, 171 insertions(+), 47 deletions(-) create mode 100644 System.Device.I2c/I2cTransferResult.cs create mode 100644 System.Device.I2c/I2cTransferStatus.cs diff --git a/System.Device.I2c/I2cDevice.cs b/System.Device.I2c/I2cDevice.cs index daf891f..4843ca8 100644 --- a/System.Device.I2c/I2cDevice.cs +++ b/System.Device.I2c/I2cDevice.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; +using System.Runtime.CompilerServices; namespace System.Device.I2c { @@ -11,16 +11,25 @@ namespace System.Device.I2c /// public class I2cDevice : IDisposable { + // this is used as the lock object + // a lock is required because multiple threads can access the device + [Diagnostics.DebuggerBrowsable(Diagnostics.DebuggerBrowsableState.Never)] + private readonly object _syncLock; - private Windows.Devices.I2c.I2cDevice _device; - // For the ReadByte and WriteByte operations - private byte[] bufferSingleOperation = new byte[1]; + [Diagnostics.DebuggerBrowsable(Diagnostics.DebuggerBrowsableState.Never)] + private readonly I2cConnectionSettings _connectionSettings; + + [Diagnostics.DebuggerBrowsable(Diagnostics.DebuggerBrowsableState.Never)] + private bool _disposed; + + // speeds up the execution of ReadByte and WriteByte operations + private readonly byte[] _buffer; /// /// The connection settings of a device on an I2C bus. The connection settings are immutable after the device is created /// so the object returned will be a clone of the settings object. /// - public I2cConnectionSettings ConnectionSettings { get; } + public I2cConnectionSettings ConnectionSettings { get => _connectionSettings; } /// /// Reads a byte from the I2C device. @@ -28,8 +37,14 @@ public class I2cDevice : IDisposable /// A byte read from the I2C device. public byte ReadByte() { - _device.Read(bufferSingleOperation); - return bufferSingleOperation[0]; + lock (_syncLock) + { + var buffer = new SpanByte(_buffer); + + NativeTransmit(null, buffer); + + return buffer[0]; + } } /// @@ -39,15 +54,11 @@ public byte ReadByte() /// The buffer to read the data from the I2C device. /// The length of the buffer determines how much data to read from the I2C device. /// - public void Read(SpanByte buffer) + public I2cTransferResult Read(SpanByte buffer) { - // This is allocating an intermediate buffer and then copy back the data to - // the SpanByte. This is intend to be changed in a native implementation - byte[] toRead = new byte[buffer.Length]; - _device.Read(toRead); - for (int i = 0; i < toRead.Length; i++) + lock (_syncLock) { - buffer[i] = toRead[i]; + return NativeTransmit(null, buffer); } } @@ -55,10 +66,15 @@ public void Read(SpanByte buffer) /// Writes a byte to the I2C device. /// /// The byte to be written to the I2C device. - public void WriteByte(byte value) + public I2cTransferResult WriteByte(byte value) { - bufferSingleOperation[0] = value; - _device.Write(bufferSingleOperation); + lock (_syncLock) + { + // copy value + _buffer[0] = value; + + return NativeTransmit(new SpanByte(_buffer), null); + } } /// @@ -68,11 +84,12 @@ public void WriteByte(byte value) /// The buffer that contains the data to be written to the I2C device. /// The data should not include the I2C device address. /// - public void Write(SpanByte buffer) + public I2cTransferResult Write(SpanByte buffer) { - // This is allocating an intermediate buffer using the buffer of - // the SpanByte. This is intend to be changed in a native implementation - _device.Write(buffer.ToArray()); + lock (_syncLock) + { + return NativeTransmit(buffer, null); + } } /// @@ -86,15 +103,11 @@ public void Write(SpanByte buffer) /// The buffer to read the data from the I2C device. /// The length of the buffer determines how much data to read from the I2C device. /// - public void WriteRead(SpanByte writeBuffer, SpanByte readBuffer) + public I2cTransferResult WriteRead(SpanByte writeBuffer, SpanByte readBuffer) { - // This is allocating an intermediate buffer and then copy back the data to - // the SpanByte. This is intend to be changed in a native implementation - byte[] toRead = new byte[readBuffer.Length]; - _device.WriteRead(writeBuffer.ToArray(), toRead); - for (int i = 0; i < toRead.Length; i++) + lock (_syncLock) { - readBuffer[i] = toRead[i]; + return NativeTransmit(writeBuffer, readBuffer); } } @@ -114,26 +127,65 @@ public static I2cDevice Create(I2cConnectionSettings settings) /// Connection settings public I2cDevice(I2cConnectionSettings settings) { - ConnectionSettings = settings; - _device = Windows.Devices.I2c.I2cDevice.FromId($"I2C{settings.BusId}", new Windows.Devices.I2c.I2cConnectionSettings(settings.DeviceAddress) + _connectionSettings = settings; + + // create the buffer + _buffer = new byte[1]; + + // create the lock object + _syncLock = new object(); + + // call native init to allow HAL/PAL inits related with I2C hardware + NativeInit(); + } + + #region IDisposable Support + + private void Dispose(bool disposing) + { + if (!_disposed) { - BusSpeed = (Windows.Devices.I2c.I2cBusSpeed)settings.BusSpeed, - SharingMode = (Windows.Devices.I2c.I2cSharingMode)settings.SharingMode - }); + NativeDispose(); + + _disposed = true; + } } - /// - public void Dispose() +#pragma warning disable 1591 + ~I2cDevice() { - Dispose(true); - GC.SuppressFinalize(this); + Dispose(false); } /// - /// Disposes this instance + /// /// - /// if explicitly disposing, if in finalizer - void Dispose(bool disposing) - { } + public void Dispose() + { + lock (_syncLock) + { + if (!_disposed) + { + Dispose(true); + + GC.SuppressFinalize(this); + } + } + } + + #endregion + + #region external calls to native implementations + + [MethodImpl(MethodImplOptions.InternalCall)] + private extern void NativeInit(); + + [MethodImpl(MethodImplOptions.InternalCall)] + private extern void NativeDispose(); + + [MethodImpl(MethodImplOptions.InternalCall)] + private extern I2cTransferResult NativeTransmit(SpanByte writeBuffer, SpanByte readBuffer); + + #endregion } } \ No newline at end of file diff --git a/System.Device.I2c/I2cTransferResult.cs b/System.Device.I2c/I2cTransferResult.cs new file mode 100644 index 0000000..35dc09d --- /dev/null +++ b/System.Device.I2c/I2cTransferResult.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Device.I2c +{ + /// + /// Provides information about whether the data transfers that the , , or method performed succeeded, and the actual number + /// of bytes the method transferred. + /// + public struct I2cTransferResult + { + [Diagnostics.DebuggerBrowsable(Diagnostics.DebuggerBrowsableState.Never)] + private readonly uint _bytesTransferred; + + [Diagnostics.DebuggerBrowsable(Diagnostics.DebuggerBrowsableState.Never)] + private readonly I2cTransferStatus _status; + + /// + /// The actual number of bytes that the operation actually transferred. The following table describes what this value represents for each method. + /// + public uint BytesTransferred { get => _bytesTransferred; } + + /// + /// An enumeration value that indicates if the read or write operation transferred the full number of bytes that the method requested, or the reason + /// that the full transfer did not succeed. For WriteReadPartial, the value indicates whether the data for both the write and the read operations was entirely transferred. + /// + public I2cTransferStatus Status { get => _status; } + } +} diff --git a/System.Device.I2c/I2cTransferStatus.cs b/System.Device.I2c/I2cTransferStatus.cs new file mode 100644 index 0000000..bbf1c99 --- /dev/null +++ b/System.Device.I2c/I2cTransferStatus.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace System.Device.I2c +{ + /// + /// Describes whether the data transfers that the , , or methods performed succeeded, or provides the reason that the transfers did not succeed. + /// + public enum I2cTransferStatus + { + /// + /// The transfer failed for an unknown reason. + /// + UnknownError, + + /// + /// The data was entirely transferred. For WriteRead, the data for both the write and the read operations was entirely transferred. + /// For this status code, the value of the member that the method returns is the same as the size of the buffer + /// you specified when you called the method, or is equal to the sum of the sizes of two buffers that you specified for WriteRead. + /// + FullTransfer, + + /// + /// The transfer failed due to the clock being stretched for too long. Ensure the clock line is not being held low. + /// + ClockStretchTimeout, + + /// + /// The I2C device negatively acknowledged the data transfer before all of the data was transferred. + /// For this status code, the value of the member that the method returns is the number of bytes actually transferred. + /// For , the value is the sum of the number of bytes that the operation wrote and the number of bytes that the operation read. + /// + PartialTransfer, + + /// + /// The bus address was not acknowledged. For this status code, the value of the member that the method returns of the method is 0. + /// + SlaveAddressNotAcknowledged, + } +} diff --git a/System.Device.I2c/Properties/AssemblyInfo.cs b/System.Device.I2c/Properties/AssemblyInfo.cs index 2ed3506..26c336c 100644 --- a/System.Device.I2c/Properties/AssemblyInfo.cs +++ b/System.Device.I2c/Properties/AssemblyInfo.cs @@ -10,18 +10,17 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("CSharp.BlankApplication")] +[assembly: AssemblyTitle("nanoFramework System.Device.I2c")] [assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("CSharp.BlankApplication")] +[assembly: AssemblyCompany(".NET nanoFramework contributors")] +[assembly: AssemblyProduct(".NET nanoFramework System.Device.I2c")] [assembly: AssemblyCopyright("Copyright (c) .NET Foundation and Contributors")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] //////////////////////////////////////////////////////////////// // update this whenever the native assembly signature changes // -[assembly: AssemblyNativeVersion("100.2.0.2")] +[assembly: AssemblyNativeVersion("100.0.0.1")] //////////////////////////////////////////////////////////////// // Setting ComVisible to false makes the types in this assembly not visible diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index f53d8ab..d671f8c 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -15,7 +15,7 @@ System.Device.I2c v1.0 - + True bin\$(Configuration)\System.Device.I2c.xml @@ -47,6 +47,8 @@ + + From 5a32edf269666d0a36cb2190b892f17cefe53171 Mon Sep 17 00:00:00 2001 From: nfbot Date: Tue, 27 Oct 2020 18:20:37 +0000 Subject: [PATCH 10/51] Update CHANGELOG for v1.0.0 ***NO_CI*** --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e69de29..2d9c45a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -0,0 +1,14 @@ +# Changelog + +## [**Changes available only in 'Preview' NuGet packages:**](https://github.com/nanoframework/lib-System.Device.I2c/tree/HEAD) + +[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/afeac3697d8b4cd3130b230ddb8eb37ebc51361a...HEAD) + +**Implemented enhancements:** + +- Add I2cTransferResult and I2cTransferStatus [\#11](https://github.com/nanoframework/lib-System.Device.I2c/pull/11) +- Initial commit adding System.Device.I2c managed implementation [\#1](https://github.com/nanoframework/lib-System.Device.I2c/pull/1) + + + +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* From a737167066e8ec6c3bbe236ce24e384d750e0456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Tue, 27 Oct 2020 18:53:35 +0000 Subject: [PATCH 11/51] Update version.json - Bump version to 1.0.1-preview. --- version.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.json b/version.json index 6c5cf89..87447f5 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.0.0-preview.{height}", + "version": "1.0.1-preview.{height}", "assemblyVersion": { "precision": "revision" }, @@ -21,4 +21,4 @@ "versionIncrement": "build", "firstUnstableTag": "preview" } -} \ No newline at end of file +} From f4d4e1ce4fb89c0810101ac26e515b86152f1fd5 Mon Sep 17 00:00:00 2001 From: nfbot Date: Tue, 27 Oct 2020 18:57:05 +0000 Subject: [PATCH 12/51] Update CHANGELOG for v1.0.1 ***NO_CI*** --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d9c45a..7e94220 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ # Changelog -## [**Changes available only in 'Preview' NuGet packages:**](https://github.com/nanoframework/lib-System.Device.I2c/tree/HEAD) +## [v1.0.0-preview.9](https://github.com/nanoframework/lib-System.Device.I2c/tree/v1.0.0-preview.9) (2020-10-27) -[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/afeac3697d8b4cd3130b230ddb8eb37ebc51361a...HEAD) +[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/afeac3697d8b4cd3130b230ddb8eb37ebc51361a...v1.0.0-preview.9) **Implemented enhancements:** From 025e0f95cc176ccce6886219804beb4aeb21a185 Mon Sep 17 00:00:00 2001 From: josesimoes Date: Tue, 27 Oct 2020 19:01:06 +0000 Subject: [PATCH 13/51] Update sonarcloud badges --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e045559..9760b91 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-System.Device.I2c&metric=alert_status)](https://sonarcloud.io/dashboard?id=nanoframework_lib-System.Device.I2c) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-System.Device.I2c&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=nanoframework_lib-System.Device.I2c) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![NuGet](https://img.shields.io/nuget/dt/nanoFramework.System.Device.I2c.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.System.Device.I2c/) [![#yourfirstpr](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://github.com/nanoframework/Home/blob/master/CONTRIBUTING.md) [![Discord](https://img.shields.io/discord/478725473862549535.svg?logo=discord&logoColor=white&label=Discord&color=7289DA)](https://discord.gg/gCyBu8T) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-nanoframework.System.Device.I2c&metric=alert_status)](https://sonarcloud.io/dashboard?id=nanoframework_lib-System.Device.I2c) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-System.Device.I2c&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=nanoframework_lib-System.Device.I2c) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![NuGet](https://img.shields.io/nuget/dt/nanoFramework.System.Device.I2c.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.System.Device.I2c/) [![#yourfirstpr](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://github.com/nanoframework/Home/blob/master/CONTRIBUTING.md) [![Discord](https://img.shields.io/discord/478725473862549535.svg?logo=discord&logoColor=white&label=Discord&color=7289DA)](https://discord.gg/gCyBu8T) ![nanoFramework logo](https://github.com/nanoframework/Home/blob/master/resources/logo/nanoFramework-repo-logo.png) From 95e1156e01c3f12c2a7851aa72cf1f133c1909a2 Mon Sep 17 00:00:00 2001 From: josesimoes Date: Tue, 27 Oct 2020 19:05:16 +0000 Subject: [PATCH 14/51] Work CD-CI - Fix sonarcloud project name. --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f7e9eef..5e3ea37 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -33,7 +33,7 @@ steps: # all build, update and publish steps - template: azure-pipelines-templates/class-lib-build.yml@templates parameters: - sonarCloudProject: 'nanoframework_lib-System.Device.I2c' + sonarCloudProject: 'nanoframework_lib-nanoframework.System.Device.I2c' # step from template @ nf-tools repo # report error From e9cb84c45f65d03a77441a9e8591abe5ebc92987 Mon Sep 17 00:00:00 2001 From: nfbot Date: Tue, 27 Oct 2020 19:09:31 +0000 Subject: [PATCH 15/51] Update CHANGELOG for v1.0.1 ***NO_CI*** --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e94220..961ba44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [v1.0.1-preview.1](https://github.com/nanoframework/lib-System.Device.I2c/tree/v1.0.1-preview.1) (2020-10-27) + +[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.0-preview.9...v1.0.1-preview.1) + ## [v1.0.0-preview.9](https://github.com/nanoframework/lib-System.Device.I2c/tree/v1.0.0-preview.9) (2020-10-27) [Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/afeac3697d8b4cd3130b230ddb8eb37ebc51361a...v1.0.0-preview.9) From cd1f40ebc655dbe509b68f5709df882f5d4d740e Mon Sep 17 00:00:00 2001 From: josesimoes Date: Tue, 27 Oct 2020 19:11:20 +0000 Subject: [PATCH 16/51] Fix sonarcloud badges --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9760b91..111ee53 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-nanoframework.System.Device.I2c&metric=alert_status)](https://sonarcloud.io/dashboard?id=nanoframework_lib-System.Device.I2c) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-System.Device.I2c&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=nanoframework_lib-System.Device.I2c) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![NuGet](https://img.shields.io/nuget/dt/nanoFramework.System.Device.I2c.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.System.Device.I2c/) [![#yourfirstpr](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://github.com/nanoframework/Home/blob/master/CONTRIBUTING.md) [![Discord](https://img.shields.io/discord/478725473862549535.svg?logo=discord&logoColor=white&label=Discord&color=7289DA)](https://discord.gg/gCyBu8T) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-nanoframework.System.Device.I2c&metric=alert_status)](https://sonarcloud.io/dashboard?id=nanoframework_lib-nanoframework.System.Device.I2c) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-nanoframework.System.Device.I2c&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=nanoframework_lib-nanoframework.System.Device.I2c) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![NuGet](https://img.shields.io/nuget/dt/nanoFramework.System.Device.I2c.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.System.Device.I2c/) [![#yourfirstpr](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://github.com/nanoframework/Home/blob/master/CONTRIBUTING.md) [![Discord](https://img.shields.io/discord/478725473862549535.svg?logo=discord&logoColor=white&label=Discord&color=7289DA)](https://discord.gg/gCyBu8T) ![nanoFramework logo](https://github.com/nanoframework/Home/blob/master/resources/logo/nanoFramework-repo-logo.png) From ff70f209b8ab9979df99c21e22bd2e9f1e55e165 Mon Sep 17 00:00:00 2001 From: nfbot Date: Tue, 27 Oct 2020 19:32:51 +0000 Subject: [PATCH 17/51] Update CHANGELOG for v1.0.1 ***NO_CI*** --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 961ba44..98500f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [v1.0.1-preview.4](https://github.com/nanoframework/lib-System.Device.I2c/tree/v1.0.1-preview.4) (2020-10-27) + +[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.1...v1.0.1-preview.4) + ## [v1.0.1-preview.1](https://github.com/nanoframework/lib-System.Device.I2c/tree/v1.0.1-preview.1) (2020-10-27) [Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.0-preview.9...v1.0.1-preview.1) From ad309bc2777b00cb54aa83fdee97fdb6ef1586c5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 28 Oct 2020 00:21:27 +0000 Subject: [PATCH 18/51] Update dependencies --- System.Device.I2c/System.Device.I2c.nfproj | 10 +++++----- System.Device.I2c/packages.config | 2 +- nanoFramework.System.Device.I2c.DELIVERABLES.nuspec | 2 +- nanoFramework.System.Device.I2c.nuspec | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index d671f8c..daa1722 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -1,4 +1,4 @@ - + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ @@ -38,7 +38,7 @@ - + false @@ -56,8 +56,8 @@ - - ..\packages\nanoFramework.CoreLibrary.1.9.0-preview.5\lib\mscorlib.dll + + ..\packages\nanoFramework.CoreLibrary.1.9.1-preview.6\lib\mscorlib.dll True @@ -74,4 +74,4 @@ - \ No newline at end of file + diff --git a/System.Device.I2c/packages.config b/System.Device.I2c/packages.config index 825f4c7..686ff9e 100644 --- a/System.Device.I2c/packages.config +++ b/System.Device.I2c/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec index c13d116..25fa158 100644 --- a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec +++ b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec @@ -18,7 +18,7 @@ - + diff --git a/nanoFramework.System.Device.I2c.nuspec b/nanoFramework.System.Device.I2c.nuspec index 28a286d..0c1eca4 100644 --- a/nanoFramework.System.Device.I2c.nuspec +++ b/nanoFramework.System.Device.I2c.nuspec @@ -20,7 +20,7 @@ This package requires a target with System.Device.I2c v$nativeVersion$ (checksum System.Device.I2c assembly for .NET nanoFramework C# projects nanoFramework C# csharp netmf netnf System.Device.I2c - + From c398b21253a6e714f3ea5c9833f26637a8b4a644 Mon Sep 17 00:00:00 2001 From: nfbot Date: Wed, 28 Oct 2020 00:25:00 +0000 Subject: [PATCH 19/51] Update CHANGELOG for v1.0.1 ***NO_CI*** --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98500f2..c523016 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [**Changes available only in 'Preview' NuGet packages:**](https://github.com/nanoframework/lib-System.Device.I2c/tree/HEAD) + +[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.6...HEAD) + +**Documentation and other chores:** + +- Update dependencies [\#12](https://github.com/nanoframework/lib-System.Device.I2c/pull/12) + +## [v1.0.1-preview.6](https://github.com/nanoframework/lib-System.Device.I2c/tree/v1.0.1-preview.6) (2020-10-27) + +[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.4...v1.0.1-preview.6) + ## [v1.0.1-preview.4](https://github.com/nanoframework/lib-System.Device.I2c/tree/v1.0.1-preview.4) (2020-10-27) [Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.1...v1.0.1-preview.4) From 762900e49a11a10229fe2917f565a06d07f88d53 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Tue, 1 Dec 2020 00:36:57 +0000 Subject: [PATCH 20/51] Update CICD image (#13) ***NO_CI*** --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5e3ea37..e4344cf 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,7 +17,7 @@ resources: endpoint: nanoframework pool: - vmImage: 'VS2017-Win2016' + vmImage: 'windows-2019' variables: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true From 8bb3ba62c14162a92f7bc1df5c65ca27a63fc0c7 Mon Sep 17 00:00:00 2001 From: nfbot Date: Mon, 7 Dec 2020 15:07:58 +0000 Subject: [PATCH 21/51] Bumps nanoFramework.CoreLibrary from 1.9.1-preview.6 to 1.10.0-preview.4 --- System.Device.I2c/System.Device.I2c.nfproj | 8 ++++---- System.Device.I2c/packages.config | 2 +- nanoFramework.System.Device.I2c.DELIVERABLES.nuspec | 2 +- nanoFramework.System.Device.I2c.nuspec | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index daa1722..65f4583 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -1,4 +1,4 @@ - + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ @@ -38,7 +38,7 @@ - + false @@ -56,8 +56,8 @@ - - ..\packages\nanoFramework.CoreLibrary.1.9.1-preview.6\lib\mscorlib.dll + + ..\packages\nanoFramework.CoreLibrary.1.10.0-preview.4\lib\mscorlib.dll True diff --git a/System.Device.I2c/packages.config b/System.Device.I2c/packages.config index 686ff9e..39bea5d 100644 --- a/System.Device.I2c/packages.config +++ b/System.Device.I2c/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec index 25fa158..87d6eda 100644 --- a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec +++ b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec @@ -18,7 +18,7 @@ - + diff --git a/nanoFramework.System.Device.I2c.nuspec b/nanoFramework.System.Device.I2c.nuspec index 0c1eca4..2793c27 100644 --- a/nanoFramework.System.Device.I2c.nuspec +++ b/nanoFramework.System.Device.I2c.nuspec @@ -20,7 +20,7 @@ This package requires a target with System.Device.I2c v$nativeVersion$ (checksum System.Device.I2c assembly for .NET nanoFramework C# projects nanoFramework C# csharp netmf netnf System.Device.I2c - + From 73c6b36aa0db52d93c9d40b068d91a024441415a Mon Sep 17 00:00:00 2001 From: nfbot Date: Mon, 7 Dec 2020 15:15:08 +0000 Subject: [PATCH 22/51] Update CHANGELOG for v1.0.1 ***NO_CI*** --- CHANGELOG.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c523016..3503937 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,15 @@ ## [**Changes available only in 'Preview' NuGet packages:**](https://github.com/nanoframework/lib-System.Device.I2c/tree/HEAD) -[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.6...HEAD) +[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.8...HEAD) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.9.1-preview.6 to 1.10.0-preview.4 [\#14](https://github.com/nanoframework/lib-System.Device.I2c/pull/14) + +## [v1.0.1-preview.8](https://github.com/nanoframework/lib-System.Device.I2c/tree/v1.0.1-preview.8) (2020-10-28) + +[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.6...v1.0.1-preview.8) **Documentation and other chores:** From d5a2fb7cc5f25da116ded75c5a3a440ee4d745a1 Mon Sep 17 00:00:00 2001 From: nfbot Date: Mon, 28 Dec 2020 13:45:16 +0000 Subject: [PATCH 23/51] Bumps nanoFramework.CoreLibrary from 1.10.0-preview.4 to 1.10.1-preview.6 --- System.Device.I2c/System.Device.I2c.nfproj | 6 +++--- System.Device.I2c/packages.config | 2 +- nanoFramework.System.Device.I2c.DELIVERABLES.nuspec | 2 +- nanoFramework.System.Device.I2c.nuspec | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index 65f4583..fe30810 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -38,7 +38,7 @@ - + false @@ -56,8 +56,8 @@ - - ..\packages\nanoFramework.CoreLibrary.1.10.0-preview.4\lib\mscorlib.dll + + ..\packages\nanoFramework.CoreLibrary.1.10.1-preview.6\lib\mscorlib.dll True diff --git a/System.Device.I2c/packages.config b/System.Device.I2c/packages.config index 39bea5d..ae9566f 100644 --- a/System.Device.I2c/packages.config +++ b/System.Device.I2c/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec index 87d6eda..c26a2ee 100644 --- a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec +++ b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec @@ -18,7 +18,7 @@ - + diff --git a/nanoFramework.System.Device.I2c.nuspec b/nanoFramework.System.Device.I2c.nuspec index 2793c27..1728ad9 100644 --- a/nanoFramework.System.Device.I2c.nuspec +++ b/nanoFramework.System.Device.I2c.nuspec @@ -20,7 +20,7 @@ This package requires a target with System.Device.I2c v$nativeVersion$ (checksum System.Device.I2c assembly for .NET nanoFramework C# projects nanoFramework C# csharp netmf netnf System.Device.I2c - + From 9c2d8ab76cfa8c03d4ec839098d288ac731568b0 Mon Sep 17 00:00:00 2001 From: nfbot Date: Mon, 28 Dec 2020 13:51:23 +0000 Subject: [PATCH 24/51] Update CHANGELOG for v1.0.1 ***NO_CI*** --- CHANGELOG.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3503937..2944149 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,15 @@ ## [**Changes available only in 'Preview' NuGet packages:**](https://github.com/nanoframework/lib-System.Device.I2c/tree/HEAD) -[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.8...HEAD) +[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.11...HEAD) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.10.0-preview.4 to 1.10.1-preview.6 [\#15](https://github.com/nanoframework/lib-System.Device.I2c/pull/15) + +## [v1.0.1-preview.11](https://github.com/nanoframework/lib-System.Device.I2c/tree/v1.0.1-preview.11) (2020-12-07) + +[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.8...v1.0.1-preview.11) **Documentation and other chores:** From 8a05b53147a99b3aae4a88cef42c9b81d0f94d31 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 28 Dec 2020 14:21:27 +0000 Subject: [PATCH 25/51] Work CI-CD - Add sign config files. ***NO_CI*** --- config/SignClient.json | 14 ++++++++++++++ config/filelist.txt | 1 + 2 files changed, 15 insertions(+) create mode 100644 config/SignClient.json create mode 100644 config/filelist.txt diff --git a/config/SignClient.json b/config/SignClient.json new file mode 100644 index 0000000..482177d --- /dev/null +++ b/config/SignClient.json @@ -0,0 +1,14 @@ +{ + "SignClient": { + "AzureAd": { + "AADInstance": "https://login.microsoftonline.com/", + "ClientId": "c248d68a-ba6f-4aa9-8a68-71fe872063f8", + "TenantId": "16076fdc-fcc1-4a15-b1ca-32c9a255900e" + }, + "Service": { + "Url": "https://codesign.dotnetfoundation.org/", + "ResourceId": "https://SignService/3c30251f-36f3-490b-a955-520addb85001" + } + } + } + \ No newline at end of file diff --git a/config/filelist.txt b/config/filelist.txt new file mode 100644 index 0000000..1381e4d --- /dev/null +++ b/config/filelist.txt @@ -0,0 +1 @@ +**/System.Device.I2c.* \ No newline at end of file From 011b6b7c8b0607e878616dfb6340820c624ff14b Mon Sep 17 00:00:00 2001 From: nfbot Date: Tue, 29 Dec 2020 13:25:55 +0000 Subject: [PATCH 26/51] Bumps nanoFramework.CoreLibrary from 1.10.1-preview.6 to 1.10.1-preview.7 --- System.Device.I2c/System.Device.I2c.nfproj | 4 ++-- System.Device.I2c/packages.config | 2 +- nanoFramework.System.Device.I2c.DELIVERABLES.nuspec | 2 +- nanoFramework.System.Device.I2c.nuspec | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index fe30810..582b18f 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -38,7 +38,7 @@ - + false @@ -57,7 +57,7 @@ - ..\packages\nanoFramework.CoreLibrary.1.10.1-preview.6\lib\mscorlib.dll + ..\packages\nanoFramework.CoreLibrary.1.10.1-preview.7\lib\mscorlib.dll True diff --git a/System.Device.I2c/packages.config b/System.Device.I2c/packages.config index ae9566f..91fff5f 100644 --- a/System.Device.I2c/packages.config +++ b/System.Device.I2c/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec index c26a2ee..bcdcaaf 100644 --- a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec +++ b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec @@ -18,7 +18,7 @@ - + diff --git a/nanoFramework.System.Device.I2c.nuspec b/nanoFramework.System.Device.I2c.nuspec index 1728ad9..04df49d 100644 --- a/nanoFramework.System.Device.I2c.nuspec +++ b/nanoFramework.System.Device.I2c.nuspec @@ -20,7 +20,7 @@ This package requires a target with System.Device.I2c v$nativeVersion$ (checksum System.Device.I2c assembly for .NET nanoFramework C# projects nanoFramework C# csharp netmf netnf System.Device.I2c - + From 2688e4573bf4010b60d9ca8d09099a6578d05323 Mon Sep 17 00:00:00 2001 From: nfbot Date: Tue, 29 Dec 2020 13:32:11 +0000 Subject: [PATCH 27/51] Update CHANGELOG for v1.0.1 ***NO_CI*** --- CHANGELOG.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2944149..c91a715 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,15 @@ ## [**Changes available only in 'Preview' NuGet packages:**](https://github.com/nanoframework/lib-System.Device.I2c/tree/HEAD) -[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.11...HEAD) +[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.13...HEAD) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.10.1-preview.6 to 1.10.1-preview.7 [\#16](https://github.com/nanoframework/lib-System.Device.I2c/pull/16) + +## [v1.0.1-preview.13](https://github.com/nanoframework/lib-System.Device.I2c/tree/v1.0.1-preview.13) (2020-12-28) + +[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.11...v1.0.1-preview.13) **Documentation and other chores:** From d4de1ec4a10ee97525a45bd9871c6372b69214cf Mon Sep 17 00:00:00 2001 From: nfbot Date: Wed, 6 Jan 2021 13:50:31 +0000 Subject: [PATCH 28/51] Bumps nanoFramework.CoreLibrary from 1.10.1-preview.7 to 1.10.1-preview.9 --- System.Device.I2c/System.Device.I2c.nfproj | 4 ++-- System.Device.I2c/packages.config | 2 +- nanoFramework.System.Device.I2c.DELIVERABLES.nuspec | 2 +- nanoFramework.System.Device.I2c.nuspec | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index 582b18f..8228455 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -38,7 +38,7 @@ - + false @@ -57,7 +57,7 @@ - ..\packages\nanoFramework.CoreLibrary.1.10.1-preview.7\lib\mscorlib.dll + ..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll True diff --git a/System.Device.I2c/packages.config b/System.Device.I2c/packages.config index 91fff5f..cca1a4b 100644 --- a/System.Device.I2c/packages.config +++ b/System.Device.I2c/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec index bcdcaaf..a1c8c72 100644 --- a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec +++ b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec @@ -18,7 +18,7 @@ - + diff --git a/nanoFramework.System.Device.I2c.nuspec b/nanoFramework.System.Device.I2c.nuspec index 04df49d..051d823 100644 --- a/nanoFramework.System.Device.I2c.nuspec +++ b/nanoFramework.System.Device.I2c.nuspec @@ -20,7 +20,7 @@ This package requires a target with System.Device.I2c v$nativeVersion$ (checksum System.Device.I2c assembly for .NET nanoFramework C# projects nanoFramework C# csharp netmf netnf System.Device.I2c - + From 939b4d5f7fed848ce33eaeb7077888698d61684b Mon Sep 17 00:00:00 2001 From: nfbot Date: Wed, 6 Jan 2021 13:57:17 +0000 Subject: [PATCH 29/51] Update CHANGELOG for v1.0.1 ***NO_CI*** --- CHANGELOG.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c91a715..c111c76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,15 @@ ## [**Changes available only in 'Preview' NuGet packages:**](https://github.com/nanoframework/lib-System.Device.I2c/tree/HEAD) -[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.13...HEAD) +[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.16...HEAD) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.10.1-preview.7 to 1.10.1-preview.9 [\#17](https://github.com/nanoframework/lib-System.Device.I2c/pull/17) + +## [v1.0.1-preview.16](https://github.com/nanoframework/lib-System.Device.I2c/tree/v1.0.1-preview.16) (2020-12-29) + +[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.13...v1.0.1-preview.16) **Documentation and other chores:** From a435b6a1e2cec2d8e3a758a167aa4d4fada99b03 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Thu, 11 Feb 2021 12:39:44 +0000 Subject: [PATCH 30/51] Update update-dependencies.yml - Update PR github action to v3. ***NO_CI*** --- .github/workflows/update-dependencies.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index a2c2cf3..58a5045 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -35,7 +35,7 @@ jobs: run: ./github-actions/update-nf-dependencies.ps1 working-directory: tools - name: Create Pull Request - uses: peter-evans/create-pull-request@v2.8.1 + uses: peter-evans/create-pull-request@v3 if: env.CREATE_PR == 'true' with: title: '${{ env.PR_TITLE }}' @@ -45,6 +45,8 @@ jobs: [version update] ### :warning: This is an automated update. :warning: - committer: 'nfbot ' + committer: 'nfbot ' branch: ${{ env.BRANCH_NAME }} path: main + labels: | + Type: dependencies From 5e7b8300424fdb609e3d522e0eda441e7d1599d3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 16 Feb 2021 00:12:49 +0000 Subject: [PATCH 31/51] Update 2 nuget dependencies --- System.Device.I2c/System.Device.I2c.nfproj | 28 +++++++++++----------- nanoFramework.System.Device.I2c.sln | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index 8228455..a0203eb 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -1,22 +1,22 @@ - - + + - $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.\ Debug AnyCPU - {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - d74a7890-8a23-417b-ab74-923d57e987ea + {1.8DD76-328B-46DF-9F39-F55991.0360};{FAE04EC0-301.1.3-BF4B-00C04F79EFBC} + d74a7890-8a23-41.-ab74-923d57e987ea Library - 512 + 51./FileAlignment> System.Device.I2c - v1.0 + v1. True - bin\$(Configuration)\System.Device.I2c.xml + bin\$(Configuration)\System.Device.I2c.xml true @@ -38,7 +38,7 @@ - + false @@ -56,8 +56,8 @@ - - ..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + + - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=3221..The missing file is {0}. - + diff --git a/nanoFramework.System.Device.I2c.sln b/nanoFramework.System.Device.I2c.sln index 452f90e..85828c0 100644 --- a/nanoFramework.System.Device.I2c.sln +++ b/nanoFramework.System.Device.I2c.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27130.2010 From d69769ea19c4b92483bd706d905bb37ae45dc102 Mon Sep 17 00:00:00 2001 From: josesimoes Date: Tue, 16 Feb 2021 13:21:49 +0000 Subject: [PATCH 32/51] Revert "Update 2 nuget dependencies" This reverts commit 5e7b8300424fdb609e3d522e0eda441e7d1599d3. ***NO_CI*** --- System.Device.I2c/System.Device.I2c.nfproj | 28 +++++++++++----------- nanoFramework.System.Device.I2c.sln | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index a0203eb..8228455 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -1,22 +1,22 @@ - - + + - $(MSBuildToolsPath)..\..\..\nanoFramework\v1.\ + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ Debug AnyCPU - {1.8DD76-328B-46DF-9F39-F55991.0360};{FAE04EC0-301.1.3-BF4B-00C04F79EFBC} - d74a7890-8a23-41.-ab74-923d57e987ea + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + d74a7890-8a23-417b-ab74-923d57e987ea Library - 51./FileAlignment> + 512 System.Device.I2c - v1. + v1.0 True - bin\$(Configuration)\System.Device.I2c.xml + bin\$(Configuration)\System.Device.I2c.xml true @@ -38,7 +38,7 @@ - + false @@ -56,8 +56,8 @@ - + ..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll True @@ -67,11 +67,11 @@ - + - This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=3221..The missing file is {0}. + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. - + diff --git a/nanoFramework.System.Device.I2c.sln b/nanoFramework.System.Device.I2c.sln index 85828c0..452f90e 100644 --- a/nanoFramework.System.Device.I2c.sln +++ b/nanoFramework.System.Device.I2c.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27130.2010 From 82f54933c7f8ad4b2c3508440bb8e05b90a9c2cb Mon Sep 17 00:00:00 2001 From: nfbot Date: Tue, 2 Mar 2021 12:24:30 +0000 Subject: [PATCH 33/51] Bumps nanoFramework.CoreLibrary from 1.10.1-preview.9 to 1.10.1-preview.11 --- System.Device.I2c/System.Device.I2c.nfproj | 4 ++-- System.Device.I2c/packages.config | 2 +- nanoFramework.System.Device.I2c.DELIVERABLES.nuspec | 2 +- nanoFramework.System.Device.I2c.nuspec | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index 8228455..3f6d3c2 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -38,7 +38,7 @@ - + false @@ -57,7 +57,7 @@ - ..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + ..\packages\nanoFramework.CoreLibrary.1.10.1-preview.11\lib\mscorlib.dll True diff --git a/System.Device.I2c/packages.config b/System.Device.I2c/packages.config index cca1a4b..341b863 100644 --- a/System.Device.I2c/packages.config +++ b/System.Device.I2c/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec index a1c8c72..0aa5617 100644 --- a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec +++ b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec @@ -18,7 +18,7 @@ - + diff --git a/nanoFramework.System.Device.I2c.nuspec b/nanoFramework.System.Device.I2c.nuspec index 051d823..5d032a4 100644 --- a/nanoFramework.System.Device.I2c.nuspec +++ b/nanoFramework.System.Device.I2c.nuspec @@ -20,7 +20,7 @@ This package requires a target with System.Device.I2c v$nativeVersion$ (checksum System.Device.I2c assembly for .NET nanoFramework C# projects nanoFramework C# csharp netmf netnf System.Device.I2c - + From fe25b16213d50f85df626ff611497851f1dae4be Mon Sep 17 00:00:00 2001 From: nfbot Date: Tue, 2 Mar 2021 12:31:45 +0000 Subject: [PATCH 34/51] Update CHANGELOG for v1.0.1 ***NO_CI*** --- CHANGELOG.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c111c76..9fa4886 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,16 @@ ## [**Changes available only in 'Preview' NuGet packages:**](https://github.com/nanoframework/lib-System.Device.I2c/tree/HEAD) -[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.16...HEAD) +[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.18...HEAD) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.10.1-preview.9 to 1.10.1-preview.11 [\#19](https://github.com/nanoframework/lib-System.Device.I2c/pull/19) +- Update 2 nuget dependencies [\#18](https://github.com/nanoframework/lib-System.Device.I2c/pull/18) + +## [v1.0.1-preview.18](https://github.com/nanoframework/lib-System.Device.I2c/tree/v1.0.1-preview.18) (2021-01-06) + +[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.16...v1.0.1-preview.18) **Documentation and other chores:** From b5d88d48b035de9d8975bc5d89eff02dd0f9ec18 Mon Sep 17 00:00:00 2001 From: nfbot Date: Sun, 21 Mar 2021 03:58:19 +0000 Subject: [PATCH 35/51] Bumps nanoFramework.CoreLibrary from 1.10.1-preview.11 to 1.10.3-preview.7 --- System.Device.I2c/System.Device.I2c.nfproj | 6 +++--- System.Device.I2c/packages.config | 2 +- nanoFramework.System.Device.I2c.DELIVERABLES.nuspec | 2 +- nanoFramework.System.Device.I2c.nuspec | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index 3f6d3c2..ab0ef8d 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -38,7 +38,7 @@ - + false @@ -56,8 +56,8 @@ - - ..\packages\nanoFramework.CoreLibrary.1.10.1-preview.11\lib\mscorlib.dll + + ..\packages\nanoFramework.CoreLibrary.1.10.3-preview.7\lib\mscorlib.dll True diff --git a/System.Device.I2c/packages.config b/System.Device.I2c/packages.config index 341b863..664e874 100644 --- a/System.Device.I2c/packages.config +++ b/System.Device.I2c/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec index 0aa5617..8285b07 100644 --- a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec +++ b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec @@ -18,7 +18,7 @@ - + diff --git a/nanoFramework.System.Device.I2c.nuspec b/nanoFramework.System.Device.I2c.nuspec index 5d032a4..31a7240 100644 --- a/nanoFramework.System.Device.I2c.nuspec +++ b/nanoFramework.System.Device.I2c.nuspec @@ -20,7 +20,7 @@ This package requires a target with System.Device.I2c v$nativeVersion$ (checksum System.Device.I2c assembly for .NET nanoFramework C# projects nanoFramework C# csharp netmf netnf System.Device.I2c - + From 37baf8a4cc3393dd0e38284e0de3313de37de9d4 Mon Sep 17 00:00:00 2001 From: nfbot Date: Sun, 21 Mar 2021 04:05:02 +0000 Subject: [PATCH 36/51] Update CHANGELOG for v1.0.1 ***NO_CI*** --- CHANGELOG.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fa4886..24212c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,15 @@ ## [**Changes available only in 'Preview' NuGet packages:**](https://github.com/nanoframework/lib-System.Device.I2c/tree/HEAD) -[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.18...HEAD) +[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.23...HEAD) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.10.1-preview.11 to 1.10.3-preview.7 [\#20](https://github.com/nanoframework/lib-System.Device.I2c/pull/20) + +## [v1.0.1-preview.23](https://github.com/nanoframework/lib-System.Device.I2c/tree/v1.0.1-preview.23) (2021-03-02) + +[Full Changelog](https://github.com/nanoframework/lib-System.Device.I2c/compare/v1.0.1-preview.18...v1.0.1-preview.23) **Documentation and other chores:** From 5e9ad16638413d01b09f4a64b33772076fa407f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Thu, 25 Mar 2021 15:28:31 +0000 Subject: [PATCH 37/51] Work CI-CD ***NO_CI*** --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e4344cf..10f4916 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,6 +1,6 @@ trigger: branches: - include: [master, develop, "release-*" ] + include: [main, develop, "release-*" ] paths: exclude: ["*.md", .gitignore] tags: @@ -25,7 +25,7 @@ variables: buildPlatform: 'Any CPU' buildConfiguration: 'Release' nugetPackageName: 'nanoFramework.System.Device.I2c' - repoName: 'lib-System.Device.I2c' + repoName: 'System.Device.I2c' steps: From 89a6daefd6a78a4266d1932fdcb33848f84aa629 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Mon, 12 Apr 2021 22:00:51 +0100 Subject: [PATCH 38/51] Update version.json ***NO_CI*** --- version.json | 1 + 1 file changed, 1 insertion(+) diff --git a/version.json b/version.json index 87447f5..bd8fce9 100644 --- a/version.json +++ b/version.json @@ -10,6 +10,7 @@ }, "publicReleaseRefSpec": [ "^refs/heads/master$", + "^refs/heads/main$", "^refs/heads/v\\d+(?:\\.\\d+)?$" ], "cloudBuild": { From c5cc9134b01fc5816a66c986eba5ac398b385264 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Tue, 13 Apr 2021 00:11:41 +0100 Subject: [PATCH 39/51] Update version.json ***NO_CI*** --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index bd8fce9..ef0d017 100644 --- a/version.json +++ b/version.json @@ -9,7 +9,7 @@ "semVer": 2.0 }, "publicReleaseRefSpec": [ - "^refs/heads/master$", + "^refs/heads/develop$", "^refs/heads/main$", "^refs/heads/v\\d+(?:\\.\\d+)?$" ], From 741a32a98f0fffa4728e8bd2505018d7240e0730 Mon Sep 17 00:00:00 2001 From: nfbot Date: Tue, 4 May 2021 14:32:19 +0100 Subject: [PATCH 40/51] Bumps nanoFramework.CoreLibrary from 1.10.3-preview.7 to 1.10.3-preview.20 --- System.Device.I2c/System.Device.I2c.nfproj | 4 ++-- System.Device.I2c/packages.config | 2 +- nanoFramework.System.Device.I2c.DELIVERABLES.nuspec | 2 +- nanoFramework.System.Device.I2c.nuspec | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index ab0ef8d..26529bb 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -38,7 +38,7 @@ - + false @@ -57,7 +57,7 @@ - ..\packages\nanoFramework.CoreLibrary.1.10.3-preview.7\lib\mscorlib.dll + ..\packages\nanoFramework.CoreLibrary.1.10.3-preview.20\lib\mscorlib.dll True diff --git a/System.Device.I2c/packages.config b/System.Device.I2c/packages.config index 664e874..6486f1b 100644 --- a/System.Device.I2c/packages.config +++ b/System.Device.I2c/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec index 8285b07..37346bd 100644 --- a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec +++ b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec @@ -18,7 +18,7 @@ - + diff --git a/nanoFramework.System.Device.I2c.nuspec b/nanoFramework.System.Device.I2c.nuspec index 31a7240..3f5d909 100644 --- a/nanoFramework.System.Device.I2c.nuspec +++ b/nanoFramework.System.Device.I2c.nuspec @@ -20,7 +20,7 @@ This package requires a target with System.Device.I2c v$nativeVersion$ (checksum System.Device.I2c assembly for .NET nanoFramework C# projects nanoFramework C# csharp netmf netnf System.Device.I2c - + From bd36de5818499121e502c028d8de304685422e8e Mon Sep 17 00:00:00 2001 From: nfbot Date: Thu, 13 May 2021 15:14:39 +0100 Subject: [PATCH 41/51] Bumps nanoFramework.CoreLibrary from 1.10.3-preview.20 to 1.10.4-preview.4 --- System.Device.I2c/System.Device.I2c.nfproj | 6 +++--- System.Device.I2c/packages.config | 2 +- nanoFramework.System.Device.I2c.DELIVERABLES.nuspec | 2 +- nanoFramework.System.Device.I2c.nuspec | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index 26529bb..e6d1be2 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -38,7 +38,7 @@ - + false @@ -56,8 +56,8 @@ - - ..\packages\nanoFramework.CoreLibrary.1.10.3-preview.20\lib\mscorlib.dll + + ..\packages\nanoFramework.CoreLibrary.1.10.4-preview.4\lib\mscorlib.dll True diff --git a/System.Device.I2c/packages.config b/System.Device.I2c/packages.config index 6486f1b..a5c25ad 100644 --- a/System.Device.I2c/packages.config +++ b/System.Device.I2c/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec index 37346bd..2ed7093 100644 --- a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec +++ b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec @@ -18,7 +18,7 @@ - + diff --git a/nanoFramework.System.Device.I2c.nuspec b/nanoFramework.System.Device.I2c.nuspec index 3f5d909..b1dcbfd 100644 --- a/nanoFramework.System.Device.I2c.nuspec +++ b/nanoFramework.System.Device.I2c.nuspec @@ -20,7 +20,7 @@ This package requires a target with System.Device.I2c v$nativeVersion$ (checksum System.Device.I2c assembly for .NET nanoFramework C# projects nanoFramework C# csharp netmf netnf System.Device.I2c - + From 0898b004ad1cf7184b2e1a081f78b9370193c110 Mon Sep 17 00:00:00 2001 From: nfbot Date: Wed, 19 May 2021 10:10:59 +0100 Subject: [PATCH 42/51] Bumps nanoFramework.CoreLibrary from 1.10.4-preview.4 to 1.10.4-preview.6 --- System.Device.I2c/System.Device.I2c.nfproj | 4 ++-- System.Device.I2c/packages.config | 2 +- nanoFramework.System.Device.I2c.DELIVERABLES.nuspec | 2 +- nanoFramework.System.Device.I2c.nuspec | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index e6d1be2..efff84a 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -38,7 +38,7 @@ - + false @@ -57,7 +57,7 @@ - ..\packages\nanoFramework.CoreLibrary.1.10.4-preview.4\lib\mscorlib.dll + ..\packages\nanoFramework.CoreLibrary.1.10.4-preview.6\lib\mscorlib.dll True diff --git a/System.Device.I2c/packages.config b/System.Device.I2c/packages.config index a5c25ad..9326e86 100644 --- a/System.Device.I2c/packages.config +++ b/System.Device.I2c/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec index 2ed7093..879c493 100644 --- a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec +++ b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec @@ -18,7 +18,7 @@ - + diff --git a/nanoFramework.System.Device.I2c.nuspec b/nanoFramework.System.Device.I2c.nuspec index b1dcbfd..a8647fd 100644 --- a/nanoFramework.System.Device.I2c.nuspec +++ b/nanoFramework.System.Device.I2c.nuspec @@ -20,7 +20,7 @@ This package requires a target with System.Device.I2c v$nativeVersion$ (checksum System.Device.I2c assembly for .NET nanoFramework C# projects nanoFramework C# csharp netmf netnf System.Device.I2c - + From 5cbad02cdb162c308e5cb6c85453534737f2ef43 Mon Sep 17 00:00:00 2001 From: nfbot Date: Wed, 19 May 2021 12:05:39 +0100 Subject: [PATCH 43/51] Bumps nanoFramework.CoreLibrary from 1.10.4-preview.6 to 1.10.4-preview.11 --- System.Device.I2c/System.Device.I2c.nfproj | 4 ++-- System.Device.I2c/packages.config | 2 +- nanoFramework.System.Device.I2c.DELIVERABLES.nuspec | 2 +- nanoFramework.System.Device.I2c.nuspec | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index efff84a..39e1c0e 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -38,7 +38,7 @@ - + false @@ -57,7 +57,7 @@ - ..\packages\nanoFramework.CoreLibrary.1.10.4-preview.6\lib\mscorlib.dll + ..\packages\nanoFramework.CoreLibrary.1.10.4-preview.11\lib\mscorlib.dll True diff --git a/System.Device.I2c/packages.config b/System.Device.I2c/packages.config index 9326e86..c4958a2 100644 --- a/System.Device.I2c/packages.config +++ b/System.Device.I2c/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec index 879c493..3e4831f 100644 --- a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec +++ b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec @@ -18,7 +18,7 @@ - + diff --git a/nanoFramework.System.Device.I2c.nuspec b/nanoFramework.System.Device.I2c.nuspec index a8647fd..51e7c78 100644 --- a/nanoFramework.System.Device.I2c.nuspec +++ b/nanoFramework.System.Device.I2c.nuspec @@ -20,7 +20,7 @@ This package requires a target with System.Device.I2c v$nativeVersion$ (checksum System.Device.I2c assembly for .NET nanoFramework C# projects nanoFramework C# csharp netmf netnf System.Device.I2c - + From b912e5780dbc94da5d7e222865c6d13a63b5832b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 30 May 2021 01:15:43 +0100 Subject: [PATCH 44/51] Update 1 nuget dependencies --- System.Device.I2c/System.Device.I2c.nfproj | 8 ++++---- System.Device.I2c/packages.config | 2 +- nanoFramework.System.Device.I2c.DELIVERABLES.nuspec | 2 +- nanoFramework.System.Device.I2c.nuspec | 2 +- nanoFramework.System.Device.I2c.sln | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index 39e1c0e..7af649f 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -1,4 +1,4 @@ - + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ @@ -38,7 +38,7 @@ - + false @@ -56,8 +56,8 @@ - - ..\packages\nanoFramework.CoreLibrary.1.10.4-preview.11\lib\mscorlib.dll + + ..\packages\nanoFramework.CoreLibrary.1.10.5-alpha.145.6\lib\mscorlib.dll True diff --git a/System.Device.I2c/packages.config b/System.Device.I2c/packages.config index c4958a2..071a607 100644 --- a/System.Device.I2c/packages.config +++ b/System.Device.I2c/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec index 3e4831f..ee7098b 100644 --- a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec +++ b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec @@ -18,7 +18,7 @@ - + diff --git a/nanoFramework.System.Device.I2c.nuspec b/nanoFramework.System.Device.I2c.nuspec index 51e7c78..f759dad 100644 --- a/nanoFramework.System.Device.I2c.nuspec +++ b/nanoFramework.System.Device.I2c.nuspec @@ -20,7 +20,7 @@ This package requires a target with System.Device.I2c v$nativeVersion$ (checksum System.Device.I2c assembly for .NET nanoFramework C# projects nanoFramework C# csharp netmf netnf System.Device.I2c - + diff --git a/nanoFramework.System.Device.I2c.sln b/nanoFramework.System.Device.I2c.sln index 452f90e..85828c0 100644 --- a/nanoFramework.System.Device.I2c.sln +++ b/nanoFramework.System.Device.I2c.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27130.2010 From 4a20ea2f6600a0b6fcb0787016ae8137add8294a Mon Sep 17 00:00:00 2001 From: nfbot Date: Mon, 31 May 2021 19:26:54 +0100 Subject: [PATCH 45/51] Bumps nanoFramework.CoreLibrary from 1.10.5-alpha.145.6 to 1.10.5-preview.4 --- System.Device.I2c/System.Device.I2c.nfproj | 6 +++--- System.Device.I2c/packages.config | 2 +- nanoFramework.System.Device.I2c.DELIVERABLES.nuspec | 2 +- nanoFramework.System.Device.I2c.nuspec | 2 +- nanoFramework.System.Device.I2c.sln | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index 7af649f..a7d4c0f 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -1,4 +1,4 @@ - + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ @@ -38,7 +38,7 @@ - + false @@ -57,7 +57,7 @@ - ..\packages\nanoFramework.CoreLibrary.1.10.5-alpha.145.6\lib\mscorlib.dll + ..\packages\nanoFramework.CoreLibrary.1.10.5-preview.4\lib\mscorlib.dll True diff --git a/System.Device.I2c/packages.config b/System.Device.I2c/packages.config index 071a607..1fc28f4 100644 --- a/System.Device.I2c/packages.config +++ b/System.Device.I2c/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec index ee7098b..0b0de14 100644 --- a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec +++ b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec @@ -18,7 +18,7 @@ - + diff --git a/nanoFramework.System.Device.I2c.nuspec b/nanoFramework.System.Device.I2c.nuspec index f759dad..65f5936 100644 --- a/nanoFramework.System.Device.I2c.nuspec +++ b/nanoFramework.System.Device.I2c.nuspec @@ -20,7 +20,7 @@ This package requires a target with System.Device.I2c v$nativeVersion$ (checksum System.Device.I2c assembly for .NET nanoFramework C# projects nanoFramework C# csharp netmf netnf System.Device.I2c - + diff --git a/nanoFramework.System.Device.I2c.sln b/nanoFramework.System.Device.I2c.sln index 85828c0..452f90e 100644 --- a/nanoFramework.System.Device.I2c.sln +++ b/nanoFramework.System.Device.I2c.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27130.2010 From cf146dfd0f1155e6e5388514d92efac372e68f4f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 6 Jun 2021 13:04:32 +0100 Subject: [PATCH 46/51] Update 1 nuget dependencies (#31) Bumps nanoFramework.CoreLibrary from 1.10.5-preview.4 to 1.10.5-preview.10 --- System.Device.I2c/System.Device.I2c.nfproj | 6 +++--- System.Device.I2c/packages.config | 2 +- nanoFramework.System.Device.I2c.DELIVERABLES.nuspec | 2 +- nanoFramework.System.Device.I2c.nuspec | 2 +- nanoFramework.System.Device.I2c.sln | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index a7d4c0f..85ad4dc 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -1,4 +1,4 @@ - + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ @@ -38,7 +38,7 @@ - + false @@ -57,7 +57,7 @@ - ..\packages\nanoFramework.CoreLibrary.1.10.5-preview.4\lib\mscorlib.dll + ..\packages\nanoFramework.CoreLibrary.1.10.5-preview.10\lib\mscorlib.dll True diff --git a/System.Device.I2c/packages.config b/System.Device.I2c/packages.config index 1fc28f4..e0a3575 100644 --- a/System.Device.I2c/packages.config +++ b/System.Device.I2c/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec index 0b0de14..810681c 100644 --- a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec +++ b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec @@ -18,7 +18,7 @@ - + diff --git a/nanoFramework.System.Device.I2c.nuspec b/nanoFramework.System.Device.I2c.nuspec index 65f5936..058d680 100644 --- a/nanoFramework.System.Device.I2c.nuspec +++ b/nanoFramework.System.Device.I2c.nuspec @@ -20,7 +20,7 @@ This package requires a target with System.Device.I2c v$nativeVersion$ (checksum System.Device.I2c assembly for .NET nanoFramework C# projects nanoFramework C# csharp netmf netnf System.Device.I2c - + diff --git a/nanoFramework.System.Device.I2c.sln b/nanoFramework.System.Device.I2c.sln index 452f90e..85828c0 100644 --- a/nanoFramework.System.Device.I2c.sln +++ b/nanoFramework.System.Device.I2c.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27130.2010 From 40a88d6ffb53b46c37fc19f0fcf6e0e1fa388030 Mon Sep 17 00:00:00 2001 From: nfbot Date: Mon, 7 Jun 2021 19:48:11 +0100 Subject: [PATCH 47/51] Bumps nanoFramework.CoreLibrary from 1.10.5-preview.10 to 1.10.5-preview.13 --- System.Device.I2c/System.Device.I2c.nfproj | 6 +++--- System.Device.I2c/packages.config | 2 +- nanoFramework.System.Device.I2c.DELIVERABLES.nuspec | 2 +- nanoFramework.System.Device.I2c.nuspec | 2 +- nanoFramework.System.Device.I2c.sln | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index 85ad4dc..56d3f3c 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -1,4 +1,4 @@ - + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ @@ -38,7 +38,7 @@ - + false @@ -57,7 +57,7 @@ - ..\packages\nanoFramework.CoreLibrary.1.10.5-preview.10\lib\mscorlib.dll + ..\packages\nanoFramework.CoreLibrary.1.10.5-preview.13\lib\mscorlib.dll True diff --git a/System.Device.I2c/packages.config b/System.Device.I2c/packages.config index e0a3575..617a92d 100644 --- a/System.Device.I2c/packages.config +++ b/System.Device.I2c/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec index 810681c..7cc22db 100644 --- a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec +++ b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec @@ -18,7 +18,7 @@ - + diff --git a/nanoFramework.System.Device.I2c.nuspec b/nanoFramework.System.Device.I2c.nuspec index 058d680..7b66288 100644 --- a/nanoFramework.System.Device.I2c.nuspec +++ b/nanoFramework.System.Device.I2c.nuspec @@ -20,7 +20,7 @@ This package requires a target with System.Device.I2c v$nativeVersion$ (checksum System.Device.I2c assembly for .NET nanoFramework C# projects nanoFramework C# csharp netmf netnf System.Device.I2c - + diff --git a/nanoFramework.System.Device.I2c.sln b/nanoFramework.System.Device.I2c.sln index 85828c0..452f90e 100644 --- a/nanoFramework.System.Device.I2c.sln +++ b/nanoFramework.System.Device.I2c.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27130.2010 From 526012f556b25acfe66eb3a18e53dd1a0d78dff7 Mon Sep 17 00:00:00 2001 From: nfbot Date: Sat, 19 Jun 2021 08:47:34 +0100 Subject: [PATCH 48/51] Bumps nanoFramework.CoreLibrary from 1.10.5-preview.13 to 1.10.5-preview.18 --- System.Device.I2c/System.Device.I2c.nfproj | 4 ++-- System.Device.I2c/packages.config | 2 +- nanoFramework.System.Device.I2c.DELIVERABLES.nuspec | 2 +- nanoFramework.System.Device.I2c.nuspec | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index 56d3f3c..c2d47aa 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -38,7 +38,7 @@ - + false @@ -57,7 +57,7 @@ - ..\packages\nanoFramework.CoreLibrary.1.10.5-preview.13\lib\mscorlib.dll + ..\packages\nanoFramework.CoreLibrary.1.10.5-preview.18\lib\mscorlib.dll True diff --git a/System.Device.I2c/packages.config b/System.Device.I2c/packages.config index 617a92d..d3cc616 100644 --- a/System.Device.I2c/packages.config +++ b/System.Device.I2c/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec index 7cc22db..4792922 100644 --- a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec +++ b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec @@ -18,7 +18,7 @@ - + diff --git a/nanoFramework.System.Device.I2c.nuspec b/nanoFramework.System.Device.I2c.nuspec index 7b66288..4e19dec 100644 --- a/nanoFramework.System.Device.I2c.nuspec +++ b/nanoFramework.System.Device.I2c.nuspec @@ -20,7 +20,7 @@ This package requires a target with System.Device.I2c v$nativeVersion$ (checksum System.Device.I2c assembly for .NET nanoFramework C# projects nanoFramework C# csharp netmf netnf System.Device.I2c - + From 939d81107d3f1e695b96506041e9e6820f93af97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Tue, 6 Jul 2021 07:05:47 +0100 Subject: [PATCH 49/51] Fix reference to mscorlib --- System.Device.I2c/System.Device.I2c.nfproj | 1 + 1 file changed, 1 insertion(+) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index c2d47aa..ced875d 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -59,6 +59,7 @@ ..\packages\nanoFramework.CoreLibrary.1.10.5-preview.18\lib\mscorlib.dll True + True From 50cb2a9f0274bcb96383aeff4b56601ef63ec671 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 14 Jul 2021 01:07:01 +0100 Subject: [PATCH 50/51] Update 1 nuget dependencies --- System.Device.I2c/System.Device.I2c.nfproj | 9 ++++----- System.Device.I2c/packages.config | 2 +- nanoFramework.System.Device.I2c.DELIVERABLES.nuspec | 2 +- nanoFramework.System.Device.I2c.nuspec | 2 +- nanoFramework.System.Device.I2c.sln | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/System.Device.I2c/System.Device.I2c.nfproj b/System.Device.I2c/System.Device.I2c.nfproj index ced875d..07f4b7e 100644 --- a/System.Device.I2c/System.Device.I2c.nfproj +++ b/System.Device.I2c/System.Device.I2c.nfproj @@ -1,4 +1,4 @@ - + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ @@ -38,7 +38,7 @@ - + false @@ -56,10 +56,9 @@ - - ..\packages\nanoFramework.CoreLibrary.1.10.5-preview.18\lib\mscorlib.dll + + ..\packages\nanoFramework.CoreLibrary.1.10.5\lib\mscorlib.dll True - True diff --git a/System.Device.I2c/packages.config b/System.Device.I2c/packages.config index d3cc616..32546da 100644 --- a/System.Device.I2c/packages.config +++ b/System.Device.I2c/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec index 4792922..b716df7 100644 --- a/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec +++ b/nanoFramework.System.Device.I2c.DELIVERABLES.nuspec @@ -18,7 +18,7 @@ - + diff --git a/nanoFramework.System.Device.I2c.nuspec b/nanoFramework.System.Device.I2c.nuspec index 4e19dec..ebfd026 100644 --- a/nanoFramework.System.Device.I2c.nuspec +++ b/nanoFramework.System.Device.I2c.nuspec @@ -20,7 +20,7 @@ This package requires a target with System.Device.I2c v$nativeVersion$ (checksum System.Device.I2c assembly for .NET nanoFramework C# projects nanoFramework C# csharp netmf netnf System.Device.I2c - + diff --git a/nanoFramework.System.Device.I2c.sln b/nanoFramework.System.Device.I2c.sln index 452f90e..85828c0 100644 --- a/nanoFramework.System.Device.I2c.sln +++ b/nanoFramework.System.Device.I2c.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27130.2010 From 4dec051f4f33886104381fc7cd69e5a2ab3853a0 Mon Sep 17 00:00:00 2001 From: nfbot Date: Fri, 16 Jul 2021 14:52:35 +0000 Subject: [PATCH 51/51] Set version to '1.0.1' --- version.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.json b/version.json index ef0d017..45a1e0c 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.0.1-preview.{height}", + "version": "1.0.1", "assemblyVersion": { "precision": "revision" }, @@ -22,4 +22,4 @@ "versionIncrement": "build", "firstUnstableTag": "preview" } -} +} \ No newline at end of file