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 
24 {
25  private:
26  unsigned int speed;
27  int stepsNumber;
28  int reduction;
29  double angleByStep;
30 
31  public:
34 
38  inline bool CanBePositional() const { return true; }
39 
47  void begin(Port *inpPort, int inStepsNumber, int inReduction, unsigned int inSpeed = 0, int inMovingPositionsNumber = 1);
48 
54  void Event(unsigned long inId, ACCESSORIES_EVENT_TYPE inEvent = ACCESSORIES_EVENT_MOVEPOSITIONINDEX, int inData = 0);
55 
56 // void SetStartingPosition(int inPosition) { this->currentPos = inPosition; }
58  void StartCalibration() { this->SetStateRaw(CALIBRATION); }
60  void EndCalibration() { this->SetStateRaw(STATE_NONE); }
61 
65  void MovePosition(int inAbsolutePosition);
66 
70  void MoveRelativePosition(int inRelativePosition);
71 
75  void Move(unsigned long inId);
76 
80  ACC_STATE MoveToggle();
81 
82  private:
86  inline ACC_STATE Toggle() { return MoveToggle(); }
87 
92  bool ActionEnded();
93 
94 #ifdef ACCESSORIES_PRINT_ACCESSORIES
95  public:
99  void printAccessory();
100 #endif
101 };
102 #endif
103 
104 //-------------------------------------------------------------------
105 #endif
106 //-------------------------------------------------------------------
107 
ACC_STATE MoveToggle()
void Move(unsigned long inId)
void MoveRelativePosition(int inRelativePosition)
void MovePosition(int inAbsolutePosition)
void Event(unsigned long inId, ACCESSORIES_EVENT_TYPE inEvent = ACCESSORIES_EVENT_MOVEPOSITIONINDEX, int inData = 0)
Definition: Port.hpp:61
void begin(Port *inpPort, int inStepsNumber, int inReduction, unsigned int inSpeed = 0, int inMovingPositionsNumber = 1)
void SetStateRaw(ACC_STATE inNewState)
Definition: Accessory.cpp:165
bool CanBePositional() const