The Raw I2C Bus
Now, as done for USB bus we should take a look at how we can get direct access to the I2C bus. In the same manner as for USB devices when one of them hasn't a dedicated driver it can be managed directly from the user space. The only problem may arise if the I2C device can generate interrupts, in this case we cannot manage these signals from the user-space and a kernel driver must be used. However this is a rare case and the presented technique can be used in most cases.
Writing data in C
As first example we're going to write some data to the DAC chip named TC1321 which is mounted on the development board we used above connected to the BeagleBone Black board.
Note
The datasheet is available at the URL: http://ww1.microchip.com/downloads/en/DeviceDoc/21387C.pdf ...
Get GNU/Linux Rapid Embedded Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.