Hello. Best regards from Colombia.
I'm using your I2Cdevlib library (which is amazing) for a project I'm developing with the Teensy 3.2 platform. As I am using Teensy 3.2, I would like to use the two native i2c interfaces provided by the platform ... but this is where the problem comes from.
I2Cdevlib uses Wire.h (from the Teensy platform) to work, but I want to use i2c_t3 (New I2C library for Teensy3 by NOX771: https://forum.pjrc.com/threads/21680-New-I2C-library-for -Teensy3/).
What did I try to do?
Replace all #include <Wire.h> with #include <i2c_t3.h>, including the "#include" of your library. I get the following set of errors:
In file included from /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/WProgram.h:15:0,
from /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/Arduino.h:1,
from /Applications/Arduino.app/Contents/Java/libraries/I2CDev/I2Cdev.h:80,
from /Applications/Arduino.app/Contents/Java/libraries/I2CDev/I2Cdev.cpp:46:
/Applications/Arduino.app/Contents/Java/libraries/I2CDev/I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readBytes(uint8_t, uint8_t, uint8_t, uint8_t*, uint16_t)':
/Applications/Arduino.app/Contents/Java/libraries/I2CDev/I2Cdev.cpp:276:62: error: 'BUFFER_LENGTH' was not declared in this scope
for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH)) {
^
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/wiring.h:69:10: note: in definition of macro 'min'
typeof(b) _b = (b); \
^
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/wiring.h:69:16: error: invalid type in declaration before '=' token
typeof(b) _b = (b); \
^
/Applications/Arduino.app/Contents/Java/libraries/I2CDev/I2Cdev.cpp:276:50: note: in expansion of macro 'min'
for (uint8_t k = 0; k < length; k += min(length, BUFFER_LENGTH)) {
^
/Applications/Arduino.app/Contents/Java/libraries/I2CDev/I2Cdev.cpp:281:68: error: 'BUFFER_LENGTH' was not declared in this scope
Wire.requestFrom(devAddr, (uint8_t)min(length - k, BUFFER_LENGTH));
^
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/wiring.h:69:10: note: in definition of macro 'min'
typeof(b) _b = (b); \
^
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/wiring.h:69:16: error: invalid type in declaration before '=' token
typeof(b) _b = (b); \
^
/Applications/Arduino.app/Contents/Java/libraries/I2CDev/I2Cdev.cpp:281:52: note: in expansion of macro 'min'
Wire.requestFrom(devAddr, (uint8_t)min(length - k, BUFFER_LENGTH));
^
/Applications/Arduino.app/Contents/Java/libraries/I2CDev/I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readWords(uint8_t, uint8_t, uint8_t, uint16_t*, uint16_t)':
/Applications/Arduino.app/Contents/Java/libraries/I2CDev/I2Cdev.cpp:414:70: error: 'BUFFER_LENGTH' was not declared in this scope
for (uint8_t k = 0; k < length * 2; k += min(length * 2, BUFFER_LENGTH)) {
^
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/wiring.h:69:10: note: in definition of macro 'min'
typeof(b) _b = (b); \
^
/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/wiring.h:69:16: error: invalid type in declaration before '=' token
typeof(b) _b = (b); \
^
/Applications/Arduino.app/Contents/Java/libraries/I2CDev/I2Cdev.cpp:414:54: note: in expansion of macro 'min'
for (uint8_t k = 0; k < length * 2; k += min(length * 2, BUFFER_LENGTH)) {
^
What are my options?
I want to use I2Cdevlib for my project, but I do not know how to use the two native i2c interfaces of Teensy 3.2. How can I make both things work? I hope you have an answer for me, at least a little light on how to solve the problem. Should I refer to the i2c_t3 developer to solve the problem?
Thank you very much.
Manuel Vélez