Пример #1
0
            public void PinMode(CInterpreter state)
            {
                var pin  = state.ReadArg(0).Int16Value;
                var mode = state.ReadArg(1).Int16Value;

                Pins[pin].Mode = mode;
            }
Пример #2
0
            public void DigitalWrite(CInterpreter state)
            {
                var pin   = state.ReadArg(0).Int16Value;
                var value = state.ReadArg(1).Int16Value;

                Pins[pin].DigitalValue = value;
            }
Пример #3
0
        static void AssertBoolsAreEqual(CInterpreter state)
        {
            var expected = state.ReadArg(0);
            var actual   = state.ReadArg(1);

            Assert.AreEqual((int)expected, (int)actual);
        }
Пример #4
0
        static void AssertDoublesAreEqual(CInterpreter state)
        {
            var expected = state.ReadArg(0);
            var actual   = state.ReadArg(1);

            Assert.AreEqual((double)expected, (double)actual, 1.0e-12);
        }
Пример #5
0
        static void AssertFloatsAreEqual(CInterpreter state)
        {
            var expected = state.ReadArg(0);
            var actual   = state.ReadArg(1);

            Assert.AreEqual((float)expected, (float)actual, 1.0e-6);
        }
Пример #6
0
        static void AssertU16AreEqual(CInterpreter state)
        {
            var expected = state.ReadArg(0);
            var actual   = state.ReadArg(1);

            Assert.AreEqual((ushort)expected, (ushort)actual);
        }
Пример #7
0
        static void AssertAreEqual(CInterpreter state)
        {
            var expected = state.ReadArg(0).Int16Value;
            var actual   = state.ReadArg(1).Int16Value;

            if (expected != actual)
            {
                Console.WriteLine($"{expected} != {actual}");
            }
            //Assert.AreEqual ((short)expected, (short)actual);
        }
Пример #8
0
            public void DigitalRead(CInterpreter state)
            {
                var pin   = state.ReadArg(0).Int16Value;
                var value = Pins[pin].DigitalValue;

                state.Push(value);
            }
Пример #9
0
            public void AnalogRead(CInterpreter state)
            {
                var pin   = state.ReadArg(0).Int16Value;
                var value = Pins[pin].AnalogValue;

                state.Push(value);
            }
Пример #10
0
            public void SerialPrintlnS(CInterpreter state)
            {
                var p = state.ReadArg(0).PointerValue;

                SerialOut.WriteLine(state.ReadString(p));
            }
Пример #11
0
            public void SerialPrintlnI(CInterpreter state)
            {
                var v = state.ReadArg(0).Int16Value;

                SerialOut.WriteLine(v);
            }
Пример #12
0
 static void AssertU32AreEqual(CInterpreter state)
 {
     var expected = state.ReadArg(0);
     var actual   = state.ReadArg(1);
     //Assert.AreEqual ((uint)expected, (uint)actual);
 }
Пример #13
0
            public void SerialPrintS(CInterpreter state)
            {
                var p = state.ReadArg(0).PointerValue;

                SerialOut.Write(ReadString(p, state));
            }