Sooner Competitive Robotics / Mbed 2 deprecated IEEE_14_Freescale

Dependencies:   mbed

Fork of IEEE_14_Freescale by IEEE 2014 Mbed

Committer:
soonerbot
Date:
Fri Nov 22 18:00:18 2013 +0000
Revision:
7:3b2cf7efe5d1
Parent:
4:adc885f4ab75
Child:
12:925f52da3ba9
Commented most things

Who changed what in which revision?

UserRevisionLine numberNew contents of line
soonerbot 1:c28fac16a109 1 /*
soonerbot 1:c28fac16a109 2 * File: gyroReader.h
soonerbot 1:c28fac16a109 3 * Author: Shawn Swatek
soonerbot 1:c28fac16a109 4 * Originated: Spring 2013
soonerbot 1:c28fac16a109 5 * Revised: 3/29/13
soonerbot 1:c28fac16a109 6 */
soonerbot 1:c28fac16a109 7
soonerbot 1:c28fac16a109 8 #ifndef __GYROREADER__
soonerbot 1:c28fac16a109 9 #define __GYROREADER__
soonerbot 1:c28fac16a109 10
soonerbot 1:c28fac16a109 11 #include "mbed.h"
soonerbot 1:c28fac16a109 12 #include "dbgprint.h"
soonerbot 1:c28fac16a109 13
soonerbot 7:3b2cf7efe5d1 14
soonerbot 7:3b2cf7efe5d1 15 // This class deals with all the things to do with the gyro, accelerometer, and magnetometer package
soonerbot 7:3b2cf7efe5d1 16 // currently only the gyro is useful, and it's the only sensor being constantly polled.
soonerbot 1:c28fac16a109 17 class gyroReader{
soonerbot 1:c28fac16a109 18 private:
soonerbot 1:c28fac16a109 19 I2C accel;
soonerbot 1:c28fac16a109 20 int gyroZcount;
soonerbot 1:c28fac16a109 21 int gyroXcount;
soonerbot 1:c28fac16a109 22 int zcal;
soonerbot 1:c28fac16a109 23 int xcal;
soonerbot 1:c28fac16a109 24 int polls;
soonerbot 1:c28fac16a109 25 Ticker gyroUpkeepTicker;
soonerbot 1:c28fac16a109 26
soonerbot 1:c28fac16a109 27
soonerbot 1:c28fac16a109 28 int startAccel();
soonerbot 1:c28fac16a109 29
soonerbot 1:c28fac16a109 30 float checkAccel();
soonerbot 1:c28fac16a109 31
soonerbot 1:c28fac16a109 32 int checkGyro(int& xacc, int& yacc, int& zacc);
soonerbot 1:c28fac16a109 33
soonerbot 1:c28fac16a109 34 public:
soonerbot 4:adc885f4ab75 35
soonerbot 4:adc885f4ab75 36 int xmag,ymag,zmag;
soonerbot 4:adc885f4ab75 37 float checkCompass();
soonerbot 4:adc885f4ab75 38
soonerbot 1:c28fac16a109 39 void gyroUpkeep();
soonerbot 1:c28fac16a109 40 gyroReader(PinName pinA, PinName pinB);
soonerbot 1:c28fac16a109 41
soonerbot 1:c28fac16a109 42 void setLevel();
soonerbot 1:c28fac16a109 43 void resetZ();
soonerbot 1:c28fac16a109 44 int getZ();
soonerbot 4:adc885f4ab75 45 double getZDegrees();
soonerbot 1:c28fac16a109 46 int getX();
soonerbot 1:c28fac16a109 47 int getPolls(){ return polls;}
soonerbot 4:adc885f4ab75 48 int compZ(int compVal);
soonerbot 1:c28fac16a109 49 void reset();
soonerbot 1:c28fac16a109 50 void calibrate();
soonerbot 1:c28fac16a109 51 };
soonerbot 1:c28fac16a109 52
soonerbot 1:c28fac16a109 53 #endif