StepperDriver modification
StepperDriver.h@0:12be56dc6182, 2016-12-01 (annotated)
- Committer:
- tbjazic
- Date:
- Thu Dec 01 13:35:45 2016 +0000
- Revision:
- 0:12be56dc6182
- Child:
- 1:9888802e71b9
Initial commit.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tbjazic | 0:12be56dc6182 | 1 | #ifndef STEPPER_DRIVER_H |
tbjazic | 0:12be56dc6182 | 2 | #define STEPPER_DRIVER_H |
tbjazic | 0:12be56dc6182 | 3 | |
tbjazic | 0:12be56dc6182 | 4 | #include "mbed.h" |
tbjazic | 0:12be56dc6182 | 5 | |
tbjazic | 0:12be56dc6182 | 6 | class StepperDriver { |
tbjazic | 0:12be56dc6182 | 7 | public: |
tbjazic | 0:12be56dc6182 | 8 | StepperDriver(PinName, PinName); |
tbjazic | 0:12be56dc6182 | 9 | void setPosition(uint32_t); |
tbjazic | 0:12be56dc6182 | 10 | |
tbjazic | 0:12be56dc6182 | 11 | private: |
tbjazic | 0:12be56dc6182 | 12 | DigitalOut output, direction; |
tbjazic | 0:12be56dc6182 | 13 | uint32_t currentPosition, previousPosition, homePosition, minPosition, maxPosition, desiredPosition; |
tbjazic | 0:12be56dc6182 | 14 | Ticker ticker; |
tbjazic | 0:12be56dc6182 | 15 | Timeout timeout; |
tbjazic | 0:12be56dc6182 | 16 | void update(); |
tbjazic | 0:12be56dc6182 | 17 | void attachTicker(); |
tbjazic | 0:12be56dc6182 | 18 | void detachTicker(); |
tbjazic | 0:12be56dc6182 | 19 | void generateImpulse(); |
tbjazic | 0:12be56dc6182 | 20 | void turnOutputOff(); |
tbjazic | 0:12be56dc6182 | 21 | bool isTickerAttached; |
tbjazic | 0:12be56dc6182 | 22 | }; |
tbjazic | 0:12be56dc6182 | 23 | |
tbjazic | 0:12be56dc6182 | 24 | #endif |