Accessories
Arduino for motors and lights library.
AccessoryStepper.hpp
1 //-------------------------------------------------------------------
2 #ifndef __accessoryStepper_H__
3 #define __accessoryStepper_H__
4 //-------------------------------------------------------------------
5 
6 #include "Accessory.hpp"
7 
8 //-------------------------------------------------------------------
9 
10 #define CALIBRATION STATE_FIRST
11 
12 #ifndef NO_STEPPER
13 
45 {
46  private:
47  unsigned int speed;
48  int stepsNumber;
49  int reduction;
50  double angleByStep;
51 
52  public:
55 
59  inline bool CanBePositional() const { return true; }
60 
68  void begin(Port *inpPort, int inStepsNumber, int inReduction, unsigned int inSpeed = 0, int inMovingPositionsNumber = 1);
69 
75  void Event(unsigned long inId, ACCESSORIES_EVENT_TYPE inEvent = ACCESSORIES_EVENT_MOVEPOSITIONINDEX, int inData = 0);
76 
77 // void SetStartingPosition(int inPosition) { this->currentPos = inPosition; }
79  void StartCalibration() { this->SetStateRaw(CALIBRATION); }
81  void EndCalibration() { this->SetStateRaw(STATE_NONE); }
82 
86  void MovePosition(int inAbsolutePosition);
87 
91  void MoveRelativePosition(int inRelativePosition);
92 
96  void Move(unsigned long inId);
97 
101  ACC_STATE MoveToggle();
102 
103  private:
107  inline ACC_STATE Toggle() { return MoveToggle(); }
108 
113  bool ActionEnded();
114 
115 #ifdef ACCESSORIES_PRINT_ACCESSORIES
116  public:
120  void printAccessory();
121 #endif
122 };
123 #endif
124 
125 //-------------------------------------------------------------------
126 #endif
127 //-------------------------------------------------------------------
128 
ACC_STATE MoveToggle()
void Move(unsigned long inId)
void MoveRelativePosition(int inRelativePosition)
void MovePosition(int inAbsolutePosition)
void SetStateRaw(ACC_STATE inNewState)
Definition: Accessory.cpp:224
void Event(unsigned long inId, ACCESSORIES_EVENT_TYPE inEvent = ACCESSORIES_EVENT_MOVEPOSITIONINDEX, int inData = 0)
void begin(Port *inpPort, int inStepsNumber, int inReduction, unsigned int inSpeed = 0, int inMovingPositionsNumber = 1)
bool CanBePositional() const
Definition: Port.hpp:61