Rpi-hw  0.7.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Protected Attributes | List of all members
rpihw::motor::stepper Class Reference

Motor stepper controller. More...

#include <stepper.hpp>

Public Member Functions

 stepper (size_t steps, uint8_t pin0, uint8_t pin1)
 Constructor method. More...
 
 stepper (size_t steps, uint8_t pin0, uint8_t pin1, uint8_t pin2, uint8_t pin3)
 Constructor method. More...
 
virtual ~stepper ()
 Destructor method.
 
void setSteps (size_t steps)
 Sets the number of steps per revolution. More...
 
size_t getSteps () const
 Returns the number of steps per revolution. More...
 
void setSequence (const std::vector< uint8_t > &sequence)
 Sets the moving sequence. More...
 
void setSpeed (double rpm)
 Sets the motor speed in rotations per minute (RPMs). More...
 
double getSpeed () const
 Returns the motor speed in rotations per minute (RPMs). More...
 
void setDirection (Direction direction)
 Sets the motor direction. More...
 
Direction getDirection () const
 Returns the current motor direction. More...
 
void step (size_t number=1)
 Moves the motor one or more steps. More...
 
void rotate (double angle)
 Rotates the motor. More...
 

Static Public Attributes

static const std::vector< uint8_t > seq_2wire
 Some moving sequences.
 
static const std::vector< uint8_t > seq_wave
 
static const std::vector< uint8_t > seq_full
 
static const std::vector< uint8_t > seq_half
 

Protected Attributes

iface::outputm_motor
 Output interface to the display.
 
std::vector< uint8_t > m_sequence
 Moving sequence.
 
Direction m_direction
 Motor direction.
 
double m_rpm
 Motor speed in rotations per minute (RPMs).
 
size_t m_steps
 Number of steps per revolution.
 
size_t m_counter
 Steps counter.
 

Detailed Description

Motor stepper controller.

Examples:
motor/28bjy48.cpp.

Definition at line 57 of file stepper.hpp.

Constructor & Destructor Documentation

rpihw::motor::stepper::stepper ( size_t  steps,
uint8_t  pin0,
uint8_t  pin1 
)

Constructor method.

Parameters
[in]stepsThe number of steps per revolution.
[in]pin0The GPIO pin connected to the data pin #0 of the stepper controller.
[in]pin1The GPIO pin connected to the data pin #1 of the stepper controller.
rpihw::motor::stepper::stepper ( size_t  steps,
uint8_t  pin0,
uint8_t  pin1,
uint8_t  pin2,
uint8_t  pin3 
)

Constructor method.

Parameters
[in]stepsThe number of steps per revolution.
[in]pin0The GPIO pin connected to the data pin #0 of the stepper controller.
[in]pin1The GPIO pin connected to the data pin #1 of the stepper controller.
[in]pin2The GPIO pin connected to the data pin #2 of the stepper controller.
[in]pin3The GPIO pin connected to the data pin #3 of the stepper controller.

Member Function Documentation

Direction rpihw::motor::stepper::getDirection ( ) const
inline

Returns the current motor direction.

Returns
The current motor direction.

Definition at line 65 of file stepper-inl.hpp.

double rpihw::motor::stepper::getSpeed ( ) const
inline

Returns the motor speed in rotations per minute (RPMs).

Returns
The currente number of rotations per minute.

Definition at line 51 of file stepper-inl.hpp.

size_t rpihw::motor::stepper::getSteps ( ) const
inline

Returns the number of steps per revolution.

Returns
The current number of rotations per minute.

Definition at line 37 of file stepper-inl.hpp.

void rpihw::motor::stepper::rotate ( double  angle)

Rotates the motor.

Parameters
[in]angleThe angle rotation (in degrees).
Examples:
motor/28bjy48.cpp.
void rpihw::motor::stepper::setDirection ( Direction  direction)
inline

Sets the motor direction.

Parameters
[in]directionThe motor direction.
Examples:
motor/28bjy48.cpp.

Definition at line 58 of file stepper-inl.hpp.

void rpihw::motor::stepper::setSequence ( const std::vector< uint8_t > &  sequence)

Sets the moving sequence.

Parameters
[in]sequenceThe moving sequence.
void rpihw::motor::stepper::setSpeed ( double  rpm)
inline

Sets the motor speed in rotations per minute (RPMs).

Parameters
[in]rpmThe number of rotations per minute.
Examples:
motor/28bjy48.cpp.

Definition at line 44 of file stepper-inl.hpp.

void rpihw::motor::stepper::setSteps ( size_t  steps)
inline

Sets the number of steps per revolution.

Parameters
[in]stepsThe number of rotations per minute.

Definition at line 30 of file stepper-inl.hpp.

void rpihw::motor::stepper::step ( size_t  number = 1)

Moves the motor one or more steps.

Parameters
[in]numberNumber of steps.

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