public bool Start() { Console.WriteLine("starting pwm"); if (_working) { return(false); } if (_pinObject != null) { if (_pinObject.Pin != Pin) { if (!_pinObject.IsDisposed) { _pinObject.Dispose(); } _pinObject = new GPIOFile(Pin, GPIODirection.Out); } } else { _pinObject = new GPIOFile(Pin, GPIODirection.Out); } _working = true; new Thread(LoopMethod).Start(); return(true); }
private void Dispose(bool disposing) { if (!_disposed) { _rsPort.Dispose(); _rwPort.Dispose(); _enablePort.Dispose(); for (int i = 0; i < 8; i++) { if (_dataPorts[i] != null) { _dataPorts[i].Dispose(); } } _disposed = true; } if (disposing) { GC.SuppressFinalize(this); } }