Dependencies: PID_ PWMOut YMotorDriverBase YMotorDriverPusher YMotorDriverServo YMotorDriverShooter YMotorDriverSupplier
Revision 4:7b3ed02bf4cc, committed 2015-11-13
- Comitter:
- inst
- Date:
- Fri Nov 13 08:19:04 2015 +0000
- Parent:
- 3:f30031faee81
- Commit message:
Changed in this revision
diff -r f30031faee81 -r 7b3ed02bf4cc YMotorDriver.cpp --- a/YMotorDriver.cpp Wed Oct 14 06:07:50 2015 +0000 +++ b/YMotorDriver.cpp Fri Nov 13 08:19:04 2015 +0000 @@ -4,10 +4,10 @@ #include "YMotorDriverPusher.h" #include "YMotorDriverShooter.h" +YMotorDriver* YMotorDriver::mInstance = NULL; const PinName YMotorDriver::mAddressDeciderPinName[] = { dp17, dp18, dp26, dp25 }; - const char YMotorDriver::mYMotorDriverBaseAddress[] = { 0xA0 | ( 0x01 << 1 ), 0xA0 | ( 0x02 << 1 ),
diff -r f30031faee81 -r 7b3ed02bf4cc YMotorDriver.h --- a/YMotorDriver.h Wed Oct 14 06:07:50 2015 +0000 +++ b/YMotorDriver.h Fri Nov 13 08:19:04 2015 +0000 @@ -12,17 +12,24 @@ STEERING_1_ID, STEERING_2_ID, SHOOTER_ID, - GENERAL_ID, + GENERAL_ID }; + static YMotorDriver* getInstance(){ + if ( mInstance == NULL ){ + mInstance = new YMotorDriver(); + } + return mInstance; + } + void update(); + +private: YMotorDriver(); ~YMotorDriver(); - void update(); -private: - YMotorDriverBase* mYMotorDriver; + static YMotorDriver* mInstance; - static const PinName mAddressDeciderPinName[ 4 ]; + static const PinName mAddressDeciderPinName[]; static const char mYMotorDriverBaseAddress[]; static const char mYMotorDriverServoAddress[]; static const char mYMotorDriverSupplierAddress[]; @@ -37,6 +44,7 @@ static const size_t mNumOfYMotorDriverShooterAddress; static const size_t mNumOfYMotorDriverPositionManagerAddress; + YMotorDriverBase* mYMotorDriver; char mAddress; };
diff -r f30031faee81 -r 7b3ed02bf4cc YMotorDriverBase.lib --- a/YMotorDriverBase.lib Wed Oct 14 06:07:50 2015 +0000 +++ b/YMotorDriverBase.lib Fri Nov 13 08:19:04 2015 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/inst/code/YMotorDriverBase/#c8ed08beefb9 +https://developer.mbed.org/users/inst/code/YMotorDriverBase/#22f19e076931