Accessories
Arduino for motors and lights library.
PortSpeedDirBrake.hpp
1 //-------------------------------------------------------------------
2 #ifndef __PortPWMDirBrake_H__
3 #define __PortPWMDirBrake_H__
4 //-------------------------------------------------------------------
5 
6 #include "Port.hpp"
7 
14 class PortSpeedDirBrake : public Port
15 {
16  protected:
18  int pinPWM;
20  PIN_TYPE digitalType;
22  GPIO_pin_t pinDir;
24  GPIO_pin_t pinBrake;
25 
36  int MapDigitalValue(int inValue) const;
37 
38  public:
41 
49  void begin(int inPinPWM, int inPinDir, int inPinBrake, PIN_TYPE inPWMType, PIN_TYPE inDigitalType);
50 
54  inline bool IsActive() const { return this->pinPWM != -1; }
58  inline int GetPinPWM() const { return this->pinPWM; }
62  inline int GetPinDir() const { return GPIO_to_Arduino_pin(this->pinDir); }
66  inline GPIO_pin_t GetDIOPinDir() const { return this->pinDir; }
70  inline int GetPinBrake() const { return GPIO_to_Arduino_pin(this->pinBrake); }
74  inline GPIO_pin_t GetDIOPinBrake() const { return this->pinBrake; }
75 
79  void MoveLeftDir(unsigned long inDuration = 0);
83  void MoveRightDir(unsigned long inDuration = 0);
85  void MoveStop();
86 
87 #ifdef ACCESSORIES_PRINT_ACCESSORIES
88 
91  void printPort();
92 #endif
93 };
94 
95 //-------------------------------------------------------------------
96 #endif
97 //-------------------------------------------------------------------
void MoveRightDir(unsigned long inDuration = 0)
void MoveLeftDir(unsigned long inDuration = 0)
GPIO_pin_t GetDIOPinBrake() const
int GetPinBrake() const
bool IsActive() const
virtual void begin()
Definition: Port.hpp:114
GPIO_pin_t GetDIOPinDir() const
int MapDigitalValue(int inValue) const
Definition: Port.hpp:61