I am trying to read out an i2c ambient light sensor BH1750 from C in userspace. I am using a BeagleBone pocket with Linux.
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
.
The issue I ran into: All examples/commands I have found either are only reading 1 byte or are requiring a register address to read more.
The closest I found was the following command: 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?
I was able to solve it using this comment from Ian Abbott:
Here is a Logicanalyzer-Trace of the resulting I2C communication: