Esempio n. 1
0
        private async Task ArduinoOnDeviceReady()
        {
            ConnectionNotify?.Invoke(this, "Arduino Ready");

            await SerialOut.Reset(false);

            await Task.Delay(300);

            await AttachServos();

            Arduino.SafePinMode(_phoneChargePin, PinMode.OUTPUT);

            IsReady = true;
        }
Esempio n. 2
0
        public void Step()
        {
            var manualPC = false;

            if (C0 == 0x00)
            {
                A += C1;
            }
            else if (C0 == 0x01)
            {
                A = C1;
            }
            else if (C0 == 0x02)
            {
                A ^= C1;
            }
            else if (C0 == 0x03)
            {
                A |= C1;
            }
            else if (C0 == 0x04)
            {
                A &= C1;
            }
            else if ((C0 & 0xf0) == 0x80)
            {
                A = Memory[C0111];
            }
            else if ((C0 & 0xf0) == 0xd0)
            {
                if (Writables[C0111])
                {
                    Memory[C0111] ^= A;
                }
            }
            else if ((C0 & 0xf0) == 0xf0)
            {
                if (Writables[C0111])
                {
                    Memory[C0111] = A;
                }
            }
            else if (C0 == 0x13 && C1 == 0x37)
            {
                SerialOut?.Invoke(A);
            }
            else if ((C0 & 0xf0) == 0x20)
            {
                PC       = C0111;
                manualPC = true;
            }
            else if ((C0 & 0xf0) == 0x30)
            {
                if (A == 0)
                {
                    PC       = C0111;
                    manualPC = true;
                }
            }
            else if ((C0 & 0xf0) == 0x40)
            {
                if (A == 1)
                {
                    PC       = C0111;
                    manualPC = true;
                }
            }
            else if ((C0 & 0xf0) == 0x50)
            {
                if (A == 255)
                {
                    PC       = C0111;
                    manualPC = true;
                }
            }
            else if (C0 == 0x60)
            {
                A = Compare(A, C1);
            }
            else if ((C0 & 0xf0) == 0x70)
            {
                A = Compare(A, Memory[C0111]);
            }
            else if (C0 == 0xbe && C1 == 0xef)
            {
                PC       = 0x100;
                A        = 0x42;
                manualPC = true;
            }
            else if ((C0 & 0xf0) == 0x90)
            {
                Writables[C0111] = false;
            }
            else if ((C0 & 0xf0) == 0xa0)
            {
                Writables[C0111] = true;
            }
            else if ((C0 & 0xf0) == 0xc0)
            {
                if (Writables[C0111])
                {
                    Memory[C0111] ^= 0x42;
                }
            }
            else if (C0 == 0xee && C1 == 0xee)
            {
                // nop
            }
            else
            {
                A--;
            }

            if (!manualPC)
            {
                PC += 2;
            }
        }
 bool IMySerialOutAccess.SendMessageToSerial(String Message, int COMPortNumber, int baudRate)
 {
     return(SerialOut.SendMessageToSerial(Message, COMPortNumber, baudRate));
 }
 bool IMySerialOutAccess.SendMessageToSerial(String Message, String devicename)
 {
     return(SerialOut.SendMessageToSerial(Message, devicename));
 }