WPILibC++  2018.4.1-20180924031742-1200-g1aa8446
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
ADXRS450_Gyro.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2015-2018 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include <stdint.h>
11 
12 #include "frc/GyroBase.h"
13 #include "frc/SPI.h"
14 
15 namespace frc {
16 
29 class ADXRS450_Gyro : public GyroBase {
30  public:
34  ADXRS450_Gyro();
35 
41  explicit ADXRS450_Gyro(SPI::Port port);
42 
43  virtual ~ADXRS450_Gyro() = default;
44 
45  ADXRS450_Gyro(ADXRS450_Gyro&&) = default;
46  ADXRS450_Gyro& operator=(ADXRS450_Gyro&&) = default;
47 
60  double GetAngle() const override;
61 
69  double GetRate() const override;
70 
78  void Reset() override;
79 
92  void Calibrate() override;
93 
94  private:
95  SPI m_spi;
96 
97  uint16_t ReadRegister(int reg);
98 };
99 
100 } // namespace frc
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18
double GetRate() const override
Return the rate of rotation of the gyro.
SPI bus interface class.
Definition: SPI.h:31
void Calibrate() override
Initialize the gyro.
ADXRS450_Gyro()
Gyro constructor on onboard CS0.
GyroBase is the common base class for Gyro implementations such as AnalogGyro.
Definition: GyroBase.h:21
double GetAngle() const override
Return the actual angle in degrees that the robot is currently facing.
void Reset() override
Reset the gyro.
Use a rate gyro to return the robots heading relative to a starting position.
Definition: ADXRS450_Gyro.h:29