AVRTools
A Library for the AVR ATmega328 and ATmega2560 Microcontrollers
Classes | Namespaces | Enumerations
InterruptUtils.h File Reference

This file provides utilities for temporarily disabling (suppressing) interrupts of various kinds in a block of code. It uses the C++ RAII paradigm to ensure interrupt state is restored automatically when the block of code is exited. While all interrupts can be suppressed, tools are provided that allow more selective control of which interrupts are suppressed. More...

#include <stdint.h>
#include <stddef.h>
#include <avr/io.h>
#include <util/atomic.h>
Include dependency graph for InterruptUtils.h:

Go to the source code of this file.

Classes

class  Interrupts::AllOff
 This class defines an object that disables all interrupts during its lifetime. Interrupt state is restored by the object's destructor when the object goes out of scope. More...
 
class  Interrupts::ExternalOff
 This class defines an object that disables selected external interrupts during its lifetime. The selected external interrupts are restored by the object's destructor when it goes out of scope. More...
 
class  Interrupts::PinChangeOff
 This class defines an object that disables selected pin change interrupts during its lifetime. The selected pin change interrupts are restored by the object's destructor when it goes out of scope. More...
 

Namespaces

 Interrupts
 This namespace bundles various utility classes designed to suppress selected interrupts using the RAII idiom.
 

Enumerations

enum  Interrupts::ExternalInterrupts {
  Interrupts::kExternalInterrupt0, Interrupts::kExternalInterrupt1, Interrupts::kExternalInterrupt2, Interrupts::kExternalInterrupt3,
  Interrupts::kExternalInterrupt4, Interrupts::kExternalInterrupt5, Interrupts::kExternalInterrupt6, Interrupts::kExternalInterrupt7,
  Interrupts::kExternalInterruptAll
}
 This enum lists the external interrupts that can be suppressed (disabled). To pass more than one external interrupt, simply "or" them. More...
 
enum  Interrupts::PinChangeInterrupts { Interrupts::kPinChangeInterrupt0, Interrupts::kPinChangeInterrupt1, Interrupts::kPinChangeInterrupt2, Interrupts::kPinChangeInterruptAll }
 This enum lists the pin change interrupts that can be suppressed (disabled). To pass more than one pin change interrupt, simply "or" them. More...
 

Detailed Description

This file provides utilities for temporarily disabling (suppressing) interrupts of various kinds in a block of code. It uses the C++ RAII paradigm to ensure interrupt state is restored automatically when the block of code is exited. While all interrupts can be suppressed, tools are provided that allow more selective control of which interrupts are suppressed.