#include "AccessoryStepper.hpp"
Public Member Functions | |
AccessoryStepper () | |
bool | CanBePositional () const |
void | begin (Port *inpPort, int inStepsNumber, int inReduction, unsigned int inSpeed = 0, int inMovingPositionsNumber = 1) |
void | Event (unsigned long inId, ACCESSORIES_EVENT_TYPE inEvent = ACCESSORIES_EVENT_MOVEPOSITIONINDEX, int inData = 0) |
void | StartCalibration () |
void | EndCalibration () |
void | MovePosition (int inAbsolutePosition) |
void | MoveRelativePosition (int inRelativePosition) |
void | Move (unsigned long inId) |
ACC_STATE | MoveToggle () |
![]() | |
Accessory () | |
void | begin (ACC_STATE inStartingState = STATE_NONE) |
Port * | GetPort () const |
ACC_STATE | GetState () const |
ACC_STATE | GetPreviousState () const |
bool | IsNone () const |
bool | IsFirst () const |
bool | IsSecond () const |
uint8_t | AddMovingPosition (unsigned long inId, int inPosition) |
unsigned int | GetDebounceDelay () const |
unsigned long | GetLastMoveTime () const |
unsigned long | GetDuration () const |
bool | loop () |
virtual int | EEPROMSave (int inPos, bool inSimulate = false) |
virtual int | EEPROMLoad (int inPos) |
void | AdjustMovingPositionsSize (uint8_t inNewSize) |
bool | IsEmpty () const |
uint8_t | IndexOfMovingPosition (unsigned long inId) const |
int | GetMovingPosition (unsigned long inId) const |
int | GetMovingPositionByIndex (int inIndex) const |
unsigned long | GetMovingPositionIdByIndex (int inIndex) const |
const uint8_t | GetLastMovingPosition () const |
const uint8_t | GetMovingPositionSize () const |
void | SetLastMovingPosition (uint8_t inLastPositionIndex) |
void | SetDebounceDelay (unsigned int inDebounceDelay) |
void | SetLastMoveTime () |
void | SetDuration (unsigned long inDuration) |
void | SetNextAccessory (Accessory *inAccessory) |
Accessory * | GetNextAccessory () const |
unsigned long | GetActionStartingMillis () const |
virtual void | StartAction () |
virtual void | StartAction (ACC_STATE inState) |
virtual void | ResetAction () |
bool | IsActionDelayPending () const |
virtual bool | IsGroupActionPending () const |
virtual void | SetState (ACC_STATE inNewState) |
void | SetStateRaw (ACC_STATE inNewState) |
void | SetStartingMillis () |
void | ResetStartingMillis () |
Additional Inherited Members | |
![]() | |
static void | ExecuteEvent (unsigned long inId, ACCESSORIES_EVENT_TYPE inEvent = ACCESSORIES_EVENT_MOVEPOSITIONID, int inData = 0) |
static uint8_t | GetCount () |
static bool | IsActionPending () |
static Accessory * | GetFirstAccessory () |
![]() | |
Port * | pPort |
ACC_STATE | prevState |
This class describes a stepper motor powered by a port. See http://www.tigoe.net/pcomp/code/circuits/motors/stepper-motors/ to explanations about the stepper motors. This class can handle two or four coils motors, by using two or four pins and activate them in the right order. Every stepper motor can differ from a brand/model to another one with the order of activations to apply (the sequence), so this can be defined manually by the user for the PortStepper of this Accessory.
By construction, this kind of motor can only move with relative values. This class maintains a current position and is able to move this motor in absolute mode. To continue with construction facts, a stepper motor can have a tolerance for the movements.
Definition at line 23 of file AccessoryStepper.hpp.
AccessoryStepper::AccessoryStepper | ( | ) |
Default constructor.
Definition at line 13 of file AccessoryStepper.cpp.
void AccessoryStepper::begin | ( | Port * | inpPort, |
int | inStepsNumber, | ||
int | inReduction, | ||
unsigned int | inSpeed = 0 , |
||
int | inMovingPositionsNumber = 1 |
||
) |
Initialize the instance.
inpPort | Port driven this motor. |
inStepsNumber | Number of steps for a complete rotation of the axis. You can find it in the motor's data-sheet. |
inReduction | reduction between the motorized axis and the output axis. You can find it in the motor's data-sheet. |
inSpeed | Speed to control power to the motor. Default is 0. |
inMovingPositionsNumber | Number of steps for one movement. Default is 1 step. |
Definition at line 18 of file AccessoryStepper.cpp.
|
inlinevirtual |
Checks if the accessory can be moved by an absolute value instead of a fix position.
Reimplemented from Accessory.
Definition at line 38 of file AccessoryStepper.hpp.
|
inline |
Not yet implemented.
Definition at line 60 of file AccessoryStepper.hpp.
|
virtual |
Execute a new event.
inId | Id of an accessory or an accessory item. |
inEvent | Type of the new event. Default is ACCESSORIES_EVENT_MOVEPOSITIONID. |
inData | Associated data to the event type. Default is 0. |
Reimplemented from Accessory.
Definition at line 95 of file AccessoryStepper.cpp.
|
virtual |
Basic moving function.
[in] | inId | new position id from MovingPosition to reach. |
Implements Accessory.
Definition at line 52 of file AccessoryStepper.cpp.
|
virtual |
Move to the given absolute value..
[in] | inAbsolutePosition | new position to reach. |
Reimplemented from Accessory.
Definition at line 68 of file AccessoryStepper.cpp.
void AccessoryStepper::MoveRelativePosition | ( | int | inRelativePosition | ) |
Move of the given value.
[in] | inRelativePosition | movement to do. Can be positive or negative. |
Definition at line 81 of file AccessoryStepper.cpp.
ACC_STATE AccessoryStepper::MoveToggle | ( | ) |
Move to the next MovingPosition.
Definition at line 32 of file AccessoryStepper.cpp.
|
inline |
Not yet implemented.
Definition at line 58 of file AccessoryStepper.hpp.