Class to interface with the Disgruntled Car.

Dependencies:   FRDM-TFC MMA8451Q mbed-dsp mbed

Committer:
jmar11
Date:
Fri Mar 03 18:54:40 2017 +0000
Revision:
0:22435aad2270
Child:
2:616e8ea9b3b0
First commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jmar11 0:22435aad2270 1 /**
jmar11 0:22435aad2270 2 * @file Disgruntled_Car.h
jmar11 0:22435aad2270 3 *
jmar11 0:22435aad2270 4 * @author Jaime Martinez
jmar11 0:22435aad2270 5 *
jmar11 0:22435aad2270 6 * @section DESCRIPTION
jmar11 0:22435aad2270 7 *
jmar11 0:22435aad2270 8 *
jmar11 0:22435aad2270 9 */
jmar11 0:22435aad2270 10 #ifndef __DISGRUNTLED_CAR_H__
jmar11 0:22435aad2270 11 #define __DISGRUNTLED_CAR_H__
jmar11 0:22435aad2270 12 /**
jmar11 0:22435aad2270 13 * Includes
jmar11 0:22435aad2270 14 */
jmar11 0:22435aad2270 15 #include "mbed.h"
jmar11 0:22435aad2270 16 #include "arm_math.h"
jmar11 0:22435aad2270 17 #include "TFC.h"
jmar11 0:22435aad2270 18 #include "MMA8451Q.h"
jmar11 0:22435aad2270 19
jmar11 0:22435aad2270 20 /**
jmar11 0:22435aad2270 21 * Defines
jmar11 0:22435aad2270 22 */
jmar11 0:22435aad2270 23 #define MMA_ADDR 0x1D
jmar11 0:22435aad2270 24 #define MMA_SCL PTE24
jmar11 0:22435aad2270 25 #define MMA_SDA PTE25
jmar11 0:22435aad2270 26 #define MMA_INT1 PTA14
jmar11 0:22435aad2270 27 #define MMA_INT2 PTA15
jmar11 0:22435aad2270 28 //more defines for the accelorometer registers
jmar11 0:22435aad2270 29
jmar11 0:22435aad2270 30 /**
jmar11 0:22435aad2270 31 * disgruntledcar
jmar11 0:22435aad2270 32 */
jmar11 0:22435aad2270 33 class disgruntledcar {
jmar11 0:22435aad2270 34 public:
jmar11 0:22435aad2270 35
jmar11 0:22435aad2270 36 disgruntledcar();
jmar11 0:22435aad2270 37
jmar11 0:22435aad2270 38 void initServo(float ServoPulseWidthMin, float ServoPulseWidthMax, float ServoPeriod);
jmar11 0:22435aad2270 39 void initMotor(float SwitchingFrequency);
jmar11 0:22435aad2270 40
jmar11 0:22435aad2270 41 bool getSwitch1();
jmar11 0:22435aad2270 42 bool getSwitch2();
jmar11 0:22435aad2270 43 bool getSwitch3();
jmar11 0:22435aad2270 44 bool getSwitch4();
jmar11 0:22435aad2270 45
jmar11 0:22435aad2270 46 bool getButtonA();
jmar11 0:22435aad2270 47 bool getButtonB();
jmar11 0:22435aad2270 48
jmar11 0:22435aad2270 49 float getPotentA();
jmar11 0:22435aad2270 50 float getPotentB();
jmar11 0:22435aad2270 51
jmar11 0:22435aad2270 52 float getBatteryVolt();
jmar11 0:22435aad2270 53
jmar11 0:22435aad2270 54 bool getCamImage(float comcam0[], float comcam1[]);
jmar11 0:22435aad2270 55
jmar11 0:22435aad2270 56 void setServoPos(float pos);
jmar11 0:22435aad2270 57
jmar11 0:22435aad2270 58 void setMotorSpeed(float spda, float spdb);
jmar11 0:22435aad2270 59
jmar11 0:22435aad2270 60 void setBatteryLED(uint8_t lvl);
jmar11 0:22435aad2270 61
jmar11 0:22435aad2270 62 void setLED(uint8_t msk);
jmar11 0:22435aad2270 63
jmar11 0:22435aad2270 64 float getAccX();
jmar11 0:22435aad2270 65 float getAccY();
jmar11 0:22435aad2270 66 float getAccZ();
jmar11 0:22435aad2270 67
jmar11 0:22435aad2270 68 void getAccReg(int addr, uint8_t * data, int len);
jmar11 0:22435aad2270 69 void setAccReg(uint8_t * data, int len);
jmar11 0:22435aad2270 70
jmar11 0:22435aad2270 71 void conv(float a[], int lena, float b[], int lenb, float out[]);
jmar11 0:22435aad2270 72
jmar11 0:22435aad2270 73 private:
jmar11 0:22435aad2270 74
jmar11 0:22435aad2270 75 MMA8451Q acc;
jmar11 0:22435aad2270 76
jmar11 0:22435aad2270 77 };
jmar11 0:22435aad2270 78
jmar11 0:22435aad2270 79 #endif /*__DISGRUNTLED_CAR_H__*/