IoAbstraction
Public Member Functions | List of all members
MultiIoAbstraction Class Reference

#include <IoAbstraction.h>

Inheritance diagram for MultiIoAbstraction:
BasicIoAbstraction

Public Member Functions

 MultiIoAbstraction (pinid_t arduinoPinsNeeded=100)
 
void addIoExpander (IoAbstractionRef expander, pinid_t numOfPinsNeeded)
 
void addIoDevice (BasicIoAbstraction &expander, pinid_t pinsNeeded)
 
void pinDirection (pinid_t pin, uint8_t mode) override
 
void writeValue (pinid_t pin, uint8_t value) override
 
uint8_t readValue (pinid_t pin) override
 
void writePort (pinid_t port, uint8_t portVal) override
 
uint8_t readPort (pinid_t port) override
 
void attachInterrupt (pinid_t pin, RawIntHandler intHandler, uint8_t mode) override
 
bool runLoop () override
 
- Public Member Functions inherited from BasicIoAbstraction
uint8_t digitalRead (pinid_t p)
 
void digitalWrite (pinid_t p, uint8_t v)
 
uint8_t digitalReadS (pinid_t p)
 
void digitalWriteS (pinid_t p, uint8_t v)
 
void writePortS (pinid_t p, uint8_t v)
 
uint8_t readPortS (pinid_t p)
 
void pinMode (pinid_t pin, uint8_t mode)
 
bool sync ()
 

Detailed Description

An implementation of the BasicIoAbstraction that provides support for more than one IOExpander in a single abstraction, along with a single set of Arduino pins. Arduino pins will be from 0..arduinoPinsNeeded in the constructor (default 100) expanders will directly follow this, expanders are added using addIoExpander.

Take note that the usual way to use the MultiIoAbstraction is to create a global variable and append the additional IO devices during setup. In order to pass such a varable to the ioDevice functions, such as ioDeviceDigitalRead you must put an ampersand in front of the variable to make it into a pointer.

Member Function Documentation

◆ pinDirection()

void MultiIoAbstraction::pinDirection ( pinid_t  pin,
uint8_t  mode 
)
overridevirtual

delegates the pin direction call to whichever abstraction owns the pin, and that abstraction will then set the pin mode

Parameters
pinthe pin to set the mode on
modeas per pinMode modes

Reimplemented from BasicIoAbstraction.

◆ writeValue()

void MultiIoAbstraction::writeValue ( pinid_t  pin,
uint8_t  value 
)
overridevirtual

delegates writing the value to whichever abstraction owns the pin, this abstraction will then write out the value.

Parameters
pinthe pin to write to
valuethe value to write to the pin

Reimplemented from BasicIoAbstraction.

◆ readValue()

uint8_t MultiIoAbstraction::readValue ( pinid_t  pin)
overridevirtual

delegates reading the value from a pin to whichever abstraction owns the pin.

Parameters
pinthe pin to read from

Reimplemented from BasicIoAbstraction.

◆ writePort()

void MultiIoAbstraction::writePort ( pinid_t  port,
uint8_t  portVal 
)
overridevirtual

delegates writing the port value to the abstraction that owns that pin, the abstraction will then determine the port that the pin belongs to

Parameters
portany pin within the port
portValan 8 bit value to write direct to the port.

Reimplemented from BasicIoAbstraction.

◆ readPort()

uint8_t MultiIoAbstraction::readPort ( pinid_t  port)
overridevirtual

delegates reading a port to the abstraction that owns the pin, the abstraction will then determine which port owns the pin and return the port value.

Parameters
portany pin within that port.

Reimplemented from BasicIoAbstraction.

◆ attachInterrupt()

void MultiIoAbstraction::attachInterrupt ( pinid_t  pin,
RawIntHandler  intHandler,
uint8_t  mode 
)
overridevirtual

delegates attaching an interrupt to the abstraction that owns the pin, see each abstraction for more information about how interrupts work with the given device.

Parameters
pinthe pin on the device
intHandlerthe interrupt intHandler
modeas per arduino interrupt modes.

Reimplemented from BasicIoAbstraction.

◆ runLoop()

bool MultiIoAbstraction::runLoop ( )
overridevirtual

will run through all delegate abstractions and sync them

Reimplemented from BasicIoAbstraction.


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