In my project I want to connect an Arduino-type SBC to my Elk system. I will not be using a pre-programmed device such as an OLED display, so I have a double challenge of programming the source and destination correctly. Triple challenge if you include getting the wiring correct
I had been planning to use SPI for this, until I found out that the SPI was in use by Elk already, per this thread:
I shifted to looking at I2C. The RPi has 2 sets of I2C pins. If I understand correctly, Device 0 is connected to the built in SD card, and Device 1 is available for use. Also, if I understand correctly, the correct pins (on the RPi) for Device 1 are GPIO2 and GPIO3. (GPIO0 and GPIO1 are used by Device 0). There are also pins on the RPi dedicated to hats, which may(?) be sharing Device 0?
There are pins labelled SDA0 and SCL0 on the PiHat board. That implies Device 0, which is already in use?
I’ve tried to figure out from the Elk PiHat schematics which set of I2C pins are brought out to the PiHat edge connectors for my use. Sheet 1/15 shows SDA0 and SCL0 from the Pi connected to a “Codec” module. It’s not clear to me whether those are really Device 0 or Device 1 from the RPi. Because Pins 27 & 28 are labelled SDA1 and SCL1, and shown as connected to the GPIOs module.
Clearly, there is much to learn here, or I have not found the correct documentation. I would like to use the I2C on my Elk/RPi as the primary device, and another SBC as a secondary device.
Can you provide a reference?
Which C++ software library/API do you recommend using on the RPi to control the I2C?