alexandros
Well-known member
I'm trying to use an MPU-9250 by Sparkfun (https://www.sparkfun.com/products/13762) with a Teensy 3.2, but I can'y upload the code. I'm using the I2C example sketch that comes with its library (https://github.com/sparkfun/SparkFun_MPU-9250_Breakout_Arduino_Library), and even though it compiles fine on an Arduino UNO, with the Teensy 3.2 I get the following errors:
As a side note, I'm using the Audio board at the same time (I'm planning to use both simultaneously, for now I'm just trying to upload this example code and I'm using the board for its pull-up resistors on the I2C pins of the Teensy). I don't think that's the problem though, the IDE can't even compile the sketch for the Teensy.
It seems like there are some stuff in the library that need to be changed, but why would this sketch run fine on an Arduino and won't compile with a Teensy?
Code:
/home/alexandros/Arduino/libraries/SparkFun_MPU-9250_Breakout_Arduino_Library/src/MPU9250.cpp: In member function 'void MPU9250::magCalMPU9250(float*, float*)':
/home/alexandros/Arduino/libraries/SparkFun_MPU-9250_Breakout_Arduino_Library/src/MPU9250.cpp:608:48: error: narrowing conversion of '32768' from 'int' to 'int16_t {aka short int}' inside { } [-Wnarrowing]
int16_t mag_max[3] = {0x8000, 0x8000, 0x8000},
^
/home/alexandros/Arduino/libraries/SparkFun_MPU-9250_Breakout_Arduino_Library/src/MPU9250.cpp:608:48: error: narrowing conversion of '32768' from 'int' to 'int16_t {aka short int}' inside { } [-Wnarrowing]
/home/alexandros/Arduino/libraries/SparkFun_MPU-9250_Breakout_Arduino_Library/src/MPU9250.cpp:608:48: error: narrowing conversion of '32768' from 'int' to 'int16_t {aka short int}' inside { } [-Wnarrowing]
/home/alexandros/Arduino/libraries/SparkFun_MPU-9250_Breakout_Arduino_Library/src/MPU9250.cpp: In member function 'uint8_t MPU9250::writeByteWire(uint8_t, uint8_t, uint8_t)':
/home/alexandros/Arduino/libraries/SparkFun_MPU-9250_Breakout_Arduino_Library/src/MPU9250.cpp:734:10: warning: converting to non-pointer type 'uint8_t {aka unsigned char}' from NULL [-Wconversion-null]
return NULL;
^
Error compiling for board Teensy 3.2 / 3.1.
It seems like there are some stuff in the library that need to be changed, but why would this sketch run fine on an Arduino and won't compile with a Teensy?