Sooner Competitive Robotics / Mbed 2 deprecated IEEE_14_Freescale

Dependencies:   mbed

Fork of IEEE_14_Freescale by IEEE 2014 Mbed

Committer:
soonerbot
Date:
Thu Apr 03 21:24:10 2014 +0000
Revision:
51:4892c9238c33
Parent:
28:c7e8d2db03f5
update

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;
sswatek 28:c7e8d2db03f5 37 double xoffs,zoffs,xamp,zamp;
sswatek 28:c7e8d2db03f5 38 double compDir;
soonerbot 4:adc885f4ab75 39 float checkCompass();
soonerbot 4:adc885f4ab75 40
soonerbot 1:c28fac16a109 41 void gyroUpkeep();
soonerbot 1:c28fac16a109 42 gyroReader(PinName pinA, PinName pinB);
soonerbot 1:c28fac16a109 43
soonerbot 1:c28fac16a109 44 void setLevel();
soonerbot 1:c28fac16a109 45 void resetZ();
soonerbot 1:c28fac16a109 46 int getZ();
soonerbot 4:adc885f4ab75 47 double getZDegrees();
soonerbot 1:c28fac16a109 48 int getX();
soonerbot 1:c28fac16a109 49 int getPolls(){ return polls;}
soonerbot 4:adc885f4ab75 50 int compZ(int compVal);
soonerbot 1:c28fac16a109 51 void reset();
soonerbot 1:c28fac16a109 52 void calibrate();
soonerbot 12:925f52da3ba9 53 void start();
soonerbot 12:925f52da3ba9 54 void stop();
soonerbot 1:c28fac16a109 55 };
soonerbot 1:c28fac16a109 56
soonerbot 1:c28fac16a109 57 #endif