提交 7f1d77b1 编写于 作者: G Greg Ingram 提交者: Jose Perez Rodriguez

Added new I2cController and related support (#505)

* Added new I2cController and related support

* Add bus ID as part of way to manage devices

* Made static

* Removed static

* Removed interop file and add partial class for controller

* Changed to open/close device methods

* Added TryGetDevice method

* Added ShouldDispose property

* Added more support for disposing

* Enabled nullable in file to check builds

* Missed the other file for enabling nullable

* Added GetDevices and updated OpenDevice check

* Updated to ConcurrentDictionary

* Consolidated to only Create I2cDevice

* Removed unused files

* Removed until direction is determined

* Moved Create under I2cDevice classes
上级 e53c0b4a
// 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
{
public partial class I2cDevice
{
/// <summary>
/// Creates a communications channel to a device on an I2C bus running on Unix.
/// </summary>
/// <param name="settings">The connection settings of a device on an I2C bus.</param>
/// <returns>A communications channel to a device on an I2C bus running on Unix.</returns>
public static I2cDevice Create(I2cConnectionSettings settings) => new Drivers.UnixI2cDevice(settings);
}
}
// 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
{
public partial class I2cDevice
{
/// <summary>
/// Creates a communications channel to a device on an I2C bus running on Windows 10 IoT.
/// </summary>
/// <param name="settings">The connection settings of a device on an I2C bus.</param>
/// <returns>A communications channel to a device on an I2C bus running on Windows 10 IoT.</returns>
public static I2cDevice Create(I2cConnectionSettings settings) => new Drivers.Windows10I2cDevice(settings);
}
}
......@@ -7,7 +7,7 @@ namespace System.Device.I2c
/// <summary>
/// The communications channel to a device on an I2C bus.
/// </summary>
public abstract class I2cDevice : IDisposable
public abstract partial class I2cDevice : IDisposable
{
/// <summary>
/// The connection settings of a device on an I2C bus.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册