public IAvrBurningContext OpenProgrammingContext(ILifeTime Lifetime, int ChannelNumber) { if (!_astra.Power) _astra.Power = true; _astra.Reset[ChannelNumber] = false; _astra.Led = true; Thread.Sleep(10); _astra.Reset[ChannelNumber] = true; _astra.Led = false; Thread.Sleep(10); _astra.Reset[ChannelNumber] = false; _astra.Led = true; byte[] response = _spi.RollSpi(new byte[] { 0xac, 0x53, 0x00, 0x00 }); if (response[2] != 0x53) throw new CouldNotEnterProgModeSpiException(); Lifetime.Add(() => _astra.Reset[ChannelNumber] = true); Thread.Sleep(Delays.StProg); return new AvrBurningContext(new AstraToSpiProxy(_astra)); }