public void Dispose() { if (_gpioController != null) { _gpioController.Dispose(); _gpioController = null; } if (_driver != null) { _driver.Dispose(); _driver = null; } }
public static async Task <Star> Create(IPEndPoint endpoint) { var driver = new Iot.Device.Pigpio.Driver(endpoint); await driver.ConnectAsync(); // Line above doesn't current wait for connection so // delay here to give the socket time to get connected await Task.Delay(TimeSpan.FromSeconds(2)); var gpioController = new System.Device.Gpio.GpioController(System.Device.Gpio.PinNumberingScheme.Logical, driver); foreach (int pin in PinMapping) { gpioController.OpenPin(pin); gpioController.SetPinMode(pin, System.Device.Gpio.PinMode.Output); } return(new Star(driver, gpioController)); }
private Star(Iot.Device.Pigpio.Driver driver, System.Device.Gpio.GpioController gpioController) { _driver = driver; _gpioController = gpioController; }