//--// public I2CDevice(Configuration config) { this.Config = config; HardwareProvider hwProvider = HardwareProvider.HwProvider; if (hwProvider != null) { Cpu.Pin scl; Cpu.Pin sda; hwProvider.GetI2CPins(out scl, out sda); if (scl != Cpu.Pin.GPIO_NONE) { Port.ReservePin(scl, true); } if (sda != Cpu.Pin.GPIO_NONE) { Port.ReservePin(sda, true); } } Initialize(); m_disposed = false; }
private void Dispose(bool fDisposing) { if (!m_disposed) { try { HardwareProvider hwProvider = HardwareProvider.HwProvider; if (hwProvider != null) { Cpu.Pin scl; Cpu.Pin sda; hwProvider.GetI2CPins(out scl, out sda); if (scl != Cpu.Pin.GPIO_NONE) { Port.ReservePin(scl, false); } if (sda != Cpu.Pin.GPIO_NONE) { Port.ReservePin(sda, false); } } } finally { m_disposed = true; } } }