Fix nullable

This commit is contained in:
BlubbFish 2019-12-08 11:43:12 +01:00
parent b469c4ed6e
commit 902fdd9b25
6 changed files with 51 additions and 46 deletions

View File

@ -7,7 +7,11 @@ namespace Unosquare.RaspberryIO.Abstractions {
public static class Definitions {
private static readonly Int32[] GpioToPhysR1 = { 3, 5, -1, -1, 7, -1, -1, 26, 24, 21, 19, 23, -1, -1, 8, 10, -1, 11, 12, -1, -1, 13, 15, 16, 18, 22, -1, -1, -1, -1, -1, -1 };
private static readonly Int32[] GpioToPhysR2 = { 27, 28, 3, 5, 7, 29, 31, 26, 24, 21, 19, 23, 32, 33, 8, 10, 36, 11, 12, 35, 38, 40, 15, 16, 18, 22, 37, 13, /*P1*/ 3, 4, 5, 6 /*P5*/ };
private static readonly Int32[] GpioToPhysR2 =
{
27, 28, 3, 5, 7, 29, 31, 26, 24, 21, 19, 23, 32, 33, 8, 10, 36, 11, 12, 35, 38, 40, 15, 16, 18, 22, 37, 13, // P1
3, 4, 5, 6, // P5
};
/// <summary>
/// BCMs to physical pin number.

View File

@ -6,45 +6,45 @@ namespace Unosquare.RaspberryIO.Abstractions {
/// Interface for Raspberry Pi GPIO controller.
/// </summary>
/// <seealso cref="System.Collections.Generic.IReadOnlyCollection{IGpioPin}" />
public interface IGpioController : IReadOnlyCollection<IGpioPin> {
/// <summary>
/// Gets the <see cref="IGpioPin"/> with the specified BCM pin.
/// </summary>
/// <value>
/// The <see cref="IGpioPin"/>.
/// </value>
/// <param name="bcmPinNumber">The BCM pin number.</param>
/// <returns>A reference to the GPIO pin.</returns>
IGpioPin this[Int32 bcmPinNumber] { get; }
/// <summary>
/// Gets the <see cref="IGpioPin"/> with the specified BCM pin.
/// </summary>
/// <value>
/// The <see cref="IGpioPin"/>.
/// </value>
/// <param name="bcmPin">The BCM pin.</param>
/// <returns>A reference to the GPIO pin.</returns>
IGpioPin this[BcmPin bcmPin] { get; }
/// <summary>
/// Gets the <see cref="IGpioPin"/> with the specified pin number.
/// </summary>
/// <value>
/// The <see cref="IGpioPin"/>.
/// </value>
/// <param name="pinNumber">The pin number in header P1.</param>
/// <returns>A reference to the GPIO pin.</returns>
IGpioPin this[P1 pinNumber] { get; }
/// <summary>
/// Gets the <see cref="IGpioPin"/> with the specified pin number.
/// </summary>
/// <value>
/// The <see cref="IGpioPin"/>.
/// </value>
/// <param name="pinNumber">The pin number in header P5.</param>
/// <returns>A reference to the GPIO pin.</returns>
IGpioPin this[P5 pinNumber] { get; }
}
public interface IGpioController : IReadOnlyCollection<IGpioPin> {
/// <summary>
/// Gets the <see cref="IGpioPin"/> with the specified BCM pin.
/// </summary>
/// <value>
/// The <see cref="IGpioPin"/>.
/// </value>
/// <param name="bcmPinNumber">The BCM pin number.</param>
/// <returns>A reference to the GPIO pin.</returns>
IGpioPin this[Int32 bcmPinNumber] { get; }
/// <summary>
/// Gets the <see cref="IGpioPin"/> with the specified BCM pin.
/// </summary>
/// <value>
/// The <see cref="IGpioPin"/>.
/// </value>
/// <param name="bcmPin">The BCM pin.</param>
/// <returns>A reference to the GPIO pin.</returns>
IGpioPin this[BcmPin bcmPin] { get; }
/// <summary>
/// Gets the <see cref="IGpioPin"/> with the specified pin number.
/// </summary>
/// <value>
/// The <see cref="IGpioPin"/>.
/// </value>
/// <param name="pinNumber">The pin number in header P1.</param>
/// <returns>A reference to the GPIO pin.</returns>
IGpioPin this[P1 pinNumber] { get; }
/// <summary>
/// Gets the <see cref="IGpioPin"/> with the specified pin number.
/// </summary>
/// <value>
/// The <see cref="IGpioPin"/>.
/// </value>
/// <param name="pinNumber">The pin number in header P5.</param>
/// <returns>A reference to the GPIO pin.</returns>
IGpioPin this[P5 pinNumber] { get; }
}
}

View File

@ -1,6 +1,6 @@
using System;
using System.Collections.ObjectModel;
using System.Collections.ObjectModel;
namespace Unosquare.RaspberryIO.Abstractions {
/// <summary>
/// Interfaces the I2c bus on the Raspberry Pi.

View File

@ -1,3 +1,5 @@
#nullable enable
using System;
using System.Runtime.InteropServices;

View File

@ -16,7 +16,7 @@ namespace Unosquare.RaspberryIO.Abstractions.Native {
/// </summary>
/// <param name="error">The error.</param>
/// <returns>The error string.</returns>
public static String? Strerror(Int32 error) {
public static String Strerror(Int32 error) {
if(Type.GetType("Mono.Runtime") == null) {
return Marshal.PtrToStringAnsi(StrError(error));
}

View File

@ -16,7 +16,6 @@ This library enables developers to use the various Raspberry Pi's hardware modul
<PackageLicenseUrl>https://raw.githubusercontent.com/unosquare/raspberryio/master/LICENSE</PackageLicenseUrl>
<PackageTags>Raspberry Pi GPIO Camera SPI I2C Embedded IoT Mono C# .NET</PackageTags>
<LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>