28 float speed,
float stepAngle,
bool revertDirection,
30 miosix::GpioPin enablePin)
31 : stepPin(stepPin), directionPin(directionPin), speed(speed),
32 stepAngle(stepAngle), revertDirection(revertDirection),
33 microStep(microStep), pinConfig(pinConfiguration), enablePin(enablePin),
128 miosix::delayUs(halfStepDelay);
130 for (
int i = 0; i < stepsAbs; i++)
137 miosix::delayUs(halfStepDelay);
143 miosix::delayUs(halfStepDelay);
miosix::GpioPin directionPin
StepperData getState(float moveDeg)
Returns the current position and the current timestamp.
virtual float getCurrentDegPosition()
Returns the current absolute position of the stepper in degrees [deg].
void setDirection()
Sets the directionPin to the right value to go in the direction stored in currentDirection.
virtual void move(int16_t steps)
Move the stepper motor by the specified amount of steps.
PinConfiguration pinConfig
Direction currentDirection
void moveDeg(float degrees)
Move the stepper motor by the specified amount of degrees.
virtual void setMicroStepping(uint16_t microStep)
Set the motor driver micro stepping configuration.
miosix::GpioPin enablePin
@ COMMON_CATHODE
All - signals connected to Gnd.
@ COMMON_ANODE
All + signals connected to Vdd (3v3)
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.
bool isEnabled()
Returns whether the stepper is enabled or not.
uint64_t getTimestamp()
Returns the current timer value in microseconds.
This file includes all the types the logdecoder script will decode.