唤醒i2c奴隶 [英] wake-up i2c slave

查看:84
本文介绍了唤醒i2c奴隶的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有HIH6120(湿度和温度传感器)的覆盆子pi3。

i am using a raspberry pi3 with a HIH6120 (humidity and temperature sensor).

在获取测量数据之前,需要先将该传感器唤醒。

This sensor needs to be woken-up first before getting measurement data.

这必须使用包含i2c地址和位[0] = 0的消息来完成。

This must be done with a message containing the i2c address and bit[0] = 0.

i2cdevice.write(byte [] buffer)方法发送这个字节后跟"缓冲区"。

The i2cdevice.write(byte[] buffer) method sends this byte followed by the "buffer".

该方法不允许空缓冲区,这对我的应用程序来说是完美的。

The method does not allow an empty buffer which would be perfect for my application.

如何定义"原始数据包"?

How can i define a "raw packet"?

否则解决此问题?

推荐答案

Hello wallage1216,

Hello wallage1216,

这里
是HIH6120的样本,它使用以下代码:

Here is a sample for HIH6120 and it use the following code:

          // An empty array of bytes to read the response into
          byte[] readBuff = new byte[4];
          // The address of the device as a byte array
          byte[] regAddrBuff = new byte[] { 0x27 };

          // Perform the Write and the Read Operation
          honeywell.WriteRead(regAddrBuff, readBuff);

您可以尝试看看它是否有帮助。如果您有任何疑虑,请随时与我们联系。

You can try to see if it helps. If you have any concern feel free let me know.

祝你好运,

Rita


这篇关于唤醒i2c奴隶的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆