protected override void Dispose(bool disposing = true) { _relay.Write(false); _relay.Dispose(); SetSocketPowerState(false); base.Dispose(disposing); }
/// <summary> /// Open communication /// </summary> public void Open() { try { // Reset uALFAT with I2C enabled OutputPort SSELPort = new OutputPort(_sselpin, true); OutputPort SCKPort = new OutputPort(_sckpin, false); _resetport = new OutputPort(_resetpin, false); Thread.Sleep(100); _resetport.Write(true); Thread.Sleep(100); SSELPort.Dispose(); SCKPort.Dispose(); } catch { throw new Exception("Failed to reset uALFAT"); } // Create new I2C Connection try { _i2cconnection = new I2CDevice(new I2CDevice.Configuration(0x52, 400)); } catch { throw new Exception("Failed to initialize uALFAT I2c Interface!"); } // Read as many bytes as posible to clear any cached output byte b; while (ReadByte(out b, 250)) { } }
/// <summary> /// Disposes the buzzer object /// </summary> public void Dispose() { // Stops the background thread _PinSwitcherThread.Suspend(); // Frees the pin _OutputPin.Dispose(); }
protected void Dispose(bool disposing) { if (null != _fifoPort) { _fifoPort.Dispose(); _fifoPort = null; } if (null != _fifopInterrupt) { _fifopInterrupt.Dispose(); _fifopInterrupt = null; } if (null != _sfdInterrupt) { _sfdInterrupt.Dispose(); _sfdInterrupt = null; } if (null != _resetPort) { _resetPort.Dispose(); _resetPort = null; } if (null != _ccaPort) { _ccaPort.Dispose(); _ccaPort = null; } if (null != _powerPort) { _powerPort.Dispose(); _powerPort = null; } if (null != _spi) { lock (_spi) { _spi.Dispose(); _spi = null; } } }
/// <summary> /// Transmits ultrasonic burst /// </summary> public void Burst() { OutputPort triggerPort = new OutputPort(triggerPin, true); triggerPort.Write(false); triggerPort.Dispose(); }
public static void Reset(Cpu.Pin resetPin) { OutputPort dtr = new OutputPort(resetPin, false); Thread.Sleep(1); dtr.Write(true); dtr.Dispose(); }
public void Dispose() { Clear(); OutputEnable(true); Spi.Dispose(); ShiftRegisterClearPin.Dispose(); OutputEnablePin.Dispose(); }
private void Reset() { OutputPort dtr = new OutputPort(this._dtr, false); Thread.Sleep(1); dtr.Write(true); dtr.Dispose(); }
/// <summary> /// Open communication /// </summary> public void Open() { try { // Reset uALFAT with I2C enabled OutputPort SSELPort = new OutputPort(_sselpin, false); OutputPort SCKPort = new OutputPort(_sckpin, false); _resetport = new OutputPort(_resetpin, false); System.Threading.Thread.Sleep(100); _resetport.Write(true); System.Threading.Thread.Sleep(100); SSELPort.Dispose(); SCKPort.Dispose(); } catch { throw new Exception("Failed to reset uALFAT"); } try { _uart = new SerialPort(_comport, 9600, Parity.None, 8, StopBits.One); _uart.Handshake = Handshake.RequestToSend; _uart.Open(); byte[] SwitchBaudRate = System.Text.Encoding.UTF8.GetBytes("B 1EF4\r"); _uart.Write(SwitchBaudRate, 0, SwitchBaudRate.Length); _uart.Flush(); while (_uart.BytesToWrite != 0) { } _uart.Close(); _uart = new SerialPort(_comport, 115200, Parity.None, 8, StopBits.One); _uart.Handshake = Handshake.RequestToSend; _uart.Open(); byte[] cleanbuffer = new byte[1]; DateTime Wait = DateTime.Now.AddMilliseconds(1000); while (true) { if (_uart.BytesToRead > 0) { _uart.Read(cleanbuffer, 0, 1); Wait = DateTime.Now.AddMilliseconds(200); } if (DateTime.Now > Wait) { break; } } } catch { throw new Exception("Failed to open uALFAT Serial Port"); } }
public void Dispose() { _rsPort.Dispose(); _enablePort.Dispose(); _d4.Dispose(); _d5.Dispose(); _d6.Dispose(); _d7.Dispose(); }
void DisposePorts() { iPod.Dispose(); if (canControlVolume) { iPodVolumeUp.Dispose(); iPodVolumeDown.Dispose(); } }
public void Dispose() { _pwm1.Dispose(); _dir1a.Dispose(); _dir1b.Dispose(); _pwm2.Dispose(); _dir2a.Dispose(); _dir2b.Dispose(); }
/// <summary> /// Close communication /// </summary> public void Close() { // Dispose Reset Port try { _resetport.Dispose(); } catch { } // Dispose I2C Connection try { _i2cconnection.Dispose(); } catch { } }
public void Dispose() { lock (_syncRoot) { _disposing = true; _trigger.Dispose(); _echo.Dispose(); } }
public static void PowerUpDisplay() { // Ensure that the GPIO pin in low to prevent the display module to start in bootloader mode var goBusGPIO = new OutputPort(Pins.GPIO_PIN_D8, false); // Power up the display module PowerTransistor.Write(false); // Always wait 250ms after power-up to ensure that the display module is fully initialized before sending commands Thread.Sleep(250); goBusGPIO.Dispose(); }
public void Dispose() { _isDisposed = true; _interruptPin.Dispose(); _spi.Dispose(); _chipSelectPin.Dispose(); // abort our data received event-raising thread _notifyDataReceivedWaitHandle.Set(); }
public void Dispose() { if (trigger != null) { trigger.Dispose(); } if (echo != null) { echo.Dispose(); } }
/// <summary> /// Close communication /// </summary> public void Close() { try { _uart.Close(); _resetport.Dispose(); } catch { } }
public void Dispose() { myInputPort.Dispose(); myInterruptPort.Dispose(); myOutputPort.Dispose(); myI2CDevice.Dispose(); mySPI.Dispose(); myTristatePort.Dispose(); mySerialPort.Dispose(); Dispose(true); GC.SuppressFinalize(this); }
public void Dispose() { Debug.Print("LidarReader Dispose"); if (_oport != null) { _oport.Dispose(); } if (_inport != null) { _inport.Dispose(); } }
public override void Dispose(bool disposing) { if (!IsDisposed) { if (disposing) { _spi.Dispose(); _latchPort.Dispose(); } IsDisposed = true; } }
/// <summary> /// Release IO Pins /// </summary> public void Dispose() { try { DataPin.Dispose(); ClockPin.Dispose(); } catch { // Added by Slaven Brumec. throw new Exception("SHT11_GPIO_IOProvider: Failed to dispose IO pins."); } }
protected override void Dispose(bool disposing) { if (!IsDisposed) { if (disposing) { _spi.Dispose(); _latchPort.Dispose(); } //IsDisposed = true; } }
public void Dispose() { PowerOff(); if (mReset != null) { mReset.Dispose(); } if (mDtr != null) { mDtr.Dispose(); } }
public void Dispose() { if (!disposed) { disposed = true; timerRunning = false; timer.Dispose(); led.Dispose(); } }
private bool disposedValue = false; // To detect redundant calls void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { subscription.Dispose(); port.Write(false); port.Dispose(); } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. disposedValue = true; } }
public void Dispose() { _sleepPort.Dispose(); if (xAxis != null) { xAxis.Dispose(); } if (yAxis != null) { yAxis.Dispose(); } if (zAxis != null) { zAxis.Dispose(); } }
public void Dispose() { latch_state = 0; latch_tx(); //if (UsedDriver == Drivers.Driver1 || UsedDriver == Drivers.Both) //{ // Motor1A.Dispose(); // Motor1B.Dispose(); //} //if (UsedDriver == Drivers.Driver2 || UsedDriver == Drivers.Both) //{ Motor2A.Dispose(); Motor2B.Dispose(); //} MotorLatch.Dispose(); MotorEnable.Dispose(); MotorClk.Dispose(); MotorData.Dispose(); }
static void Main(string[] args) { OutputPort o = new OutputPort(Cpu.Pin.GPIO_Pin17, true); for (int i = 0; i < 5; i++) { o.Write(true); Console.WriteLine("Read: " + o.Read()); Thread.Sleep(500); o.Write(false); Console.WriteLine("Read: " + o.Read()); Thread.Sleep(500); } o.Dispose(); InputPort input = new InputPort(Cpu.Pin.GPIO_Pin17, true, Port.ResistorMode.Disabled); Console.WriteLine("Read: " + input.Read()); input.Dispose(); Console.WriteLine("Finishing"); }
public void Dispose() { if (_clockPin != null) { _clockPin.Dispose(); } if (_dataPin != null) { _dataPin.Dispose(); } if (_resetPin != null) { _resetPin.Dispose(); } if (_commitPin != null) { _commitPin.Dispose(); } }