本文整理匯總了C#中Windows.Devices.I2c.I2cDevice.ReadByte方法的典型用法代碼示例。如果您正苦於以下問題:C# I2cDevice.ReadByte方法的具體用法?C# I2cDevice.ReadByte怎麽用?C# I2cDevice.ReadByte使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Windows.Devices.I2c.I2cDevice
的用法示例。
在下文中一共展示了I2cDevice.ReadByte方法的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;
}