#include <AH/Hardware/ExtendedInputOutput/StaticSizeExtendedIOElement.hpp>
A class for ExtendedIOElements with a fixed size.
This class is to make it easier to get an array of all pins of the element.
Definition at line 16 of file StaticSizeExtendedIOElement.hpp.
Enabling and disabling updatables | |
void | enable () |
Enable this updatable: insert it into the linked list of instances, so it gets updated automatically. More... | |
void | disable () |
Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically. More... | |
bool | isEnabled () const |
Check if this updatable is enabled. More... | |
void | moveDown () |
Move down this element in the list. More... | |
static void | enable (UpdatableCRTP *element) |
Enable this updatable: insert it into the linked list of instances, so it gets updated automatically. More... | |
static void | enable (UpdatableCRTP &element) |
Enable this updatable: insert it into the linked list of instances, so it gets updated automatically. More... | |
static void | enable (U(&array)[N]) |
Enable this updatable: insert it into the linked list of instances, so it gets updated automatically. More... | |
static void | disable (UpdatableCRTP *element) |
Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically. More... | |
static void | disable (UpdatableCRTP &element) |
Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically. More... | |
static void | disable (U(&array)[N]) |
Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically. More... | |
Public Member Functions | |
Array< pin_t, N > | pins () const |
Get an array containing all pins of the element. More... | |
virtual void | pinMode (pin_t pin, PinMode_t mode) |
Set the mode of a given pin. More... | |
virtual void | pinModeBuffered (pin_t pin, PinMode_t mode)=0 |
Set the mode of a given pin in the software buffer. More... | |
virtual void | digitalWrite (pin_t pin, PinStatus_t state) |
Set the output of the given pin to the given state. More... | |
virtual void | digitalWriteBuffered (pin_t pin, PinStatus_t state)=0 |
Set the output of a given pin in the software buffer. More... | |
virtual PinStatus_t | digitalRead (pin_t pin) |
Read the state of the given pin. More... | |
virtual PinStatus_t | digitalReadBuffered (pin_t pin)=0 |
Read the state of the given pin from the software buffer. More... | |
virtual void | analogWrite (pin_t pin, analog_t val) |
Write an analog (or PWM) value to the given pin. More... | |
virtual void | analogWriteBuffered (pin_t pin, analog_t val)=0 |
Write an analog (or PWM) value to the software buffer given pin. More... | |
virtual analog_t | analogRead (pin_t pin) |
Read the analog value of the given pin. More... | |
virtual analog_t | analogReadBuffered (pin_t pin)=0 |
Read the analog value of the given pin from the software buffer. More... | |
virtual void | begin ()=0 |
Initialize the extended IO element. More... | |
virtual void | updateBufferedOutputs ()=0 |
Write the internal state to the physical outputs. More... | |
virtual void | updateBufferedInputs ()=0 |
Read the physical state into the input buffers. More... | |
pin_t | pin (pin_t pin) const |
Get the extended IO pin number of a given physical pin of this extended IO element. More... | |
pin_t | operator[] (pin_t pin) const |
Get the extended IO pin number of a given physical pin of this extended IO element. More... | |
pin_t | getLength () const |
Get the number of pins this IO element has. More... | |
pin_t | getEnd () const |
Get the largest global extended IO pin number that belongs to this extended IO element. More... | |
pin_t | getStart () const |
Get the smallest global extended IO pin number that belongs to this extended IO element. More... | |
Static Public Member Functions | |
static constexpr uint16_t | length () |
static void | beginAll () |
Initialize all extended IO elements. More... | |
static void | updateAllBufferedOutputs () |
Write the internal states to the physical outputs for all extended IO elements. More... | |
static void | updateAllBufferedInputs () |
Read the physical state into the input buffers for all extended IO elements. More... | |
static DoublyLinkedList< ExtendedIOElement > & | getAll () |
Get the list of all Extended IO elements. More... | |
Protected Member Functions | |
StaticSizeExtendedIOElement () | |
Protected Attributes | |
ExtendedIOElement * | next |
ExtendedIOElement * | previous |
Static Protected Attributes | |
static DoublyLinkedList< ExtendedIOElement > | updatables |
Private Attributes | |
const pin_t | start |
const pin_t | end |
Static Private Attributes | |
static pin_t | offset = NUM_DIGITAL_PINS + NUM_ANALOG_INPUTS |
|
inlineprotected |
Definition at line 18 of file StaticSizeExtendedIOElement.hpp.
Get an array containing all pins of the element.
Definition at line 24 of file StaticSizeExtendedIOElement.hpp.
|
inlinestaticconstexpr |
Definition at line 28 of file StaticSizeExtendedIOElement.hpp.
Set the mode of a given pin.
pin | The (zero-based) pin of this IO element. |
mode | The mode to set the pin to (e.g. INPUT , OUTPUT or INPUT_PULLUP ). |
Reimplemented in MAX7219< NumChips, SPIDriver >, and ShiftRegisterOutBase< N >.
Definition at line 97 of file ExtendedIOElement.hpp.
Set the mode of a given pin in the software buffer.
The buffer is written to the ExtIO device when updateBufferedOutputs is called.
pin | The (zero-based) pin of this IO element. |
mode | The mode to set the pin to (e.g. INPUT , OUTPUT or INPUT_PULLUP ). |
Implemented in MCP23017< WireType >, MAX7219< NumChips, SPIDriver >, and ShiftRegisterOutBase< N >.
|
inlinevirtualinherited |
Set the output of the given pin to the given state.
pin | The (zero-based) pin of this IO element. |
state | The new state to set the pin to. |
Reimplemented in MAX7219< NumChips, SPIDriver >, and ShiftRegisterOutBase< N >.
Definition at line 118 of file ExtendedIOElement.hpp.
|
pure virtualinherited |
Set the output of a given pin in the software buffer.
The buffer is written to the ExtIO device when updateBufferedOutputs is called.
pin | The (zero-based) pin of this IO element. |
state | The new state to set the pin to. |
Implemented in MCP23017< WireType >, MAX7219< NumChips, SPIDriver >, and ShiftRegisterOutBase< N >.
|
inlinevirtualinherited |
Read the state of the given pin.
pin | The (zero-based) pin of this IO element. |
Reimplemented in MAX7219< NumChips, SPIDriver >, and ShiftRegisterOutBase< N >.
Definition at line 138 of file ExtendedIOElement.hpp.
|
pure virtualinherited |
Read the state of the given pin from the software buffer.
To update the buffer, you have to call updateBufferedInputs first.
pin | The (zero-based) pin of this IO element. |
Implemented in MAX7219< NumChips, SPIDriver >, MCP23017< WireType >, and ShiftRegisterOutBase< N >.
Write an analog (or PWM) value to the given pin.
pin | The (zero-based) pin of this IO element. |
val | The new analog value to set the pin to. |
Reimplemented in MAX7219< NumChips, SPIDriver >, and ShiftRegisterOutBase< N >.
Definition at line 158 of file ExtendedIOElement.hpp.
Write an analog (or PWM) value to the software buffer given pin.
The buffer is written to the ExtIO device when updateBufferedOutputs is called.
pin | The (zero-based) pin of this IO element. |
val | The new analog value to set the pin to. |
Implemented in MAX7219< NumChips, SPIDriver >, ShiftRegisterOutBase< N >, and MCP23017< WireType >.
Read the analog value of the given pin.
pin | The (zero-based) pin of this IO element. |
Reimplemented in MAX7219< NumChips, SPIDriver >, and ShiftRegisterOutBase< N >.
Definition at line 178 of file ExtendedIOElement.hpp.
Read the analog value of the given pin from the software buffer.
To update the buffer, you have to call updateBufferedInputs first.
pin | The (zero-based) pin of this IO element. |
Implemented in MCP23017< WireType >, MAX7219< NumChips, SPIDriver >, and ShiftRegisterOutBase< N >.
|
pure virtualinherited |
Initialize the extended IO element.
Implemented in MAX7219< NumChips, SPIDriver >, MCP23017< WireType >, ShiftRegisterOut< N >, and SPIShiftRegisterOut< N, SPIDriver >.
|
staticinherited |
Initialize all extended IO elements.
Definition at line 17 of file ExtendedIOElement.cpp.
|
pure virtualinherited |
Write the internal state to the physical outputs.
Implemented in MAX7219< NumChips, SPIDriver >, MCP23017< WireType >, ShiftRegisterOut< N >, and SPIShiftRegisterOut< N, SPIDriver >.
|
staticinherited |
Write the internal states to the physical outputs for all extended IO elements.
Definition at line 21 of file ExtendedIOElement.cpp.
|
pure virtualinherited |
Read the physical state into the input buffers.
Implemented in MAX7219< NumChips, SPIDriver >, MCP23017< WireType >, and ShiftRegisterOutBase< N >.
|
staticinherited |
Read the physical state into the input buffers for all extended IO elements.
Definition at line 25 of file ExtendedIOElement.cpp.
Get the extended IO pin number of a given physical pin of this extended IO element.
pin | The zero-based physical pin number of this IO element. |
Definition at line 29 of file ExtendedIOElement.cpp.
Get the extended IO pin number of a given physical pin of this extended IO element.
It is alias for ExtendedIOElement::pin
.
pin | The zero-based physical pin number of this IO element. |
Definition at line 44 of file ExtendedIOElement.cpp.
|
inherited |
Get the number of pins this IO element has.
Definition at line 46 of file ExtendedIOElement.cpp.
|
inherited |
Get the largest global extended IO pin number that belongs to this extended IO element.
Definition at line 48 of file ExtendedIOElement.cpp.
|
inherited |
Get the smallest global extended IO pin number that belongs to this extended IO element.
Definition at line 50 of file ExtendedIOElement.cpp.
|
staticinherited |
Get the list of all Extended IO elements.
Definition at line 52 of file ExtendedIOElement.cpp.
|
inlineinherited |
Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.
Definition at line 96 of file Updatable.hpp.
|
inlinestaticinherited |
Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.
Definition at line 125 of file Updatable.hpp.
|
inlinestaticinherited |
Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.
Definition at line 127 of file Updatable.hpp.
|
inlinestaticinherited |
Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.
Definition at line 130 of file Updatable.hpp.
|
inlineinherited |
Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.
Definition at line 106 of file Updatable.hpp.
|
inlinestaticinherited |
Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.
Definition at line 136 of file Updatable.hpp.
|
inlinestaticinherited |
Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.
Definition at line 138 of file Updatable.hpp.
|
inlinestaticinherited |
Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.
Definition at line 141 of file Updatable.hpp.
|
inlineinherited |
Check if this updatable is enabled.
Definition at line 120 of file Updatable.hpp.
|
inlineinherited |
Move down this element in the list.
Definition at line 147 of file Updatable.hpp.
|
privateinherited |
Definition at line 267 of file ExtendedIOElement.hpp.
|
privateinherited |
Definition at line 268 of file ExtendedIOElement.hpp.
|
staticprivateinherited |
Definition at line 269 of file ExtendedIOElement.hpp.
|
staticprotectedinherited |
Definition at line 152 of file Updatable.hpp.
|
protectedinherited |
Definition at line 320 of file LinkedList.hpp.
|
protectedinherited |
Definition at line 321 of file LinkedList.hpp.