FastArduino  v1.7
C++ library to build fast but small Arduino/AVR projects
interrupt Namespace Reference

Defines API to handle AVR interruptions. More...

Classes

class  INTSignal
 Handler of an External Interrupt. More...
 
class  PCISignal
 Handler of a Pin Change Interrupt vector. More...
 
struct  PCIType
 Helper class that easily converts a PIN into the right PCISignal. More...
 

Typedefs

template<board::InterruptPin PIN>
using PCI_SIGNAL = typename PCIType< PIN >::TYPE
 Useful alias type to the PCISignal type matching a given board::InterruptPin. More...
 
template<board::Port PORT>
using PCI_PORT_SIGNAL = PCISignal< board_traits::Port_trait< PORT >::PCINT >
 Convert a board::PORT to the matching PCISignal.
 

Enumerations

enum  InterruptTrigger : uint8_t {
  InterruptTrigger::LOW_LEVEL = 0x00,
  InterruptTrigger::ANY_CHANGE = 0x55,
  InterruptTrigger::FALLING_EDGE = 0xAA,
  InterruptTrigger::RISING_EDGE = 0xFF
}
 Kind of change that will trigger an External Interrupt for a given pin. More...
 

Functions

template<typename Handler >
void register_handler (Handler &handler)
 Register a class instance containing methods that shall be called back by an ISR. More...
 

Detailed Description

Defines API to handle AVR interruptions.

In particular, the following API are provided:

  • generically handle interrupts callbacks
  • handle external interrupt pins
  • handle pin change interrupts

Typedef Documentation

◆ PCI_SIGNAL

template<board::InterruptPin PIN>
using interrupt::PCI_SIGNAL = typedef typename PCIType<PIN>::TYPE

Useful alias type to the PCISignal type matching a given board::InterruptPin.

The following snippet demonstrates usage of PCI_SIGNAL to declare a PCISignal instance for later use in a function:

void f()
{
constexpr const board::InterruptPin PIN = board::InterruptPin::D7;
pci.enable_pin<PIN>();
pci.enable();
...
pci.disable();
}
See also
PCISignal
PCIType

Definition at line 567 of file pci.h.

Enumeration Type Documentation

◆ InterruptTrigger

enum interrupt::InterruptTrigger : uint8_t
strong

Kind of change that will trigger an External Interrupt for a given pin.

Actual uint8_t value matches the related mask for EICR, for up to 4 EXT pins (2 bits per pin), hence the 2-bits value is repeated 4 times.

Enumerator
LOW_LEVEL 

Interrupt is triggered whenever pin level is low.

ANY_CHANGE 

Interrupt is triggered whenever pin level is changing (rising or falling).

FALLING_EDGE 

Interrupt is triggered whenever pin level is falling from high to low.

RISING_EDGE 

Interrupt is triggered whenever pin level is rising from low to high.

Definition at line 106 of file int.h.

Function Documentation

◆ register_handler()

template<typename Handler >
void interrupt::register_handler ( Handler &  handler)

Register a class instance containing methods that shall be called back by an ISR.

The class and member function shall be passed to one of REGISTER_XXXX_ISR_METHOD() macros proposed by various FastArduino API, e.g. REGISTER_WATCHDOG_ISR_METHOD(). Note that you can register different classes, but only one instance of a given class. Also, one class may have different methods to handle different ISR callbacks.

Template Parameters
Handlerthe class containing callback methods
Parameters
handlerthe Handler instance which methods will be called back by registered ISR.

Definition at line 157 of file interrupts.h.

interrupt::PCI_SIGNAL
typename PCIType< PIN >::TYPE PCI_SIGNAL
Useful alias type to the PCISignal type matching a given board::InterruptPin.
Definition: pci.h:567
board::InterruptPin
InterruptPin
Defines all digital output pins of ATmega644, usable as pin change interrupt (PCI) pins.
Definition: atmega_xx4.h:259