/// <summary> /// Attempt to get the best applicable driver for the board the program is executing on. /// </summary> /// <returns>A driver that works with the board the program is executing on.</returns> private static GpioDriver GetBestDriverForBoardOnLinux() { RaspberryPi3LinuxDriver internalDriver = RaspberryPi3Driver.CreateInternalRaspberryPi3LinuxDriver(out _); if (internalDriver != null) { return(new RaspberryPi3Driver(internalDriver)); } return(UnixDriver.Create()); }
internal RaspberryPi3Driver(RaspberryPi3LinuxDriver linuxDriver) { if (Environment.OSVersion.Platform == PlatformID.Unix) { _linuxDriver = linuxDriver; _setSetRegister = (value) => linuxDriver.SetRegister = value; _setClearRegister = (value) => linuxDriver.ClearRegister = value; _getSetRegister = () => linuxDriver.SetRegister; _getClearRegister = () => linuxDriver.ClearRegister; _internalDriver = linuxDriver; } else { throw new NotSupportedException("This ctor is for internal use only"); } }