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

#include <inputportpin.h>

Inheritance diagram for InputPortPin:
InputPin

Public Member Functions

 InputPortPin (InputPort *port, uint8_t index)
 
virtual bool getValue (void) const override
 

Detailed Description

Input pin that can be asked for its state, returning a boolean value. The InputPortPin works with any InputPort interface, for example a GpioPort.

Note
You have to make sure that pins being used for a InputPortPin to operate on must be configured as input. The InputPortPin doesn't know about setting a direction. So if you plan to use a GpioPort for this, first set it up correctly using its setDirection() method. This also includes activating or deactivating internal pullup resistors.

Constructor & Destructor Documentation

◆ InputPortPin()

InputPortPin::InputPortPin ( InputPort port,
uint8_t  index 
)
inline

Constructor.

Parameters
portPointer to input port the pin is located on.
indexZero based index of the pin within the port (e.g. index 2 on PortB results in the pin commonly called PB2).

Member Function Documentation

◆ getValue()

virtual bool InputPortPin::getValue ( void  ) const
inlineoverridevirtual

Gets the value of the pin.

Returns
Value of the pin, true for HIGH level, false for LOW level.

Implements InputPin.