#include "PortOnePin.hpp"
Public Member Functions | |
PortOnePin () | |
void | begin (int inPin, PIN_TYPE inType) |
int | SetSpeed (int inSpeed) |
bool | IsActive () const |
int | GetPin () const |
GPIO_pin_t | GetDIOPin () const |
void | MoveLeftDir (unsigned long inDuration = 0) |
void | MoveRightDir (unsigned long inDuration = 0) |
void | MoveStop () |
![]() | |
PIN_TYPE | GetPinType () const |
PORT_STATE | GetPortState () const |
void | SetPinType (PIN_TYPE inType) |
void | SetPortState (PORT_STATE inState) |
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 |
Port () | |
virtual void | begin () |
virtual void | beginByAccessory (int inStartingPosition) |
int | GetSpeed () const |
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 | pin |
![]() | |
int | speed |
byte | type_state |
This class describes a port for a simple accessory driven by only one wire, one pin. Lights and uncoupling track can be driven by this kind of port.
Definition at line 10 of file PortOnePin.hpp.
PortOnePin::PortOnePin | ( | ) |
Default constructor.
Definition at line 11 of file PortOnePin.cpp.
void PortOnePin::begin | ( | int | inPin, |
PIN_TYPE | inType | ||
) |
Initialize the instance.
inPin | pin to drive. |
inType | kind of pin. |
Definition at line 16 of file PortOnePin.cpp.
|
inline |
|
inline |
Gets the Arduino pin.
Definition at line 43 of file PortOnePin.hpp.
|
inline |
Checks if this port is active. To be active, begin() must have been called.
Definition at line 39 of file PortOnePin.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.
Definition at line 35 of file PortOnePin.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.
Definition at line 54 of file PortOnePin.cpp.
|
virtual |
Sets the current state of the port to PORT_STOP.
Reimplemented from Port.
Definition at line 73 of file PortOnePin.cpp.
|
virtual |
Sets the current speed of the port.
inSpeed | new current speed of the port. |
Reimplemented from Port.
Definition at line 22 of file PortOnePin.cpp.
|
protected |
Main 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 PortOnePin.hpp.