On Sat, Apr 1, 2023 at 9:57 PM Bo Berglund via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote:
> Question: > Can I use Linux file system commands to read/write the data on the i2c > EEPROM > memory device and if so how from fpc? > To some extent it is possible to handle i2c transactions as file read/write operations, but some ioctl calls are required to configure e.g. the device address [1]. Take note that only a subset of i2c functionality is available using read/write calls. Lazi2cdev [2] uses this approach. For finer control over the i2c transactions (for example combined write/read transactions) low level ioctl calls are available in Linux. I wrote an i2c class [3] using this approach. 1. https://www.kernel.org/doc/html/latest/i2c/dev-interface.html 2. https://github.com/laz2wiringpi/lazI2cdev/blob/master/i2cdev_base.pas 2. https://github.com/ccrause/rpiplc_pas/blob/main/native/i2c.pas
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal