本文整理汇总了C#中Windows.Devices.I2c.I2cDevice.WriteByte方法的典型用法代码示例。如果您正苦于以下问题:C# I2cDevice.WriteByte方法的具体用法?C# I2cDevice.WriteByte怎么用?C# I2cDevice.WriteByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.Devices.I2c.I2cDevice
的用法示例。
在下文中一共展示了I2cDevice.WriteByte方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeAsync
/// <summary>
/// Tries to find and initialize device.
/// </summary>
/// <returns>True if the initialization is successfull</returns>
async Task<bool> InitializeAsync()
{
string advancedQuerySyntax = I2cDevice.GetDeviceSelector(I2CBusName);
DeviceInformationCollection deviceInformationCollection = await DeviceInformation.FindAllAsync(advancedQuerySyntax);
string deviceId = deviceInformationCollection[0].Id;
I2cConnectionSettings mpl3115a2Connection = new I2cConnectionSettings(Mpl3115a2I2cAddress);
mpl3115a2Connection.BusSpeed = I2cBusSpeed.FastMode;
mpl3115a2Connection.SharingMode = I2cSharingMode.Shared;
this.I2C = await I2cDevice.FromIdAsync(deviceId, mpl3115a2Connection);
if (I2C == null)
return false;
bool ok = I2C.ReadByte(Register.WHO_AM_I) == 0xc4;
if (!ok)
return false;
I2C.WriteByte(Register.PT_DATA_CFG, 0x07);
SetMode(Mode.Barometer);
return true;
}