Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Conflict between Lib i2c_t3 and Adafruit_GFX.g / Adafruit_SSD1306.h

  1. #1
    Junior Member
    Join Date
    Feb 2019
    Posts
    1

    Conflict between Lib i2c_t3 and Adafruit_GFX.g / Adafruit_SSD1306.h

    Trying to use mutiple of small OLED displays with help i2c switch TCA9548 - Adafruit breakout.
    The code to control OLED with TCA95948 worked on a Arduino micro pro, but not then I shifted to Teensy due to I need the MidiUSB support which Teensy has built in.
    Apparently the normal Wire.h library does not work with Teensy 3.2 and TCA9548, so I tried to use the i2c_t3.h instead.
    But I get mutiple of compiling errors after I shift from Wire.h to i2c_t3.h
    Then I tried reinstall the full software (Arduio + Teensy) and run a code from the forum to see if it works, but still error, conflict between the different libraries.


    I used this code to check if my installation is ok:
    https://forum.pjrc.com/archive/index.php/t-33298.html

    Different application, different input, but still use the same libraries and the TCA9548

    #include <Adafruit_GFX.h>
    #include <gfxfont.h>
    #include <Adafruit_SSD1306.h>
    #include <i2c_t3.h>

    And get this error:

    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxx

    Arduino: 1.8.8 (Windows 7), TD: 1.45, Board: "Teensy 3.2 / 3.1, MIDI, 96 MHz (overclock), Faster, US English"

    C:\Users\Chris\AppData\Local\Temp\arduino_build_12 1718\libraries\Wire\WireKinetis.cpp.o: In function `i2c0_isr':

    C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire/WireKinetis.cpp:895: multiple definition of `i2c0_isr'

    C:\Users\Chris\AppData\Local\Temp\arduino_build_12 1718\libraries\i2c_t3\i2c_t3.cpp.o:C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\i2c_t3/i2c_t3.cpp:1134: first defined here

    c:/program files (x86)/arduino/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions

    C:\Users\Chris\AppData\Local\Temp\arduino_build_12 1718\libraries\Wire\WireKinetis.cpp.o: In function `Print::availableForWrite()':

    C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire/WireKinetis.h:132: multiple definition of `i2c1_isr'

    C:\Users\Chris\AppData\Local\Temp\arduino_build_12 1718\libraries\i2c_t3\i2c_t3.cpp.o:C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\i2c_t3/i2c_t3.h:883: first defined here

    C:\Users\Chris\AppData\Local\Temp\arduino_build_12 1718\libraries\Wire\WireKinetis.cpp.o: In function `Print::availableForWrite()':

    C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire/WireKinetis.h:132: multiple definition of `Wire1'

    C:\Users\Chris\AppData\Local\Temp\arduino_build_12 1718\libraries\i2c_t3\i2c_t3.cpp.o:C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\i2c_t3/i2c_t3.h:883: first defined here

    c:/program files (x86)/arduino/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: Warning: size of symbol `Wire1' changed from 20 in C:\Users\Chris\AppData\Local\Temp\arduino_build_12 1718\libraries\i2c_t3\i2c_t3.cpp.o to 108 in C:\Users\Chris\AppData\Local\Temp\arduino_build_12 1718\libraries\Wire\WireKinetis.cpp.o

    C:\Users\Chris\AppData\Local\Temp\arduino_build_12 1718\libraries\Wire\WireKinetis.cpp.o: In function `Print::availableForWrite()':

    C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire/WireKinetis.h:132: multiple definition of `Wire'

    C:\Users\Chris\AppData\Local\Temp\arduino_build_12 1718\libraries\i2c_t3\i2c_t3.cpp.o:C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\i2c_t3/i2c_t3.h:883: first defined here

    c:/program files (x86)/arduino/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: Warning: size of symbol `Wire' changed from 20 in C:\Users\Chris\AppData\Local\Temp\arduino_build_12 1718\libraries\i2c_t3\i2c_t3.cpp.o to 108 in C:\Users\Chris\AppData\Local\Temp\arduino_build_12 1718\libraries\Wire\WireKinetis.cpp.o

    collect2.exe: error: ld returned 1 exit status

    Error compiling for board Teensy 3.2 / 3.1.

    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.

    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx

    The I run the standard shift function from Adafruit with the Wire.h, nothing happens, that is why I tried to shift to the enhanced i2c_t3.h

    This is the normal shift function; which works on Arduino micro pro but not on a Teensy 3.2 if using the Wire.h

    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    #define TCAADDR 0x70

    void tcaselect(uint8_t i) {
    if (i > 7) return;

    Wire.beginTransmission(TCAADDR);
    Wire.write(1 << i);
    Wire.endTransmission();
    }

    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    How do you use the Libraires: i2c_t3.h, Adafruit_GFX.g and Adafruit_SSD1306.h in the same code?
    Looking forward to some good tips, I am stuck
    Or any other good idea how to use a TCA9548 with a Teensy 3.2.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,288
    Quote Originally Posted by Chris2019 View Post
    How do you use the Libraires: i2c_t3.h, Adafruit_GFX.g and Adafruit_SSD1306.h in the same code?
    Usually, you don't. Use the Wire library instead of i2c_t3.

  3. #3
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,085
    Again not sure why TCA9548 would not work with Wire library but would with i2c_t3?

    But these two libraries can not co-exist in the same sketch either directly or through libraries.

    That is if you include i2c_t3, and want to use another library that uses the Wire library. You often then have to make a copy of that library (maybe with different name) and edit it to replace all of the #include <Wire.h> to #include <i2c_t3.h>

    You may then also have to change some of the code in the library as i2c_t3 is not 100% compatible with Wire. In particular things like: setSCL and setSDA are not implemented. He has a different way to handle alternate pins.

    Good luck

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •