Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of MPU9250_SPI by
Diff: MPU9250.h
- Revision:
- 5:f15d1d9d1561
- Parent:
- 4:79185409730f
- Child:
- 6:c82c48348f8c
--- a/MPU9250.h Thu Jun 26 13:03:12 2014 +0000 +++ b/MPU9250.h Sun Jun 29 06:38:21 2014 +0000 @@ -1,38 +1,4 @@ /*CODED by Qiyong Mu on 21/06/2014 - -CODED changed from Bruno Alfano on 07/03/2014 -www.xene.it - -USAGE (example program): -#include "mbed.h" -#include "mpu9250.h" //Include library -SPI spi(p11, p12, p13); //define the SPI (mosi, miso, sclk) -mpu9250_spi imu(spi,p22); //define the mpu9250 object -int main(){ - if(imu.init(1,BITS_DLPF_CFG_5HZ)){ //INIT the mpu9250 - printf("\nCouldn't initialize mpu9250 via SPI!"); - } - wait(0.1); - printf("\n\nWHOAMI=%u\n",imu.whoami()); //output the I2C address to know if SPI is working, it should be 104 - wait(0.1); - printf("\nGyro_scale=%u\n",imu.set_gyro_scale(BITS_FS_2000DPS)); //Set full scale range for gyros - wait(1); - printf("\nAcc_scale=%u\n",imu.set_acc_scale(BITS_FS_16G)); //Set full scale range for accs - wait(0.1); - while(1) { - myled = 1; - wait(0.3); - myled = 0; - wait(0.3); - printf("\nT=%.3f",imu.read_temp()); - printf(" X=%.3f",imu.read_acc(0)); - printf(" Y=%.3f",imu.read_acc(1)); - printf(" Z=%.3f",imu.read_acc(2)); - printf(" rX=%.3f",imu.read_rot(0)); - printf(" rY=%.3f",imu.read_rot(1)); - printf(" rZ=%.3f",imu.read_rot(2)); - } -} */ @@ -206,7 +172,7 @@ #define MPUREG_ZA_OFFSET_L 0x7E /* ---- AK8963 Reg In MPU9250 ----------------------------------------------- */ -#define AK8963_I2C_ADDR 0x18 +#define AK8963_I2C_ADDR 0x0c//0x18 #define AK8963_Device_ID 0x48 // Read-only Reg