public async Task<SpiDevice> CreateSpiDeviceAsync(WD.Spi.SpiConnectionSettings connectionSettings, SocketPinNumber chipSelectPinNumber, SocketPinNumber masterOutPinNumber, SocketPinNumber masterInPinNumber, SocketPinNumber clockPinNumber) { if (chipSelectPinNumber == SocketPinNumber.Six && masterOutPinNumber == SocketPinNumber.Seven && masterInPinNumber == SocketPinNumber.Eight && clockPinNumber == SocketPinNumber.Nine && this.IsTypeSupported(SocketType.S)) return await this.CreateSpiDeviceAsync(connectionSettings); var chipSelect = await this.CreateDigitalIOAsync(chipSelectPinNumber); var masterOut = await this.CreateDigitalIOAsync(masterOutPinNumber); var masterIn = await this.CreateDigitalIOAsync(masterInPinNumber); var clock = await this.CreateDigitalIOAsync(clockPinNumber); return new SoftwareInterfaces.SpiDevice(chipSelect, masterOut, masterIn, clock, connectionSettings); }
public async Task<I2cDevice> CreateI2cDeviceAsync(WD.I2c.I2cConnectionSettings connectionSettings, SocketPinNumber sdaPinNumber, SocketPinNumber sclPinNumber) { if (sdaPinNumber == SocketPinNumber.Eight && sclPinNumber == SocketPinNumber.Nine && this.IsTypeSupported(SocketType.I)) return await this.CreateI2cDeviceAsync(connectionSettings); var sda = await this.CreateDigitalIOAsync(sdaPinNumber); var scl = await this.CreateDigitalIOAsync(sclPinNumber); return new SoftwareInterfaces.I2cDevice(sda, scl, connectionSettings); }
public async Task<SpiDevice> CreateSpiDeviceAsync(WD.Spi.SpiConnectionSettings connectionSettings) { if (this.IsTypeSupported(SocketType.Y) && !this.IsTypeSupported(SocketType.S)) return await this.CreateSpiDeviceAsync(connectionSettings, SocketPinNumber.Six, SocketPinNumber.Seven, SocketPinNumber.Eight, SocketPinNumber.Nine); this.EnsureTypeIsSupported(SocketType.S); if (this.SpiDeviceCreator != null) return await this.SpiDeviceCreator(this); return new NativeInterfaces.SpiDevice(await NativeInterfaces.SpiDevice.CreateInterfaceAsync(this.NativeSpiDeviceId, connectionSettings)); }
public I2cDevice(WD.I2c.I2cDevice device) { this.device = device; }
public async Task<DigitalIO> CreateDigitalIOAsync(SocketPinNumber pinNumber, WD.Gpio.GpioPinEdge interruptType) { var result = await this.CreateDigitalIOAsync(pinNumber); result.InterruptType = interruptType; return result; }
public static async Task<WD.I2c.I2cDevice> CreateInterfaceAsync(string deviceId, WD.I2c.I2cConnectionSettings connectionSettings) { var infos = await WD.Enumeration.DeviceInformation.FindAllAsync(WD.I2c.I2cDevice.GetDeviceSelector(deviceId)); return await WD.I2c.I2cDevice.FromIdAsync(infos[0].Id, connectionSettings); }
private void OnInterrupt(WD.Gpio.GpioPin sender, WD.Gpio.GpioPinValueChangedEventArgs e) => this.OnValueChanged(e.Edge == WD.Gpio.GpioPinEdge.RisingEdge);
public SerialDevice(WD.SerialCommunication.SerialDevice device) { this.device = device; this.writer = new DataWriter(this.device.OutputStream); this.reader = new DataReader(this.device.InputStream); }
public DigitalIO(WD.Gpio.GpioPin pin) { this.pin = pin; }
public SpiDevice(WD.Spi.SpiDevice device) { this.device = device; }