internal I2cDevice(DigitalIO sda, DigitalIO scl, Windows.Devices.I2c.I2cConnectionSettings settings) { this.sda = sda; this.scl = scl; this.start = false; this.writeAddress = (byte)(settings.SlaveAddress << 1); this.readAddress = (byte)((settings.SlaveAddress << 1) | 1); }
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); }
protected async override Task Initialize(ISocket parentSocket) { this.outputPin = await parentSocket.CreateDigitalIOAsync(SocketPinNumber.Four, false); this.inputPin = await parentSocket.CreateDigitalIOAsync(SocketPinNumber.Three, GpioPinEdge.FallingEdge | GpioPinEdge.RisingEdge); this.inputPin.ValueChanged += (s, e) => { if (e.Value) { this.Released?.Invoke(this, null); } else { this.Pressed?.Invoke(this, null); } }; }
protected async override Task Initialize(ISocket parentSocket) { this.lcdRS = await parentSocket.CreateDigitalIOAsync(SocketPinNumber.Four, false); this.lcdE = await parentSocket.CreateDigitalIOAsync(SocketPinNumber.Three, false); this.lcdD4 = await parentSocket.CreateDigitalIOAsync(SocketPinNumber.Five, false); this.lcdD5 = await parentSocket.CreateDigitalIOAsync(SocketPinNumber.Seven, false); this.lcdD6 = await parentSocket.CreateDigitalIOAsync(SocketPinNumber.Nine, false); this.lcdD7 = await parentSocket.CreateDigitalIOAsync(SocketPinNumber.Six, false); this.backlight = await parentSocket.CreateDigitalIOAsync(SocketPinNumber.Eight, true); this.currentRow = 0; this.SendCommand(0x33); this.SendCommand(0x32); this.SendCommand(CharacterDisplay.DisplayOnCommand); this.SendCommand(CharacterDisplay.ClearDisplayCommand); Task.Delay(3).Wait(); }
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); }
protected async override Task Initialize(ISocket parentSocket) { this.x = await parentSocket.CreateAnalogIOAsync(SocketPinNumber.Four); this.y = await parentSocket.CreateAnalogIOAsync(SocketPinNumber.Five); this.input = await parentSocket.CreateDigitalIOAsync(SocketPinNumber.Three); }
protected async override Task Initialize(ISocket parentSocket) { _outputPin = await parentSocket.CreateDigitalIOAsync((SocketPinNumber)5, false); }
protected async override Task Initialize(ISocket parentSocket) { this.red = await parentSocket.CreateDigitalIOAsync(SocketPinNumber.Four, false); this.green = await parentSocket.CreateDigitalIOAsync(SocketPinNumber.Five, false); this.blue = await parentSocket.CreateDigitalIOAsync(SocketPinNumber.Three, false); }
protected async override Task Initialize(ISocket parentSocket) { this.input = await parentSocket.CreateAnalogIOAsync(SocketPinNumber.Three); this.enable = await parentSocket.CreateDigitalIOAsync(SocketPinNumber.Six, true); }
internal SpiDevice(DigitalIO chipSelect, DigitalIO masterOut, DigitalIO masterIn, DigitalIO clock, Windows.Devices.Spi.SpiConnectionSettings settings) { if (settings.DataBitLength != 8) throw new NotSupportedException("Only 8 data bits are supported."); this.chipSelect = chipSelect; this.masterOut = masterOut; this.masterIn = masterIn; this.clock = clock; this.clockEdge = (((int)settings.Mode) & 0x01) > 0; this.clockPolarity = (((int)settings.Mode) & 0x02) == 0; }