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

#include <IoAbstraction.h>

Inheritance diagram for ShiftRegisterIoAbstraction:
BasicIoAbstraction

Public Member Functions

 ShiftRegisterIoAbstraction (pinid_t readClockPin, pinid_t readDataPin, pinid_t readLatchPin, pinid_t writeClockPin, pinid_t writeDataPin, pinid_t writeLatchPin, uint8_t numRead, uint8_t numWrite)
 
 ShiftRegisterIoAbstraction (const ShiftRegConfig &readConfig, const ShiftRegConfig &writeConfig)
 
void initDevice ()
 
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 attachInterrupt (pinid_t, RawIntHandler, uint8_t) override
 
bool runLoop () override
 
void writePort (pinid_t port, uint8_t portVal) override
 
uint8_t readPort (pinid_t port) 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

Notice that the output range has been moved from 24 to 32 onwards , this is to allow support for up to 4 devices chained together, this is a breaking change from the 1.0.x versions.

An implementation of BasicIoFacilities that supports the ubiquitous shift register, using 74HC165 for input (pins 0 to 23) and a 74HC595 for output (32 onwards). It supports up to three registers in each direction at the moment.

Constructor & Destructor Documentation

◆ ShiftRegisterIoAbstraction()

ShiftRegisterIoAbstraction::ShiftRegisterIoAbstraction ( pinid_t  readClockPin,
pinid_t  readDataPin,
pinid_t  readLatchPin,
pinid_t  writeClockPin,
pinid_t  writeDataPin,
pinid_t  writeLatchPin,
uint8_t  numRead,
uint8_t  numWrite 
)

Normally use the shift register helper functions to create an instance.

See also
inputOutputFromShiftRegister
inputOnlyFromShiftRegister
outputOnlyFromShiftRegister

Member Function Documentation

◆ pinDirection()

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

sets the pin direction for a pin controlled by this abstraction - as per pinMode

Parameters
pinthe pin to be changed
modethe new mode, as per pinMode (or on Mbed you can use PinMode enum values)

Reimplemented from BasicIoAbstraction.

◆ writeValue()

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

Writes a value to a pin on this abstraction, as per digitalWrite. For serial devices, may need a sync first.

Parameters
pinthe pin to be written to
valuethe new value such as HIGH / LOW

Reimplemented from BasicIoAbstraction.

◆ readValue()

uint8_t ShiftRegisterIoAbstraction::readValue ( pinid_t  pin)
overridevirtual

Reads a value from a pin for this abstraction as per digitalRead. For serial devices may need a sync first.

Parameters
pinthe pin to be read

Reimplemented from BasicIoAbstraction.

◆ attachInterrupt()

void ShiftRegisterIoAbstraction::attachInterrupt ( pinid_t  ,
RawIntHandler  ,
uint8_t   
)
inlineoverridevirtual

Interrupts are not supported on shift registers

Reimplemented from BasicIoAbstraction.

◆ runLoop()

bool ShiftRegisterIoAbstraction::runLoop ( )
overridevirtual

This method is not needed on Arduino pins, but for most serial implementations it causes the device and abstraction to be synced. Returns true if the write call worked, normally true, false indicates error

Reimplemented from BasicIoAbstraction.

◆ writePort()

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

writes to the output shift register - currently always port 0

Reimplemented from BasicIoAbstraction.

◆ readPort()

uint8_t ShiftRegisterIoAbstraction::readPort ( pinid_t  port)
overridevirtual

reads from the input shift register - currently always port 3

Reimplemented from BasicIoAbstraction.


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