Using basic IoFacilities allows one to abstract away the use of IoExpanders, such that the switching from BasicIoFacilities to IoExpanderFacilities allows the same code to use an IoExpander instead of direct pins.
More...
Go to the source code of this file.
|
enum | ShiftBitOrder { MSBFIRST
, LSBFIRST
} |
|
|
uint8_t | shiftIn (pinid_t dataPin, pinid_t clockPin, ShiftBitOrder bitOrder) |
|
IoAbstractionRef | inputOutputFromShiftRegister (uint8_t readClockPin, uint8_t readDataPin, uint8_t readLatchPin, uint8_t numOfReadDevices, uint8_t writeClockPin, uint8_t writeDataPin, uint8_t writeLatchPin, uint8_t numOfWriteDevices) |
|
IoAbstractionRef | inputOutputFromShiftRegister (uint8_t readClockPin, uint8_t readDataPin, uint8_t readLatchPin, uint8_t writeClockPin, uint8_t writeDataPin, uint8_t writeLatchPin) |
|
IoAbstractionRef | inputOnlyFromShiftRegister (uint8_t readClockPin, uint8_t dataPin, uint8_t latchPin, uint8_t numOfDevicesRead=1) |
|
IoAbstractionRef | outputOnlyFromShiftRegister (uint8_t writeClockPin, uint8_t writeDataPin, uint8_t writeLatchPin, uint8_t numOfDevicesWrite=1) |
|
IoAbstractionRef | inputFrom74HC165ShiftRegister (pinid_t readClkPin, pinid_t dataPin, pinid_t latchPin, pinid_t numOfDevices=1) |
|
MultiIoAbstractionRef | multiIoExpander (pinid_t arduinoPinRange) |
|
void | multiIoAddExpander (MultiIoAbstractionRef multiIo, IoAbstractionRef expander, pinid_t pinRange) |
|
Using basic IoFacilities allows one to abstract away the use of IoExpanders, such that the switching from BasicIoFacilities to IoExpanderFacilities allows the same code to use an IoExpander instead of direct pins.
◆ MultiIoAbstractionRef
A reference specifically to a MultiIoAbstraction that can be passed to any of the ioDevice calls, but can also have more IO expanders added to it.
◆ inputOutputFromShiftRegister() [1/2]
IoAbstractionRef inputOutputFromShiftRegister |
( |
uint8_t |
readClockPin, |
|
|
uint8_t |
readDataPin, |
|
|
uint8_t |
readLatchPin, |
|
|
uint8_t |
numOfReadDevices, |
|
|
uint8_t |
writeClockPin, |
|
|
uint8_t |
writeDataPin, |
|
|
uint8_t |
writeLatchPin, |
|
|
uint8_t |
numOfWriteDevices |
|
) |
| |
performs both input and output functions using two or more shift registers, for both reading and writing. As shift registers have a fixed direction input and output are handled by different devices, and therefore fixed at the time of building the circuit. This function supports chaining of up to 4 devices for both directions.
This abstraction works as follows:
- Input pins of the input shift register start at 0
- Output pins of the output shift register start at 32.
- Parameters
-
readClockPin | the clock pin on the INPUT shift register |
readDataPin | the data pin on the INPUT shift register |
readLatchPin | the latch pin on the INPUT shift register |
numOfDevicesRead | the number of shift registers that have been chained for reading |
writeClockPin | the clock pin on the OUTPUT shift register |
writeDataPin | the data pin on the OUTPUT shift register |
writeLatchPin | the latch pin on the OUTPUT shift register |
numOfDevicesWrite | the number of shift registers that have been chained for writing |
◆ inputOutputFromShiftRegister() [2/2]
IoAbstractionRef inputOutputFromShiftRegister |
( |
uint8_t |
readClockPin, |
|
|
uint8_t |
readDataPin, |
|
|
uint8_t |
readLatchPin, |
|
|
uint8_t |
writeClockPin, |
|
|
uint8_t |
writeDataPin, |
|
|
uint8_t |
writeLatchPin |
|
) |
| |
performs both input and output functions using two shift registers, one for reading and one for writing. As shift registers have a fixed direction input and output are handled by different devices, and therefore fixed at the time of building the circuit. This function is for when you have a single input and single output device. See the other version of the function if you need to chain devices.
This abstraction works as follows:
- Input pins of the input shift register start at 0
- Output pins of the output shift register start at 32.
- Parameters
-
readClockPin | the clock pin on the INPUT shift register |
readDataPin | the data pin on the INPUT shift register |
readLatchPin | the latch pin on the INPUT shift register |
writeClockPin | the clock pin on the OUTPUT shift register |
writeDataPin | the data pin on the OUTPUT shift register |
writeLatchPin | the latch pin on the OUTPUT shift register |
◆ inputOnlyFromShiftRegister()
IoAbstractionRef inputOnlyFromShiftRegister |
( |
uint8_t |
readClockPin, |
|
|
uint8_t |
dataPin, |
|
|
uint8_t |
latchPin, |
|
|
uint8_t |
numOfDevicesRead = 1 |
|
) |
| |
performs input only functions using a shift register, the input pins of the shift register start at pin 0.
- Parameters
-
readClockPin | the clock pin on the INPUT shift register |
dataPin | the data pin on the INPUT shift register |
latchPin | the latch pin on the INPUT shift register |
◆ outputOnlyFromShiftRegister()
IoAbstractionRef outputOnlyFromShiftRegister |
( |
uint8_t |
writeClockPin, |
|
|
uint8_t |
writeDataPin, |
|
|
uint8_t |
writeLatchPin, |
|
|
uint8_t |
numOfDevicesWrite = 1 |
|
) |
| |
performs output only functions using a shift register, the output pins of the shift register start at 32.
- Parameters
-
writeClockPin | the clock pin on the OUTPUT shift register |
writeDataPin | the data pin on the OUTPUT shift register |
writeLatchPin | the latch pin on the OUTPUT shift register |
◆ inputFrom74HC165ShiftRegister()
IoAbstractionRef inputFrom74HC165ShiftRegister |
( |
pinid_t |
readClkPin, |
|
|
pinid_t |
dataPin, |
|
|
pinid_t |
latchPin, |
|
|
pinid_t |
numOfDevices = 1 |
|
) |
| |
Performs input only functions using a 74x165 plugin, the input pins start at 0 up to a maximum of 31, each device adds another 8 pins.
- Parameters
-
readClkPin | the clock pin of the shift register, used as OUTPUT |
dataPin | the data pin of the shift register, used as INPUT |
latchPin | the latch pin of the shift register, used as OUTPUT |
numOfDevices | the number of devices that are chained together in the usual fashion, range is 1..4 |
- Returns
- a shift register abstraction as an IoAbstraction ref.
◆ multiIoExpander()
Create a multiIoExpander by adding together more than one IoAbstraction, for example Arduino pins plus a few 8574 devices.
- Parameters
-
arduinoPinRange | the number of pins to assign to Arduino. |
◆ multiIoAddExpander()
Add an additional expander to an existing multiIoExpander.
- Parameters
-
expander | the expander to be added |
pinRange | the number of pins needed by the expander. |