template<class PINTYPE, typename DATATYPE, uint8_t WIDTH>
class PinArray< PINTYPE, DATATYPE, WIDTH >
Template class that allows to build an array of pins with arbitrary type. The use-case is to form a virtual port consisting of pins that can be located anywhere. Although PinArray features both, a getValue() and a setValue() method, depending on the pin type being used only one or the other might be actually available. Using DATATYPE and WIDTH it is possible to even form virtual ports of sizes greater than 8 bit. For convenient access the classes VirtualInputPort and VirtualOutputPort exist, which implement 8 bit ports.
- Parameters
-
PINTYPE | Type of pin to use, e.g. InputPin. Type must be provided by user, e.g. by proper #include. |
DATATYPE | Data type internally used for bit shifting and as parameters, e.g. uint8_t. |
WIDTH | Width of virtual port, may be smaller than DATATYPE supports, e.g. 6 bit. |
- Note
- Be warned: just because this template compiles, it doesn't need to make sense. You can create a virtual port with 32 or even more bits, but using it will be a pain for an 8 bit CPU...
-
You can mix real pins with null pointers, or even reference the same pins multiple times.