git.droids-corp.org
/
protos
/
imu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
0a4bfd3
)
fix imu configuration
author
Olivier Matz
<zer0@droids-corp.org>
Thu, 26 Jun 2014 18:38:09 +0000
(20:38 +0200)
committer
Olivier Matz
<zer0@droids-corp.org>
Thu, 26 Jun 2014 18:38:09 +0000
(20:38 +0200)
mpu6050.c
patch
|
blob
|
history
diff --git
a/mpu6050.c
b/mpu6050.c
index
5ffa100
..
143d0e9
100644
(file)
--- a/
mpu6050.c
+++ b/
mpu6050.c
@@
-16,9
+16,9
@@
// fs_sel = 1
// 500°/s
// fs_sel = 1
// 500°/s
-#define gyro_x_resolution 66.5
-#define gyro_y_resolution 66.5
-#define gyro_z_resolution 66.5
+/* #define gyro_x_resolution 66.5 */
+/* #define gyro_y_resolution 66.5 */
+/* #define gyro_z_resolution 66.5 */
// fs_sel = 3
// 2000°/s
// fs_sel = 3
// 2000°/s
@@
-26,9
+26,9
@@
#define gyro_y_resolution 16.4
#define gyro_z_resolution 16.4
#define gyro_y_resolution 16.4
#define gyro_z_resolution 16.4
-#define accel_x_resolution
8192
.0
-#define accel_y_resolution
8192
.0
-#define accel_z_resolution
8192
.0
+#define accel_x_resolution
2048
.0
+#define accel_y_resolution
2048
.0
+#define accel_z_resolution
2048
.0
@@
-37,8
+37,8
@@
#define MPU6050_OFF_LSB 0
#define MPU6050_OFF_LSB 0
-#define MPU6050_ADDRESS 0x6
8
-#define MPU6050_MAGNETO_ADDRESS 0x0
C
+#define MPU6050_ADDRESS 0x6
9
+#define MPU6050_MAGNETO_ADDRESS 0x0
D
#define SWAP_16(a) ((( (a) & 0xff)<<8) | (( (a) >> 8) & 0xff))
#define SWAP_16(a) ((( (a) & 0xff)<<8) | (( (a) >> 8) & 0xff))
@@
-192,7
+192,7
@@
uint8_t mpu6050_init(void)
while(1) {
while(1) {
- err = read_reg(MPU6050_ADDRESS,
0x75
, &id);
+ err = read_reg(MPU6050_ADDRESS,
MPU6050_RA_WHO_AM_I
, &id);
if (err)
continue;
if (id == 0x68)
if (err)
continue;
if (id == 0x68)
@@
-210,9
+210,9
@@
uint8_t mpu6050_init(void)
//Disable gyro self tests, scale of 2000 degrees/s
send_mpu6050_cmd(MPU6050_ADDRESS, MPU6050_RA_GYRO_CONFIG, 0b00011000);
//Disable gyro self tests, scale of 2000 degrees/s
send_mpu6050_cmd(MPU6050_ADDRESS, MPU6050_RA_GYRO_CONFIG, 0b00011000);
+ //Disable accel self tests, scale of +-16g, no DHPF
+ send_mpu6050_cmd(MPU6050_ADDRESS, MPU6050_RA_ACCEL_CONFIG, 0b00011000);
- //Disable accel self tests, scale of +-4g, no DHPF
- send_mpu6050_cmd(MPU6050_ADDRESS, MPU6050_RA_ACCEL_CONFIG, 0b00001000);
//Freefall threshold of <|0mg|
send_mpu6050_cmd(MPU6050_ADDRESS, MPU6050_RA_FF_THR, 0x00);
//Freefall duration limit of 0
//Freefall threshold of <|0mg|
send_mpu6050_cmd(MPU6050_ADDRESS, MPU6050_RA_FF_THR, 0x00);
//Freefall duration limit of 0