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

Thread: how to use i2c_t3 and u8g2

  1. #1
    Senior Member
    Join Date
    Nov 2015
    Posts
    189

    how to use i2c_t3 and u8g2

    Hi, i'm in trouble with a project
    i need to use the wire2 (for the pin 3 and 4 and it works with the scanner) to communicate with my display, but the u8g2 library need wire or something else ...
    I'm sure it's a simple thing but I can not find a solution

    Can someone point me to the right direction?
    Thanks

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,610
    Link to the driver lib seems to be called for … there isn't a ref to 'u8g2'in the Teensy sources.

  3. #3
    Senior Member
    Join Date
    Nov 2015
    Posts
    189
    sorry I did not understand...

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,610
    What is the source link for "the u8g2 library" with troubles?

  5. #5
    Senior Member
    Join Date
    Nov 2015
    Posts
    189
    i have a ssd1306 display on the wire2 bus (3/4 on teensy 3.6), it require i2c_t3
    if i use the example advanced_Scanner for i2c_t3, i see that the address of the display is 03XC
    from what I understand, however, to make the display work with the library u8g2, i need the library wire.h that can not coexist with the i2c_t3

  6. #6
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,097
    The difficulty is that the code is hard coded to use the WIRE object. So it would take changes to support other I2C objects.

    Note: The Wire library supports the other objects as well. There is WIRE2, WIRE3... It would be nice if one of their constructors, allowed you to pass in a pointer to a TwoWire object, then you could pass in the one you want to use and could also use that solution for other Arduino platforms as well...

    At times I have also thought about hacks to make it easier... That is make the WIRE object be settable to which actual hardware object it is actually using...
    Something like: WIRE.setWireObject(Wire2); It would default to Wire1 or or maybe Wire0...

    Note: The version of the U8g2 library I have, I installed using the Arduino Library manager...

  7. #7
    Senior Member
    Join Date
    Nov 2015
    Posts
    189
    Is not possible with setSCL( ) and setSDA() right?
    wire.setSCL(pin) is not equal to wire2.setSCL...

  8. #8
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,097
    That is correct: Wire.setSCL(3);

    Will not work as pin 3 is not a valid SCL pin for the Wire object. It is valid for the Wire2 object...

    Currently in order to use the Wire2 object instead of the Wire object, everything in the code that does something like Wire.transfer() needs to call Wire2.transfer() ... And likewise for all of the other calls...

  9. #9
    Senior Member
    Join Date
    Nov 2015
    Posts
    189
    Is better to fork the display library (u8g2) and use the regular i2c_t3 or viceversa?

  10. #10
    Senior Member
    Join Date
    Nov 2015
    Posts
    189
    I modified the u8g2 library to work with wire2, seems to work

Posting Permissions

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