Accessories
Arduino for motors and lights library.
PortExpander Class Referenceabstract

#include "PortExpander.hpp"

Inheritance diagram for PortExpander:
PortExpander74HC595 PortExpanderSX1509

Public Member Functions

 PortExpander ()
 

Static Public Member Functions

static void beginPin (int inPin, int inExpId, PIN_TYPE inType)
 
static void digitalWrite (int inPin, int inExpId, int inValue)
 
static void analogWrite (int inPin, int inExpId, int inValue)
 

Protected Member Functions

virtual byte begin ()
 
virtual void beginPin (int inPin, PIN_TYPE inType) = 0
 
virtual void digitalWrite (int inPin, int inValue) = 0
 
virtual void analogWrite (int inPin, int inValue) = 0
 
virtual byte GetPinsNumber ()
 

Static Protected Member Functions

static void Add (PortExpander *inExpander)
 

Protected Attributes

int id
 

Detailed Description

This class describes an expander : a circuit wich provides a lot of input/output pin for a small number of pins on the Arduino. Each expander is identified by a number : the id. Only output pins are used in Accessories. An expander can provide digital or analog (PWM) output.

Definition at line 21 of file PortExpander.hpp.

Constructor & Destructor Documentation

PortExpander::PortExpander ( )

Default constructor.

Member Function Documentation

virtual void PortExpander::analogWrite ( int  inPin,
int  inValue 
)
protectedpure virtual

Set the value of one pin of the expander.

Parameters
inPinnumber of the pin. should be between 0 and the maximum number of expander pins.
inValueNew analog value of the pin. Should be between 0 and 255.

Implemented PortExpander74HC595, and PortExpanderSX1509.

static void PortExpander::analogWrite ( int  inPin,
int  inExpId,
int  inValue 
)
static

Set the value of one pin of the given expander ID.

Parameters
inPinnumber of the pin. should be between 0 and the maximum number of expander pins.
inExpIdid of the expander. should be a valid expander id.
inValueNew analog value of the pin. Should be between 0 and 255.
virtual byte PortExpander::begin ( )
inlineprotectedvirtual

Initialize the instance of the expander.

Parameters
inIdid of expander (to be used associated to pin).
Returns
Is expander initialized ?

Definition at line 40 of file PortExpander.hpp.

virtual void PortExpander::beginPin ( int  inPin,
PIN_TYPE  inType 
)
protectedpure virtual

Initialize one pin of the expander.

Parameters
inPinnumber of the pin. should be between 0 and the maximum number of expander pins.
inTypetype of the output of this pin : DIGITAL or ANALMOG (pwm).

Implemented PortExpander74HC595, and PortExpanderSX1509.

static void PortExpander::beginPin ( int  inPin,
int  inExpId,
PIN_TYPE  inType 
)
static

Initialize one pin of the expander.

Parameters
inPinnumber of the pin. should be between 0 and the maximum number of expander pins.
inExpIdid of the expander. should be a valid expander id.
inTypetype of the output of this pin : DIGITAL or ANALMOG (pwm).
virtual void PortExpander::digitalWrite ( int  inPin,
int  inValue 
)
protectedpure virtual

Set the state of one pin of the expander.

Parameters
inPinnumber of the pin. should be between 0 and the maximum number of expander pins.
inValueNew state of the pin. Should be HIGH (1) or LOW (0).

Implemented PortExpander74HC595, and PortExpanderSX1509.

static void PortExpander::digitalWrite ( int  inPin,
int  inExpId,
int  inValue 
)
static

Set the value of one pin of the given expander ID.

Parameters
inPinnumber of the pin. should be between 0 and the maximum number of expander pins.
inExpIdid of the expander. should be a valid expander id.
inValueNew state of the pin. Should be HIGH (1) or LOW (0).
virtual byte PortExpander::GetPinsNumber ( )
inlineprotectedvirtual

Gets the total number of pins of the expander.

Returns
Number of pins.

Reimplemented in PortExpander74HC595, and PortExpanderSX1509.

Definition at line 59 of file PortExpander.hpp.


The documentation for this class was generated from the following file: