From 902fdd9b25affda617f7b0ccc6940a30c304bbda Mon Sep 17 00:00:00 2001 From: BlubbFish Date: Sun, 8 Dec 2019 11:43:12 +0100 Subject: [PATCH] Fix nullable --- .../Definitions.cs | 6 +- .../IGpioController.cs | 82 +++++++++---------- Unosquare.RaspberryIO.Abstractions/II2CBus.cs | 4 +- .../Native/HardwareException.cs | 2 + .../Native/Standard.cs | 2 +- .../Unosquare.RaspberryIO.Abstractions.csproj | 1 - 6 files changed, 51 insertions(+), 46 deletions(-) diff --git a/Unosquare.RaspberryIO.Abstractions/Definitions.cs b/Unosquare.RaspberryIO.Abstractions/Definitions.cs index ba537e8..000cb00 100644 --- a/Unosquare.RaspberryIO.Abstractions/Definitions.cs +++ b/Unosquare.RaspberryIO.Abstractions/Definitions.cs @@ -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 + }; /// /// BCMs to physical pin number. diff --git a/Unosquare.RaspberryIO.Abstractions/IGpioController.cs b/Unosquare.RaspberryIO.Abstractions/IGpioController.cs index 95e8fb0..f78c737 100644 --- a/Unosquare.RaspberryIO.Abstractions/IGpioController.cs +++ b/Unosquare.RaspberryIO.Abstractions/IGpioController.cs @@ -6,45 +6,45 @@ namespace Unosquare.RaspberryIO.Abstractions { /// Interface for Raspberry Pi GPIO controller. /// /// - public interface IGpioController : IReadOnlyCollection { - /// - /// Gets the with the specified BCM pin. - /// - /// - /// The . - /// - /// The BCM pin number. - /// A reference to the GPIO pin. - IGpioPin this[Int32 bcmPinNumber] { get; } - - /// - /// Gets the with the specified BCM pin. - /// - /// - /// The . - /// - /// The BCM pin. - /// A reference to the GPIO pin. - IGpioPin this[BcmPin bcmPin] { get; } - - /// - /// Gets the with the specified pin number. - /// - /// - /// The . - /// - /// The pin number in header P1. - /// A reference to the GPIO pin. - IGpioPin this[P1 pinNumber] { get; } - - /// - /// Gets the with the specified pin number. - /// - /// - /// The . - /// - /// The pin number in header P5. - /// A reference to the GPIO pin. - IGpioPin this[P5 pinNumber] { get; } - } + public interface IGpioController : IReadOnlyCollection { + /// + /// Gets the with the specified BCM pin. + /// + /// + /// The . + /// + /// The BCM pin number. + /// A reference to the GPIO pin. + IGpioPin this[Int32 bcmPinNumber] { get; } + + /// + /// Gets the with the specified BCM pin. + /// + /// + /// The . + /// + /// The BCM pin. + /// A reference to the GPIO pin. + IGpioPin this[BcmPin bcmPin] { get; } + + /// + /// Gets the with the specified pin number. + /// + /// + /// The . + /// + /// The pin number in header P1. + /// A reference to the GPIO pin. + IGpioPin this[P1 pinNumber] { get; } + + /// + /// Gets the with the specified pin number. + /// + /// + /// The . + /// + /// The pin number in header P5. + /// A reference to the GPIO pin. + IGpioPin this[P5 pinNumber] { get; } + } } diff --git a/Unosquare.RaspberryIO.Abstractions/II2CBus.cs b/Unosquare.RaspberryIO.Abstractions/II2CBus.cs index 4de8ec8..9de57c5 100644 --- a/Unosquare.RaspberryIO.Abstractions/II2CBus.cs +++ b/Unosquare.RaspberryIO.Abstractions/II2CBus.cs @@ -1,6 +1,6 @@ using System; -using System.Collections.ObjectModel; - +using System.Collections.ObjectModel; + namespace Unosquare.RaspberryIO.Abstractions { /// /// Interfaces the I2c bus on the Raspberry Pi. diff --git a/Unosquare.RaspberryIO.Abstractions/Native/HardwareException.cs b/Unosquare.RaspberryIO.Abstractions/Native/HardwareException.cs index ef80274..cb89cfe 100644 --- a/Unosquare.RaspberryIO.Abstractions/Native/HardwareException.cs +++ b/Unosquare.RaspberryIO.Abstractions/Native/HardwareException.cs @@ -1,3 +1,5 @@ +#nullable enable + using System; using System.Runtime.InteropServices; diff --git a/Unosquare.RaspberryIO.Abstractions/Native/Standard.cs b/Unosquare.RaspberryIO.Abstractions/Native/Standard.cs index 0fc7516..fa2c349 100644 --- a/Unosquare.RaspberryIO.Abstractions/Native/Standard.cs +++ b/Unosquare.RaspberryIO.Abstractions/Native/Standard.cs @@ -16,7 +16,7 @@ namespace Unosquare.RaspberryIO.Abstractions.Native { /// /// The error. /// The error string. - public static String? Strerror(Int32 error) { + public static String Strerror(Int32 error) { if(Type.GetType("Mono.Runtime") == null) { return Marshal.PtrToStringAnsi(StrError(error)); } diff --git a/Unosquare.RaspberryIO.Abstractions/Unosquare.RaspberryIO.Abstractions.csproj b/Unosquare.RaspberryIO.Abstractions/Unosquare.RaspberryIO.Abstractions.csproj index fa41119..fd82b8c 100644 --- a/Unosquare.RaspberryIO.Abstractions/Unosquare.RaspberryIO.Abstractions.csproj +++ b/Unosquare.RaspberryIO.Abstractions/Unosquare.RaspberryIO.Abstractions.csproj @@ -16,7 +16,6 @@ This library enables developers to use the various Raspberry Pi's hardware modul https://raw.githubusercontent.com/unosquare/raspberryio/master/LICENSE Raspberry Pi GPIO Camera SPI I2C Embedded IoT Mono C# .NET 8.0 - enable