RaspberryIO_26/Unosquare.RaspberryIO.Abstractions/II2CBus.cs

41 lines
1.3 KiB
C#
Raw Normal View History

2019-12-06 22:24:34 +01:00
using System;
using System.Collections.ObjectModel;
namespace Unosquare.RaspberryIO.Abstractions {
/// <summary>
/// Interfaces the I2c bus on the Raspberry Pi.
/// </summary>
public interface II2CBus {
2019-12-04 18:57:18 +01:00
/// <summary>
2019-12-06 22:24:34 +01:00
/// Gets the registered devices as a read only collection.
2019-12-04 18:57:18 +01:00
/// </summary>
2019-12-06 22:24:34 +01:00
ReadOnlyCollection<II2CDevice> Devices {
get;
}
/// <summary>
/// Gets the <see cref="II2CDevice"/> with the specified device identifier.
/// </summary>
/// <value>
/// The <see cref="II2CDevice"/>.
/// </value>
/// <param name="deviceId">The device identifier.</param>
/// <returns>A reference to an I2C device.</returns>
II2CDevice this[Int32 deviceId] { get; }
/// <summary>
/// Gets the device by identifier.
/// </summary>
/// <param name="deviceId">The device identifier.</param>
/// <returns>The device reference.</returns>
II2CDevice GetDeviceById(Int32 deviceId);
/// <summary>
/// Adds a device to the bus by its Id. If the device is already registered it simply returns the existing device.
/// </summary>
/// <param name="deviceId">The device identifier.</param>
/// <returns>The device reference.</returns>
II2CDevice AddDevice(Int32 deviceId);
}
2019-12-04 18:57:18 +01:00
}