KurtE
Senior Member+
I am not sure if this is the best approach, but after starting and stopping this a few times, I decided to create a version of the Wire library that generates Wire1 for most boards and Wire2 for T3.5 and T3.6 and Wire3 for T3.6.
Currently these are like SPI library where as each of these are individual classes. In the end it may be nice to update this to maybe make a base class that does most of the work (like I2c_t3), and have some virtual functions, such that maybe we can pass in a pointer to one of these objects to another class and have that class be able to work with different busses for different objects... May do that.
But in the mean time, I pushed up a new branch on my fork of the Wire library: https://github.com/KurtE/Wire/tree/Support-Wire1/2/3
To test this, I made a version of the Adafruit_SSD1306 library where in the header file you can define which Wire object to compile for. Again this is up at:
https://github.com/KurtE/Adafruit_SSD1306/tree/Wire!/2/3
Again not as nice as I2C_t3 in that you have to edit the library to change busses and you can't have multiple ones on different ones... I do have a branch of this library as well that supports i2c_t3 which I was using to test during the T3.6 beta.
Any way I did some rudimentary testing of this, by trying out one of the I2C displays on the default I2C pins for each buss (Wire, Wire1, Wire2, Wire3) on a T3.6 and also tried it on a T3.2 on Wire and Wire1.
Again probably needs more testing, but if this is the approach that we desire to go with the wire library can issue Pull Request.
Kurt
P.S. - When doing this, I noticed that we were hard coding doing attachInterrupt(18, ...) in the Wire object and wondered what 18 was... Turns out default SDA pin... In my copy changed to the current SDA pin... likewise on detach...
Currently these are like SPI library where as each of these are individual classes. In the end it may be nice to update this to maybe make a base class that does most of the work (like I2c_t3), and have some virtual functions, such that maybe we can pass in a pointer to one of these objects to another class and have that class be able to work with different busses for different objects... May do that.
But in the mean time, I pushed up a new branch on my fork of the Wire library: https://github.com/KurtE/Wire/tree/Support-Wire1/2/3
To test this, I made a version of the Adafruit_SSD1306 library where in the header file you can define which Wire object to compile for. Again this is up at:
https://github.com/KurtE/Adafruit_SSD1306/tree/Wire!/2/3
Again not as nice as I2C_t3 in that you have to edit the library to change busses and you can't have multiple ones on different ones... I do have a branch of this library as well that supports i2c_t3 which I was using to test during the T3.6 beta.
Any way I did some rudimentary testing of this, by trying out one of the I2C displays on the default I2C pins for each buss (Wire, Wire1, Wire2, Wire3) on a T3.6 and also tried it on a T3.2 on Wire and Wire1.
Again probably needs more testing, but if this is the approach that we desire to go with the wire library can issue Pull Request.
Kurt
P.S. - When doing this, I noticed that we were hard coding doing attachInterrupt(18, ...) in the Wire object and wondered what 18 was... Turns out default SDA pin... In my copy changed to the current SDA pin... likewise on detach...