summaryrefslogtreecommitdiffstats
path: root/sensors/gyroscope/itg3200.vala
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2012-10-30 11:19:10 +0100
committerSebastian Reichel <sre@ring0.de>2012-10-30 11:19:10 +0100
commita0bd460f7f901d48d111511d9e7c2d92aaac0fa2 (patch)
treef8278ea6dfc91ed40184d57de9d4f1a3e98a737d /sensors/gyroscope/itg3200.vala
parent7a65e7f29e526e99636438bbb529f87bf87b8c66 (diff)
downloadmicrocopterd-a0bd460f7f901d48d111511d9e7c2d92aaac0fa2.tar.bz2
update rate
Diffstat (limited to 'sensors/gyroscope/itg3200.vala')
-rw-r--r--sensors/gyroscope/itg3200.vala8
1 files changed, 6 insertions, 2 deletions
diff --git a/sensors/gyroscope/itg3200.vala b/sensors/gyroscope/itg3200.vala
index e616848..bc99769 100644
--- a/sensors/gyroscope/itg3200.vala
+++ b/sensors/gyroscope/itg3200.vala
@@ -14,7 +14,7 @@
*/
public class ITG3200 : I2CDevice, Gyroscope {
- public int[] rate { get; set; }
+ public double[] rate { get; set; }
private int[] zero = new int[3];
/* ITG3200 14.375 LSBs per °/sec in radians */
@@ -37,7 +37,7 @@ public class ITG3200 : I2CDevice, Gyroscope {
}
public void init(KeyFile cfg) throws KeyFileError, I2CError {
- rate = new int[3];
+ rate = new double[3];
var adapter = cfg.get_uint64("ITG3200", "i2c-adapter");
var address = cfg.get_uint64("ITG3200", "i2c-address");
@@ -88,6 +88,10 @@ public class ITG3200 : I2CDevice, Gyroscope {
x = ((int16) get_big_word(0x1d)-zero[AXIS.X]) / scale;
y = ((int16) get_big_word(0x1f)-zero[AXIS.Y]) / scale;
z = ((int16) get_big_word(0x21)-zero[AXIS.Z]) / scale;
+
+ rate[AXIS.X] = radians(x);
+ rate[AXIS.Y] = radians(y);
+ rate[AXIS.Z] = radians(z);
}
}