|
MHVLib
20111227
An efficiency oriented runtime library for AVR microcontrollers
|
#include <MHV_StepperMotor.h>
Public Member Functions | |
| MHV_StepperMotor (MHV_RTC &rtc) | |
| virtual void | step (bool forward)=0 |
| void | setPosition (int32_t position) |
| bool | isMoving () |
| int32_t | getPosition () |
| void | rotate (bool forward, float speed, int32_t until) |
| void | alarm (const MHV_ALARM &alarm) |
| void | registerListener (MHV_StepperListener &listener) |
| void | deregisterListener () |
Definition at line 39 of file MHV_StepperMotor.h.
| MHV_StepperMotor::MHV_StepperMotor | ( | MHV_RTC & | rtc | ) |
Create a new StepperMotor
| rtc | an RTC we will use to trigger events |
Definition at line 33 of file MHV_StepperMotor.cpp.
| void MHV_StepperMotor::alarm | ( | const MHV_ALARM & | alarm | ) | [virtual] |
Called periodically to move the motor
Implements MHV_AlarmListener.
Definition at line 98 of file MHV_StepperMotor.cpp.
| void MHV_StepperMotor::deregisterListener | ( | ) |
Deregister the listener
Definition at line 138 of file MHV_StepperMotor.cpp.
| int32_t MHV_StepperMotor::getPosition | ( | ) |
Get the current position of the motor
Definition at line 53 of file MHV_StepperMotor.cpp.
| bool MHV_StepperMotor::isMoving | ( | ) |
Is the motor current moving?
Definition at line 61 of file MHV_StepperMotor.cpp.
| void MHV_StepperMotor::registerListener | ( | MHV_StepperListener & | listener | ) |
Register a listener to be notified when moves are complete
| listener | the listener to notify |
Definition at line 131 of file MHV_StepperMotor.cpp.
| void MHV_StepperMotor::rotate | ( | bool | forward, |
| float | speed, | ||
| int32_t | until | ||
| ) |
Move the motor to a new position (this will override a current move if there is one)
| forward | true to move forward |
| speed | the speed to move in steps/second |
| until | the position to stop at |
Definition at line 71 of file MHV_StepperMotor.cpp.
| void MHV_StepperMotor::setPosition | ( | int32_t | position | ) |
Mark the current position of the motor. This simply changes where we think we are, it does not move the motor
| position | the new position |
Definition at line 45 of file MHV_StepperMotor.cpp.
| virtual void MHV_StepperMotor::step | ( | bool | forward | ) | [pure virtual] |
Implemented in MHV_StepperMotorUnipolar.