Forum Rule: Always post complete source code & details to reproduce any issue!
Page 28 of 28 FirstFirst ... 18 26 27 28
Results 676 to 684 of 684

Thread: New I2C library for Teensy3

  1. #676
    Senior Member
    Join Date
    Mar 2013
    Location
    Austin TX
    Posts
    428
    Quote Originally Posted by LeD View Post
    I'm interested in the topic, my new Teensy 4.0 cannot access I2C buses to control devices I already tested with 3.2 and 3.6.
    Any news about development?
    Any suggestion about how to add some modification to the last library version to make it work (even modification not very efficient) for T4.0?

    Thank you anyway
    Sorry, I don't have anything running on T4 at the moment. I acquired some parts, but I haven't had time to work on it. For now you will have to utilize the Wire library.

  2. #677
    Not working for me; the #include <wire.h> line in the main sketch still picks up the file in C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire\W ire.h

  3. #678
    Senior Member
    Join Date
    Mar 2013
    Location
    Austin TX
    Posts
    428
    Quote Originally Posted by paynterf View Post
    Not working for me; the #include <wire.h> line in the main sketch still picks up the file in C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire\W ire.h
    To use this library you need to use #include <i2c_t3.h>, not #include <wire.h>. The example files that are included demonstrate usage.

  4. #679
    nox771,

    Hmm, This is what I tried, something from an earlier post of yours.

    Click image for larger version. 

Name:	Annotation 2020-05-22 103901.jpg 
Views:	3 
Size:	44.4 KB 
ID:	20230

    I have used your fine i2c_t3.h library in many other Teensy projects, but can't in this one because the various V53L0X libraries use Wire.h

    Regards,

    Frank

  5. #680
    Senior Member
    Join Date
    Oct 2015
    Location
    Roma (IT, EU)
    Posts
    312
    You can't include both <i2c_t3.h> and <Wire.h>. Include <i2c_t3.h> only.
    If other libraries include <Wire.h>, the only way is replacing every Wire.h with i2c_t3.h across every source of the project/library.

  6. #681
    Quote Originally Posted by paynterf View Post
    I have used your fine i2c_t3.h library in many other Teensy projects, but can't in this one because the various V53L0X libraries use Wire.h
    Here's a dirty hack that might help you to test in the short-term:

    - if you're on a Windows machine, rename the offending "Wire.h" file (to something else, maybe oldWire.h")
    - in place of the previous "Wire.h", create a shortcut named "Wire.h" that points to "i2c_t3.h"
    - if you're on a linux machine, do a similar thing, creating a soft link instead

    Mark J Culross
    KD5RXT

  7. #682
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,674
    Quote Originally Posted by kd5rxt-mark View Post
    Here's a dirty hack that might help you to test in the short-term:

    - if you're on a Windows machine, rename the offending "Wire.h" file (to something else, maybe oldWire.h")
    - in place of the previous "Wire.h", create a shortcut named "Wire.h" that points to "i2c_t3.h"
    - if you're on a linux machine, do a similar thing, creating a soft link instead

    Mark J Culross
    KD5RXT
    At least in the past you needed to define TwoWire also:
    Code:
    typedef i2c_t3 TwoWire;

  8. #683
    Thanks for the information - that sounds a whole lot easier than trying to track down all the library references.

    So, for my Windows 10 setup:

    rename 'C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire\W ire.h' to 'C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire\O ldWire.h'

    then, in an elevated command prompt:

    C:\Windows\system32>mklink /h "C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire\W ire.h" "C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\i2c_t3 \i2c_t3.h"

    Is that correct?


    What happens the next time the Arduino IDE and or TeensyDuino gets updated? Does the hard link disappear and have to be re-done?

  9. #684
    Senior Member
    Join Date
    Mar 2013
    Location
    Austin TX
    Posts
    428
    I would expect if you reinstall Arduino over the same files it will overwrite the link with the Wire.h file. There are many variations of this idea, including altering the contents of the file, or the file itself with a link as suggested, or somehow altering the build system. But they don't survive getting overwritten.

    I don't think there is an ideal solution to trivially swapping libraries. Creating some tool to do this is a reasonable project idea though, because there are always things like display libraries and such that have a dozen variants which would be nice to pick and choose what gets used.

Posting Permissions

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