Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 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;
     }
 }
Esempio n. 3
0
        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;
            }
        }
Esempio n. 4
0
        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();
        }