
Class to interface with the Disgruntled Car.
Dependencies: FRDM-TFC MMA8451Q mbed-dsp mbed
Diff: Disgruntled_Car.h
- Revision:
- 0:22435aad2270
- Child:
- 2:616e8ea9b3b0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Disgruntled_Car.h Fri Mar 03 18:54:40 2017 +0000 @@ -0,0 +1,79 @@ +/** + * @file Disgruntled_Car.h + * + * @author Jaime Martinez + * + * @section DESCRIPTION + * + * + */ +#ifndef __DISGRUNTLED_CAR_H__ +#define __DISGRUNTLED_CAR_H__ +/** + * Includes + */ +#include "mbed.h" +#include "arm_math.h" +#include "TFC.h" +#include "MMA8451Q.h" + + /** + * Defines + */ +#define MMA_ADDR 0x1D +#define MMA_SCL PTE24 +#define MMA_SDA PTE25 +#define MMA_INT1 PTA14 +#define MMA_INT2 PTA15 +//more defines for the accelorometer registers + +/** + * disgruntledcar + */ +class disgruntledcar { +public: + + disgruntledcar(); + + void initServo(float ServoPulseWidthMin, float ServoPulseWidthMax, float ServoPeriod); + void initMotor(float SwitchingFrequency); + + bool getSwitch1(); + bool getSwitch2(); + bool getSwitch3(); + bool getSwitch4(); + + bool getButtonA(); + bool getButtonB(); + + float getPotentA(); + float getPotentB(); + + float getBatteryVolt(); + + bool getCamImage(float comcam0[], float comcam1[]); + + void setServoPos(float pos); + + void setMotorSpeed(float spda, float spdb); + + void setBatteryLED(uint8_t lvl); + + void setLED(uint8_t msk); + + float getAccX(); + float getAccY(); + float getAccZ(); + + void getAccReg(int addr, uint8_t * data, int len); + void setAccReg(uint8_t * data, int len); + + void conv(float a[], int lena, float b[], int lenb, float out[]); + +private: + + MMA8451Q acc; + +}; + +#endif /*__DISGRUNTLED_CAR_H__*/