Пример #1
0
        protected async override Task Initialize(ISocket parentSocket)
        {
            this.socket = parentSocket;

            this.write1 = new byte[1];
            this.write2 = new byte[2];
            this.read4  = new byte[4];

            this.spi = await this.socket.CreateSpiDeviceAsync(new Windows.Devices.Spi.SpiConnectionSettings(parentSocket.NativeSpiChipSelectPin)
            {
                Mode = Windows.Devices.Spi.SpiMode.Mode0, ClockFrequency = 1000000
            });

            this.enable = await this.socket.CreateDigitalIOAsync(SocketPinNumber.Five, true);

            this.Write(Command.Clear, Register.Mode0);
            this.Write(Command.Clear, Register.Mode1);
            this.Write(Command.Clear, Register.Status);
            this.Write(Command.Clear, Register.Counter);
            this.Write(Command.Load, Register.Output);

            this.Mode = CountMode.Quad1;

            this.Write(Command.Write, Register.Mode1, Mode1.FourByte | Mode1.EnableCount);
        }
Пример #2
0
        protected async override Task Initialize(ISocket parentSocket)
        {
            this.boards = 0;
            this.data   = null;

            this.spi = await parentSocket.CreateSpiDeviceAsync(new Windows.Devices.Spi.SpiConnectionSettings(0)
            {
                Mode = Windows.Devices.Spi.SpiMode.Mode0, ClockFrequency = 1000
            });

            this.enable = await parentSocket.CreateDigitalIOAsync(SocketPinNumber.Three, false);

            this.clr = await parentSocket.CreateDigitalIOAsync(SocketPinNumber.Four, true);
        }