avr-classes
Public Member Functions | List of all members
VirtualInputPort Class Reference

#include <virtualinputport.h>

Inheritance diagram for VirtualInputPort:
InputPort

Public Member Functions

 VirtualInputPort (InputPin *pin0, InputPin *pin1, InputPin *pin2, InputPin *pin3, InputPin *pin4, InputPin *pin5, InputPin *pin6, InputPin *pin7)
 
virtual uint8_t getValue (void) const override
 

Detailed Description

Virtual 8 bit port consisting of 8 pins of type InputPin. This is a convenience wrapper for PinArray implementing the InputPort interface.

Constructor & Destructor Documentation

◆ VirtualInputPort()

VirtualInputPort::VirtualInputPort ( InputPin pin0,
InputPin pin1,
InputPin pin2,
InputPin pin3,
InputPin pin4,
InputPin pin5,
InputPin pin6,
InputPin pin7 
)
inline

Constructor. Assigns pins to internal PinArray. The parameters intentionally don't have default values so that you have to make up your mind. See notes.

Parameters
pin0Pin to be used for bit position 0.
pin1Pin to be used for bit position 1.
pin2Pin to be used for bit position 2.
pin3Pin to be used for bit position 3.
pin4Pin to be used for bit position 4.
pin5Pin to be used for bit position 5.
pin6Pin to be used for bit position 6.
pin7Pin to be used for bit position 7.
Note
You can specify null pointers for pins that should not be used (meaning bits that will read always 0).
You can specify the same pin multiple times. But be aware of race conditions when reading the pin state.

Member Function Documentation

◆ getValue()

virtual uint8_t VirtualInputPort::getValue ( void  ) const
inlineoverridevirtual

Get value being represented by set of pins.

Returns
Value read from pins.
Note
Bits that are not associated with a pin read as 0.

Implements InputPort.