It is modified accordingly to work with sparkfun dmp library under mbed platform
Dependents: MPU9250-dmp-bluepill MPU9250-dmp
Fork of MotionDriver_6_1 by
Diff: mdcompat.cpp
- Revision:
- 2:e7e761471df9
- Parent:
- 1:a6c3f8680fe0
- Child:
- 3:8f2d21735748
--- a/mdcompat.cpp Mon Aug 07 13:49:51 2017 +0000 +++ b/mdcompat.cpp Tue Aug 08 08:38:48 2017 +0000 @@ -1,6 +1,6 @@ #include "mdcompat.h" #include "mbed.h" // must be out of the scope of extern "C" -I2C imu9250(PB_7,PB_6); +I2C imu9250(I2C_SDA,I2C_SCL); void imu_init(void){ imu9250.frequency(400000); @@ -33,10 +33,9 @@ unsigned char reg_addr, unsigned char length, char *data) { - - imu9250.write((int)slave_addr,(char const*)reg_addr,1,true);//sending register adress first to indicate which register we are writing and a write register(0) - imu9250.read((int)slave_addr,data,(int)length,false); - return 0; + imu9250.write((int)slave_addr,(const char*)reg_addr, 1, 1); // no stop + imu9250.read((unsigned int)slave_addr, data, 1, 0); + return 0; } int delay_ms(