I have recently written numerous functions in C for microfluidic pumps which are controlled via I2C on a Raspberry Pi. They work perfectly. I made use of the O_RDWR to write and read from "/dev/i2c-1".
However, I am still wondering how exactly these file changes are implemented on a low level. How is the code, which generates the correct bit sequences to communicate with these pumps, transferred to the PINs? What tells the kernel to change the states of the 2 I2C-PINs accordingly to code?
Thank you!
/dev/i2c-1is not an ordinary file, but a device file. Device drivers provide files as an interface to send or receive data or to configure the hardware and/or the driver./dev/i2c-*are character device files. Calls to these files are handled byi2c-devdriver.i2c-devdispatches calls to corresponding I2C controller driver.