Rename Gyro to AnalogGyro and make Gyro an interface.

Refactor common implementation parts of AnalogGyro into GyroBase.

This will make it possible to add digital gyros in a similar way to how
digital accelerometers were added.

Change-Id: I437ef259e9ecb81f18a91a95c5a58b6607db5e15
This commit is contained in:
Peter Johnson
2015-11-06 12:05:40 -08:00
parent e2a4556669
commit c20d34c2b6
22 changed files with 391 additions and 210 deletions

View File

@@ -6,7 +6,7 @@
/*----------------------------------------------------------------------------*/
#include <ADXL345_SPI.h>
#include <Gyro.h>
#include <AnalogGyro.h>
#include <Servo.h>
#include <Timer.h>
#include "gtest/gtest.h"
@@ -28,14 +28,14 @@ static constexpr double kAccelerometerTolerance = 0.2;
*/
class TiltPanCameraTest : public testing::Test {
protected:
static Gyro *m_gyro;
static AnalogGyro *m_gyro;
Servo *m_tilt, *m_pan;
Accelerometer *m_spiAccel;
static void SetUpTestCase() {
// The gyro object blocks for 5 seconds in the constructor, so only
// construct it once for the whole test case
m_gyro = new Gyro(TestBench::kCameraGyroChannel);
m_gyro = new AnalogGyro(TestBench::kCameraGyroChannel);
m_gyro->SetSensitivity(0.013);
}
@@ -61,7 +61,7 @@ class TiltPanCameraTest : public testing::Test {
}
};
Gyro *TiltPanCameraTest::m_gyro = nullptr;
AnalogGyro *TiltPanCameraTest::m_gyro = nullptr;
/**
* Test if the gyro angle defaults to 0 immediately after being reset.