Rubberazer / JETGPIO

C library to manage the GPIO header of the Nvidia Jetson boards
https://rubberazer.github.io/JETGPIO
MIT License
73 stars 13 forks source link

I2C does not allow for multiple devices on the same bus #4

Closed GrahamBriggs closed 1 year ago

GrahamBriggs commented 1 year ago

As a user, I need to have multiple I2C devices on the same bus.

In the function jetgpio.c / i2cOpen( )

This code (around line 1969) prevents more than one device on the same bus:

if (i2cInfo[i2cBus].state == I2C_CLOSED) { slot = i2cBus; i2cInfo[slot].state = I2C_RESERVED; } else { printf("i2c bus already open\n"); return -4; }

Rubberazer commented 1 year ago

You are absolutely right, I am going to make changes to my lib so all devices on the i2c bus can be addressed

Rubberazer commented 1 year ago

Sorted, from current version (0.95) on, the I2C slave address has been removed from the i2cOpen() function and moved to the: i2cWriteByteData() & i2cReadByteData() functions so several devices can be reached on the same bus.

Rubberazer commented 1 year ago

Closing