Dependencies: PID_ PWMOut YMotorDriverBase YMotorDriverPusher YMotorDriverServo YMotorDriverShooter YMotorDriverSupplier
Diff: YMotorDriver.h
- Revision:
- 4:7b3ed02bf4cc
- Parent:
- 2:2e3b56f045f5
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; };