public GpioStatus InitializeGpios() { if (Gpios != null && GpioPins != null) { for (int i = 0; i < GpioPins.Count(); i++) { Gpios.Add(InitGpioOutput(GpioPins[i])); if (Gpios[i] == null) { return(GpioStatus.NoPin); } } } return(GpioStatus.Success); }
public Hardware(Int32[] pins) { if (GpioPins == null) { GpioPins = pins == null ? new List <int>() : new List <int>(pins); Gpios = new List <GpioPin>(); } else { if (pins != null) { foreach (var pin in pins) { GpioPins.Add(pin); Gpios.Add(InitGpioOutput(pin)); } } } }
public async Task <bool> InitializeGpioController() { var devicefamily = GetForCurrentView().QualifierValues["DeviceFamily"]; if (devicefamily != "Universal") { return(false); } if (gpiocontroller == null) { gpiocontroller = GpioController.GetDefault(); } if (gpiocontroller == null) { if (Gpios != null) { for (int i = 0; i < Gpios.Count(); i++) { Gpios[i] = null; } } Status = GpioStatus.NoGPIO; } else { Status = GpioStatus.Initialized; await Task.Delay(200); Status = InitializeGpios(); await Task.Delay(200); } return(true); }