Exemplo n.º 1
0
        public Simulation()
        {
            this.EEPROM    = new EEPROM();
            this.ADC       = new ADC();
            this.SPI       = new SPI();
            this.Lcd       = new LcdDevice(this.SPI);
            this.SdCard    = new SdDevice(this.SPI);
            this.Buttons   = new Buttons();
            this.USART     = new USART();
            this.DisplayR  = new ObservableCollection <DisplayRegister>(Enumerable.Range(0, AtmelContext.R.Length).Select(i => new DisplayRegister()).ToArray());
            this.DisplayIO = new ObservableCollection <DisplayIORegister>(Enumerable.Range(0, AtmelContext.NumIO).Select(i => new DisplayIORegister(i)).ToArray());

            var registersPerLine = 16;

            int numFlashLines = (2 * AtmelContext.Flash.Length + registersPerLine - 1) / registersPerLine;

            this.DisplayFlash = new ObservableCollection <DisplayRegisterLine>(
                Enumerable.Range(0, numFlashLines).Select(index => new DisplayRegisterLine(index * registersPerLine, registersPerLine)).ToArray());

            int numRamLines = (AtmelContext.RAMSize + registersPerLine - 1) / registersPerLine;

            this.DisplayRAM = new ObservableCollection <DisplayRegisterLine>(
                Enumerable.Range(0, numRamLines).Select(index => new DisplayRegisterLine(AtmelContext.FirstSRAM + index * registersPerLine, registersPerLine)).ToArray());

            int numEEpromLines = (AtmelContext.EEPROM.Length + registersPerLine - 1) / registersPerLine;

            this.DisplayEEPROM = new ObservableCollection <DisplayRegisterLine>(
                Enumerable.Range(0, numEEpromLines).Select(index => new DisplayRegisterLine(index * registersPerLine, registersPerLine)).ToArray());

            Flash(new string[] {}, true);
        }
 // Start is called before the first frame update
 void Start()
 {
     Conn           = GetComponent <USART>();
     BallRB         = Ball.GetComponent <Rigidbody>();
     ScoreText.text = "0";
 }