#include "PortTwoPins.hpp"
Public Member Functions | |
PortTwoPins () | |
void | begin (int inPinA, int inPinB, PIN_TYPE inType) |
bool | IsActive () const |
int | GetPinA () const |
GPIO_pin_t | GetDIOPinA () const |
int | GetPinB () const |
GPIO_pin_t | GetDIOPinB () const |
void | MoveLeftDir (unsigned long inDuration = 0) |
void | MoveRightDir (unsigned long inDuration = 0) |
void | MoveStop () |
![]() | |
Port () | |
virtual void | begin () |
virtual void | beginByAccessory (int inStartingPosition) |
PORT_STATE | GetState () const |
int | GetSpeed () const |
virtual int | SetSpeed (int inSpeed) |
bool | IsLeftDir () const |
bool | IsRightDir () const |
bool | IsStopped () const |
void | MoveLeftDir (unsigned long inDuration, int inSpeed) |
void | MoveRightDir (unsigned long inDuration, int inSpeed) |
PORT_STATE | MoveToggle (unsigned long inDuration = 0) |
virtual void | MovePosition (unsigned long inDuration, int inEndPosition) |
virtual int | GetPosition () |
Protected Attributes | |
int | pinA |
int | pinB |
![]() | |
PIN_TYPE | pinType |
PORT_STATE | state |
int | speed |
Additional Inherited Members | |
![]() | |
int | MapValue (int inValue, PIN_TYPE inType = UNDEFINED) const |
int | beginPin (int inPin, PIN_TYPE inType = UNDEFINED) const |
void | MovePin (int inPin, int inValue, PIN_TYPE inType = UNDEFINED) const |
This class describes a port for an accessory driven by two wires, two pins. Some turnouts or motors can be driven by this port.
Definition at line 10 of file PortTwoPins.hpp.
PortTwoPins::PortTwoPins | ( | ) |
Default constructor.
Definition at line 9 of file PortTwoPins.cpp.
void PortTwoPins::begin | ( | int | inPinA, |
int | inPinB, | ||
PIN_TYPE | inType | ||
) |
Initialize the instance.
inPinA | first pin to drive. |
inPinB | second pin to drive. |
inType | kind of both pins. |
Definition at line 13 of file PortTwoPins.cpp.
|
inline |
Gets the first Arduino pin.
Definition at line 46 of file PortTwoPins.hpp.
|
inline |
Gets the second Arduino pin.
Definition at line 54 of file PortTwoPins.hpp.
|
inline |
Gets the first Arduino pin.
Definition at line 42 of file PortTwoPins.hpp.
|
inline |
Gets the second Arduino pin.
Definition at line 50 of file PortTwoPins.hpp.
|
inline |
Checks if this port is active. To be active, begin() must have been called.
Definition at line 38 of file PortTwoPins.hpp.
|
virtual |
Sets the current state of the port to PORT_LEFT.
inDuration | the pins will be activated to left for the given delay. |
Reimplemented from Port.
Reimplemented in PortTwoPinsEnable.
Definition at line 21 of file PortTwoPins.cpp.
|
virtual |
Sets the current state of the port to PORT_RIGHT.
inDuration | the pins will be activated to right for the given delay. |
Reimplemented from Port.
Reimplemented in PortTwoPinsEnable.
Definition at line 50 of file PortTwoPins.cpp.
|
virtual |
Sets the current state of the port to PORT_STOP.
Reimplemented from Port.
Reimplemented in PortTwoPinsEnable.
Definition at line 79 of file PortTwoPins.cpp.
|
protected |
First pin of this port. ANALOG or ANALOG_INVERTED : Classic Arduino pin number DIGITAL or DIGITAL_INVERTED : GPIO_pin_t casted in an integer.
Definition at line 17 of file PortTwoPins.hpp.
|
protected |
Second pin of this port. ANALOG or ANALOG_INVERTED : Classic Arduino pin number DIGITAL or DIGITAL_INVERTED : GPIO_pin_t casted in an integer.
Definition at line 22 of file PortTwoPins.hpp.