StepperDriver modification
Diff: StepperDriver.h
- Revision:
- 0:12be56dc6182
- Child:
- 1:9888802e71b9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/StepperDriver.h Thu Dec 01 13:35:45 2016 +0000 @@ -0,0 +1,24 @@ +#ifndef STEPPER_DRIVER_H +#define STEPPER_DRIVER_H + +#include "mbed.h" + +class StepperDriver { + public: + StepperDriver(PinName, PinName); + void setPosition(uint32_t); + + private: + DigitalOut output, direction; + uint32_t currentPosition, previousPosition, homePosition, minPosition, maxPosition, desiredPosition; + Ticker ticker; + Timeout timeout; + void update(); + void attachTicker(); + void detachTicker(); + void generateImpulse(); + void turnOutputOff(); + bool isTickerAttached; +}; + +#endif \ No newline at end of file