I am writing wrapper API's in user space for controlling the I2C bus in C on Embedded Linux Platform. I am able to read and write data from sensor using read() and write() methods and ioctl() call to select the slave. I know internally read/write do the following steps :
- Send Start bit
- Send slave address + R/W bit and get acknowledged
- Send/Receive Data
- Send Stop bit
I want to create separate functions to do the following:
- To send a Start bit in the I2C bus
- To send a Stop bit in the I2C bus
- To write one byte to the I2C bus. (Not Generic to a slave)
- To read one byte from the I2C bus. (Not Generic to a slave)
Are there any linux functions/API's/ioctl calls which can be used from a C User application to achieve the above functionalities..?