My Version of the Crealab MotorLib.
Fork of MotorLib by
Diff: motor.h
- Revision:
- 4:c009bcd5518c
- Parent:
- 3:01b4c058454d
- Child:
- 5:9886fd337a4b
--- a/motor.h Fri Jun 24 14:57:25 2016 +0000 +++ b/motor.h Tue Aug 23 11:33:46 2016 +0000 @@ -19,8 +19,8 @@ } MotorCommand; typedef enum MotorDirectionList { // Define Motor Clockwise or Anticlockwise - DIRECTION_CLOCKWISE = 0, - DIRECTION_COUNTERCLOCKWISE + CLOCKWISE = 0, + COUNTERCLOCKWISE } MotorDir; class Motor { @@ -31,22 +31,29 @@ public: + - Motor(PinName _MPh0, PinName _MPh1, PinName _MPh2, PinName _MPh3); + Motor(PinName _MPh0, PinName _MPh1, PinName _MPh2, PinName _MPh3, uint32_t TickTime); void RunSteps(MotorDir direction, uint32_t steps); void RunDegrees(MotorDir direction, float steps); + void SetDirection(MotorDir dir); + void TestMotor(); + void RunMotor(); + + void Start(); + void Stop(); + void Pause(); + void Restart(); + void SetZero(); + + private: void StopMotor(); void StartMotor(); - void SetDirection(MotorDir dir); void SetCommand(MotorCommand cmd); - void TestMotor(); - void RunMotor(); void LeftMotor(); void RightMotor(); void ProcessMotorStateMachine(); - - private: - + DigitalOut *MPh0, *MPh1, *MPh2, *MPh3; int MotorIndex; // --- Motor Variable