Ejemplo n.º 1
0
        public void t8(PigpiodIf pigpiodIf, CancellationToken ct)
        {
            int v;

            Console.WriteLine("\r\nBank read/write tests.");

            pigpiodIf.gpio_write(GPIO, 0);
            v = (int)pigpiodIf.read_bank_1() & (1 << GPIO);
            CHECK(8, 1, v, 0, 0, "read bank 1", ct);

            pigpiodIf.gpio_write(GPIO, 1);
            v = (int)pigpiodIf.read_bank_1() & (1 << GPIO);
            CHECK(8, 2, v, (1 << GPIO), 0, "read bank 1", ct);

            pigpiodIf.clear_bank_1(1 << GPIO);
            v = pigpiodIf.gpio_read(GPIO);
            CHECK(8, 3, v, 0, 0, "clear bank 1", ct);

            pigpiodIf.set_bank_1(1 << GPIO);
            v = pigpiodIf.gpio_read(GPIO);
            CHECK(8, 4, v, 1, 0, "set bank 1", ct);

            v = (int)pigpiodIf.read_bank_2();

            if (v != 0)
            {
                v = 0;
            }
            else
            {
                v = 1;
            }

            CHECK(8, 5, v, 0, 0, "read bank 2", ct);

            v = pigpiodIf.clear_bank_2(0);
            CHECK(8, 6, v, 0, 0, "clear bank 2", ct);

            v = pigpiodIf.clear_bank_2(0xffffff);
            CHECK(8, 7, v, -42, 0, "clear bank 2", ct);

            v = pigpiodIf.set_bank_2(0);
            CHECK(8, 8, v, 0, 0, "set bank 2", ct);

            v = pigpiodIf.set_bank_2(0xffffff);
            CHECK(8, 9, v, -42, 0, "set bank 2", ct);
        }