How to use the other i2c ports on Teensy 4.0?

Hi PJRC forums,

I have two i2c devices hooked up to i2c-0 and i2c-1 on a Teensy 4.0.

I can talk to the i2c-0 device just fine using Wire because they are the default pins. However, I do not know the most efficient way to talk to a second i2c device that is connected to i2c-1.

I would like to avoid rewiring anything if at all possible.

Should I be modifying the Wire library or using some other method?

Any advice to assist would be welcomed. Thank you.
 
As connected Wire uses the pins 18,19
Use Wire1 for pins 17,16 and SDA1, SCL1

Missing details on the " two i2c devices"? Are they two of the same - or two different devices with different driver libraries in use?

Some libraries allow specifying Wire or Wire1 in the .begin() - some it is hard coded in the library and would need to be modified perhaps as simple as: #define Wire Wire1 in the code - but that wouldn't work if both use the same library.
 
As connected Wire uses the pins 18,19
Use Wire1 for pins 17,16 and SDA1, SCL1

Missing details on the " two i2c devices"? Are they two of the same - or two different devices with different driver libraries in use?

Some libraries allow specifying Wire or Wire1 in the .begin() - some it is hard coded in the library and would need to be modified perhaps as simple as: #define Wire Wire1 in the code - but that wouldn't work if both use the same library.

Oh right! One is a 128x64 OLED and the other is an MPU6050 IMU. So they use different libraries.

So it's as simple as including Wire1.h?
 
Back
Top