#include <Stepper.h>
Definition at line 35 of file Stepper.h.
◆ Direction
Enumerator |
---|
CLOCKWISE | |
COUNTER_CLOCKWISE | |
Definition at line 138 of file Stepper.h.
◆ PinConfiguration
Enumerator |
---|
COMMON_ANODE | All + signals connected to Vdd (3v3)
|
COMMON_CATHODE | All - signals connected to Gnd.
|
Definition at line 38 of file Stepper.h.
◆ Stepper() [1/2]
Boardcore::Stepper::Stepper |
( |
miosix::GpioPin | stepPin, |
|
|
miosix::GpioPin | directionPin, |
|
|
float | speed = 1, |
|
|
float | stepAngle = 1.8, |
|
|
bool | revertDirection = false, |
|
|
uint16_t | microStep = 1, |
|
|
PinConfiguration | pinConfiguration = PinConfiguration::COMMON_CATHODE, |
|
|
miosix::GpioPin | enablePin = MockGpioPin() ) |
Construct a new Stepper object.
By default the direction pin is held low when moving forward. If the given speed is negative the motor wont move.
- Parameters
-
stepPin | Pin connected to the step signal of the driver. |
directionPin | Pin connected to the direction signal of the driver. |
speed | Number of rotations per second. |
stepAngle | Angle covered by one motor step. |
revertDirection | Whether or not revert the direction signal. |
Definition at line 27 of file Stepper.cpp.
◆ Stepper() [2/2]
Boardcore::Stepper::Stepper |
( |
const Stepper & | p | ) |
|
|
protecteddelete |
◆ disable()
void Boardcore::Stepper::disable |
( |
| ) |
|
◆ enable()
void Boardcore::Stepper::enable |
( |
| ) |
|
◆ getCurrentDegPosition()
float Boardcore::Stepper::getCurrentDegPosition |
( |
| ) |
|
|
inlinevirtual |
◆ getCurrentPosition()
int16_t Boardcore::Stepper::getCurrentPosition |
( |
| ) |
|
|
inline |
◆ getState()
StepperData Boardcore::Stepper::getState |
( |
float | moveDeg | ) |
|
Returns the current position and the current timestamp.
Definition at line 151 of file Stepper.cpp.
◆ isEnabled()
bool Boardcore::Stepper::isEnabled |
( |
| ) |
|
Returns whether the stepper is enabled or not.
Definition at line 149 of file Stepper.cpp.
◆ move()
void Boardcore::Stepper::move |
( |
int16_t | steps | ) |
|
|
virtual |
◆ moveDeg()
void Boardcore::Stepper::moveDeg |
( |
float | degrees | ) |
|
|
inline |
Move the stepper motor by the specified amount of degrees.
Definition at line 176 of file Stepper.h.
◆ operator=()
◆ setDirection()
void Boardcore::Stepper::setDirection |
( |
| ) |
|
|
protected |
Sets the directionPin to the right value to go in the direction stored in currentDirection
.
Definition at line 63 of file Stepper.cpp.
◆ setMicroStepping()
void Boardcore::Stepper::setMicroStepping |
( |
uint16_t | microStep | ) |
|
|
inlinevirtual |
Set the motor driver micro stepping configuration.
This method has no effect if micro steps are changed via physical switches.
Reimplemented in Boardcore::StepperPWM.
Definition at line 166 of file Stepper.h.
◆ setPosition()
void Boardcore::Stepper::setPosition |
( |
int16_t | steps | ) |
|
|
inlinevirtual |
Set the position of the stepper motor.
Note that this function uses delayUs, thus it blocks execution based on the stepper motor speed and movement.
Definition at line 181 of file Stepper.h.
◆ setPositionDeg()
void Boardcore::Stepper::setPositionDeg |
( |
float | degrees | ) |
|
|
inline |
Set the position of the stepper motor.
Note that this function uses delayUs, thus it blocks execution based on the stepper motor speed and movement.
Definition at line 186 of file Stepper.h.
◆ setSpeed()
void Boardcore::Stepper::setSpeed |
( |
float | speed | ) |
|
|
inlinevirtual |
Changes the stepper motor speed.
- Parameters
-
speed | Speed in rotation per second. [rev/s] |
Reimplemented in Boardcore::StepperPWM.
Definition at line 164 of file Stepper.h.
◆ zeroPosition()
void Boardcore::Stepper::zeroPosition |
( |
float | degrees = 0 | ) |
|
|
inline |
Overrides the driver's internal position counter.
Definition at line 171 of file Stepper.h.
◆ currentDirection
Direction Boardcore::Stepper::currentDirection |
|
protected |
◆ currentPositionDeg
float Boardcore::Stepper::currentPositionDeg = 0 |
|
protected |
◆ directionPin
miosix::GpioPin Boardcore::Stepper::directionPin |
|
protected |
◆ enabled
bool Boardcore::Stepper::enabled = false |
|
protected |
◆ enablePin
miosix::GpioPin Boardcore::Stepper::enablePin |
|
protected |
◆ microStep
uint16_t Boardcore::Stepper::microStep |
|
protected |
◆ pinConfig
◆ revertDirection
bool Boardcore::Stepper::revertDirection |
|
protected |
◆ speed
float Boardcore::Stepper::speed |
|
protected |
◆ stepAngle
float Boardcore::Stepper::stepAngle |
|
protected |
◆ stepPin
miosix::GpioPin Boardcore::Stepper::stepPin |
|
protected |
The documentation for this class was generated from the following files: