Accessories
Arduino for motors and lights library.
PortOnePin.hpp
1 //-------------------------------------------------------------------
2 #ifndef __PortOnePin_H__
3 #define __PortOnePin_H__
4 //-------------------------------------------------------------------
5 
6 #include "Port.hpp"
7 
10 class PortOnePin : public Port
11 {
12  protected:
17  int pin;
18 
19  public:
21  PortOnePin();
22 
27  void begin(int inPin, PIN_TYPE inType);
28 
34  int SetSpeed(int inSpeed);
35 
39  inline bool IsActive() const { return this->pin > -1; }
43  inline int GetPin() const { if (this->GetPinType() < ANALOG) return GPIO_to_Arduino_pin((GPIO_pin_t)this->pin); return this->pin; }
47  inline GPIO_pin_t GetDIOPin() const { if (this->GetPinType() >= ANALOG) return (GPIO_pin_t)this->pin; return DP_INVALID; }
48 
52  void MoveLeftDir(unsigned long inDuration = 0);
56  void MoveRightDir(unsigned long inDuration = 0);
58  void MoveStop();
59 
60 #ifdef ACCESSORIES_PRINT_ACCESSORIES
61 
64  void printPort();
65 #endif
66 };
67 
68 //-------------------------------------------------------------------
69 #endif
70 //-------------------------------------------------------------------
void MoveStop()
Definition: PortOnePin.cpp:73
void MoveRightDir(unsigned long inDuration = 0)
Definition: PortOnePin.cpp:54
void MoveLeftDir(unsigned long inDuration = 0)
Definition: PortOnePin.cpp:35
GPIO_pin_t GetDIOPin() const
Definition: PortOnePin.hpp:47
PIN_TYPE GetPinType() const
Definition: Port.hpp:74
int GetPin() const
Definition: PortOnePin.hpp:43
bool IsActive() const
Definition: PortOnePin.hpp:39
int SetSpeed(int inSpeed)
Definition: PortOnePin.cpp:22
virtual void begin()
Definition: Port.hpp:114
Definition: Port.hpp:61