From b5bed4a272c13358d4ee6c7ace26cc501a130b39 Mon Sep 17 00:00:00 2001 From: Sam Der Date: Tue, 28 May 2024 21:40:57 -0700 Subject: [PATCH] Add code to initialize gyroscope (#87) --- pod-operation/src/components/gyro.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pod-operation/src/components/gyro.rs b/pod-operation/src/components/gyro.rs index 00eac056..8d3e4c0a 100644 --- a/pod-operation/src/components/gyro.rs +++ b/pod-operation/src/components/gyro.rs @@ -1,4 +1,5 @@ use mpu6050::Mpu6050; +use rppal::hal::Delay; use rppal::i2c::I2c; pub struct Gyroscope { @@ -13,7 +14,8 @@ pub struct Orientation { impl Gyroscope { pub fn new() -> Self { let i2c = I2c::new().unwrap(); - let mpu6050 = Mpu6050::new(i2c); + let mut mpu6050 = Mpu6050::new(i2c); + mpu6050.init(&mut Delay::new()).unwrap(); Gyroscope { mpu6050 } }