FastGPIO library
Public Attributes | List of all members
FastGPIO::PinLoan< pin > Class Template Reference

#include <FastGPIO.h>

Public Attributes

uint8_t state
 The state of the pin as returned from FastGPIO::Pin::getState.
 

Detailed Description

template<uint8_t pin>
class FastGPIO::PinLoan< pin >

This class saves the state of the specified pin in its constructor when it is created, and restores the pin to that state in its destructor. This can be very useful if a pin is being used for multiple purposes. It allows you to write code that temporarily changes the state of the pin and is guaranteed to restore the state later.

For example, if you were controlling both a button and an LED using a single pin and you wanted to see if the button was pressed without affecting the LED, you could write:

This is equivalent to:

bool buttonIsPressed()
{
_delay_us(10);
return value;
}

Definition at line 542 of file FastGPIO.h.


The documentation for this class was generated from the following file: