#include <IoAbstraction.h>
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 () |
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.
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.
|
overridevirtual |
sets the pin direction for a pin controlled by this abstraction - as per pinMode
pin | the pin to be changed |
mode | the new mode, as per pinMode (or on Mbed you can use PinMode enum values) |
Reimplemented from BasicIoAbstraction.
|
overridevirtual |
Writes a value to a pin on this abstraction, as per digitalWrite
. For serial devices, may need a sync first.
pin | the pin to be written to |
value | the new value such as HIGH / LOW |
Reimplemented from BasicIoAbstraction.
|
overridevirtual |
Reads a value from a pin for this abstraction as per digitalRead
. For serial devices may need a sync first.
pin | the pin to be read |
Reimplemented from BasicIoAbstraction.
|
inlineoverridevirtual |
Interrupts are not supported on shift registers
Reimplemented from BasicIoAbstraction.
|
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.
|
overridevirtual |
writes to the output shift register - currently always port 0
Reimplemented from BasicIoAbstraction.
|
overridevirtual |
reads from the input shift register - currently always port 3
Reimplemented from BasicIoAbstraction.