简体   繁体   English

从用户空间读取一个字(2 字节)而不提供寄存器地址

[英]Read a word (2 byte) without providing a register address from userspace

I am trying to read out an i2c ambient light sensor BH1750 from C in userspace.我正在尝试从用户空间中的 C 读出 i2c 环境光传感器 BH1750。 I am using a BeagleBone pocket with Linux.我在 Linux 上使用 BeagleBone 口袋。

The Datasheet says, that after a measurement operation the result needs to be read with the following i2c sequence: S Adr Rd (A) (Data) A (Data) NA P .数据表说,在测量操作之后,需要使用以下 i2c 序列读取结果: S Adr Rd (A) (Data) A (Data) NA P

The issue I ran into: All examples/commands I have found either are only reading 8 bytes or are requiring a register address.我遇到的问题:我发现的所有示例/命令要么只读取 8 个字节,要么需要一个寄存器地址。

The closest I found was the following command: i2c_master_recv() .我找到的最接近的是以下命令: i2c_master_recv() However my interpretation of the documentation is that this command is used in kernel-device-drivers.但是,我对文档的解释是该命令用于内核设备驱动程序。

How can I issue such a I2C-Read-Sequence from Userspace?如何从用户空间发出这样的 I2C 读取序列?

@0andriy 的评论完成了工作 - 问题解决了 :) 这是生成的 I2C-Communication Link to Trace的 Logicanalyzer- Trace

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM