public override void Copy(VirtualMemory source) { base.Copy(source); Height = ((VirtualFrame)source).Height; Width = ((VirtualFrame)source).Width; xOffset = ((VirtualFrame)source).xOffset; yOffset = ((VirtualFrame)source).yOffset; BytesPerPixel = ((VirtualFrame)source).BytesPerPixel; TransparentColor = ((VirtualFrame)source).TransparentColor; }
public virtual void Copy(VirtualMemory source) { if (IsReadOnly) throw new InvalidOperationException("readonly"); var address = 0; Stream.SetLength(source.Stream.Length); while(address < source.Stream.Length) { var sourceBytesRead = source.ReadVM(address, 0); WriteVM(address, source.Buffer, sourceBytesRead); address+= sourceBytesRead; } }
public virtual void Copy(VirtualMemory source) { if (IsReadOnly) { throw new InvalidOperationException("readonly"); } var address = 0; Stream.SetLength(source.Stream.Length); while (address < source.Stream.Length) { var sourceBytesRead = source.ReadVM(address, 0); WriteVM(address, source.Buffer, sourceBytesRead); address += sourceBytesRead; } }
public AdaFruitST7735( Cpu.Pin chipSelect, Cpu.Pin dc, Cpu.Pin reset, SPI.SPI_module spiModule = SPI.SPI_module.SPI1, uint speedKHz = (uint)9500, VirtualMemory vm = null) { Width = 128; Height = 160; AutoRefreshScreen = false; DataCommand = new OutputPort(dc, false); Reset = new OutputPort(reset, true); var extendedSpiConfig = new ExtendedSpiConfiguration( SPI_mod: spiModule, ChipSelect_Port: chipSelect, ChipSelect_ActiveState: false, ChipSelect_SetupTime: 0, ChipSelect_HoldTime: 0, Clock_IdleState: false, Clock_Edge: true, Clock_RateKHz: speedKHz, BitsPerTransfer: 8); Spi = new SPI(extendedSpiConfig); if (vm == null) { SpiBuffer = new byte[Width * Height * sizeof(ushort)]; MemoryWriteFunction = SpiBufferWrite; } else { VM = vm; MemoryWriteFunction = VirtualMemoryWrite; } Initialize(); }
public void Dispose() { Spi.Dispose(); SpiBuffer = null; Spi = null; DataCommand = null; Reset = null; VM = null; }