
Class to interface with the Disgruntled Car.
Dependencies: FRDM-TFC MMA8451Q mbed-dsp mbed
Revision 2:616e8ea9b3b0, committed 2017-03-03
- Comitter:
- jmar11
- Date:
- Fri Mar 03 20:06:14 2017 +0000
- Parent:
- 1:611e47a880b1
- Commit message:
- fixed namespace issue
Changed in this revision
Disgruntled_Car.cpp | Show annotated file Show diff for this revision Revisions of this file |
Disgruntled_Car.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/Disgruntled_Car.cpp Fri Mar 03 18:57:32 2017 +0000 +++ b/Disgruntled_Car.cpp Fri Mar 03 20:06:14 2017 +0000 @@ -2,14 +2,16 @@ #include "TFC.h" #include "mbed.h" -disgruntledcar::disgruntledcar() : acc(MMA_SDA, MMA_SCL, MMA_ADDR) {} - -void disgruntledcar::initServo(float ServoPulseWidthMin, float ServoPulseWidthMax, float ServoPeriod) { - TFC_InitServos(ServoPulseWidthMin, ServoPulseWidthMax, ServoPeriod); +disgruntledcar::disgruntledcar() : acc(MMA_SDA, MMA_SCL, MMA_ADDR) { + TFC_Init(); } -void disgruntledcar::initMotor(float SwitchingFrequency) { - TFC_InitMotorPWM(SwitchingFrequency); +void disgruntledcar::initServo(float SerPWMin, float SerPWMax, float SerPer) { + TFC_InitServos(SerPWMin, SerPWMax, SerPer); +} + +void disgruntledcar::initMotor(float SwFreq) { + TFC_InitMotorPWM(SwFreq); } bool disgruntledcar::getSwitch1() { @@ -56,10 +58,10 @@ for(int i=0; i<128; i++){ comcam1[i] = (float)(TFC_LineScanImage1[i]); } - return 1; + return true; } else{ - return 0; + return false; } } @@ -99,7 +101,7 @@ acc.writeRegs(data, len); } -void conv(float a[], int lena, float b[], int lenb, float out[]){ +void disgruntledcar::conv(float a[], int lena, float b[], int lenb, float out[]){ int len = (2*lena)-1; float temp[len]; arm_correlate_f32(a, lena, b, lenb, temp);
--- a/Disgruntled_Car.h Fri Mar 03 18:57:32 2017 +0000 +++ b/Disgruntled_Car.h Fri Mar 03 20:06:14 2017 +0000 @@ -35,8 +35,8 @@ disgruntledcar(); - void initServo(float ServoPulseWidthMin, float ServoPulseWidthMax, float ServoPeriod); - void initMotor(float SwitchingFrequency); + void initServo(float SerPWMin, float SerPWMax, float SerPer); + void initMotor(float SwFreq); bool getSwitch1(); bool getSwitch2();