MHVLib  20111227
An efficiency oriented runtime library for AVR microcontrollers
MHV_StepperMotor Class Reference

#include <MHV_StepperMotor.h>

Inheritance diagram for MHV_StepperMotor:
MHV_AlarmListener MHV_StepperMotorUnipolar

List of all members.

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 ()

Detailed Description

Definition at line 39 of file MHV_StepperMotor.h.


Constructor & Destructor Documentation

MHV_StepperMotor::MHV_StepperMotor ( MHV_RTC &  rtc)

Create a new StepperMotor

Parameters:
rtcan RTC we will use to trigger events

Definition at line 33 of file MHV_StepperMotor.cpp.


Member Function Documentation

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

Returns:
the current position

Definition at line 53 of file MHV_StepperMotor.cpp.

bool MHV_StepperMotor::isMoving ( )

Is the motor current moving?

Returns:
true if the motor is 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

Parameters:
listenerthe 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)

Parameters:
forwardtrue to move forward
speedthe speed to move in steps/second
untilthe 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

Parameters:
positionthe new position

Definition at line 45 of file MHV_StepperMotor.cpp.

virtual void MHV_StepperMotor::step ( bool  forward) [pure virtual]

Implemented in MHV_StepperMotorUnipolar.


The documentation for this class was generated from the following files: