Throughout the past two weeks, I was able to figure out the I2c function calls from the ST’s Arduino API and extract and use them directly on the Arduino IDE. First, I used the Doxigen documentation tool with Graphviz dot to generate block diagrams of all functions, classes and structs and their connections with each other. It helped me to visualize the library implementations and class hierarchy in a more general way. Then by searching in the graphs, I was able to find the I2C communication calls and how they are implemented within the ST’s API.

For example, ReadMulti method requests numbers of data in bytes from the sensor form a particular register address. Depending on the types of data that are being requested, it returns a different amount of bytes from the sensor. I used the same method on my Arduino code to request data and read the results directly from the I2C channel. In the future, I am going to do the similar types of I2C implementations on my code to change the ROI and see how it effects on the data I'm receiving from the sensor.

Above is a sample reading which is done by my code. Note that pdata is a dummy variable that stores each byte received from each reading.

Next Post Previous Post