FastArduino  v1.7
C++ library to build fast but small Arduino/AVR projects
interrupt::INTSignal< EXTPIN_ > Class Template Reference

Handler of an External Interrupt. More...

#include <fastarduino/int.h>

Public Member Functions

 INTSignal (const INTSignal< EXTPIN_ > &)=delete
 
INTSignal< EXTPIN_ > & operator= (const INTSignal< EXTPIN_ > &)=delete
 
 INTSignal (InterruptTrigger trigger=InterruptTrigger::ANY_CHANGE)
 Create a handler for EXTPIN external interrupt pin. More...
 
void set_trigger (InterruptTrigger trigger)
 Change the kind of level event that shall trigger an External Interrupt for EXTPIN. More...
 
void enable ()
 Enable interrupts for this external interrupt pin. More...
 
void disable ()
 Disable interrupts for this external interrupt pin. More...
 
void clear ()
 Clear the interrupt flag for this external interrupt pin. More...
 
void set_trigger_ (InterruptTrigger trigger)
 Enable interrupts for this external interrupt pin. More...
 
void enable_ ()
 Enable interrupts for this external interrupt pin. More...
 
void disable_ ()
 Disable interrupts for this external interrupt pin. More...
 
void clear_ ()
 Clear the interrupt flag for this external interrupt pin. More...
 

Static Public Attributes

static constexpr const board::ExternalInterruptPin EXTPIN = EXTPIN_
 The External Interrupt pin managed by this INTSignal.
 
static constexpr const board::DigitalPin PIN = board::EXT_PIN<EXTPIN>()
 The actual connected pin managed by this INTSignal.
 

Detailed Description

template<board::ExternalInterruptPin EXTPIN_>
class interrupt::INTSignal< EXTPIN_ >

Handler of an External Interrupt.

You must create as many as you have pins you want to handle as External Interrupts. If you need a function or method to be called back when an External Interrupt occurs for PIN, then you have to use REGISTER_INT_ISR_FUNCTION() or REGISTER_INT_ISR_METHOD() macros. If you don't, then use REGISTER_INT_ISR_EMPTY() macro.

Template Parameters
EXTPIN_the External Interrupt pin
See also
board::ExternalInterruptPin
REGISTER_INT_ISR_FUNCTION
REGISTER_INT_ISR_METHOD
REGISTER_INT_ISR_EMPTY

Definition at line 131 of file int.h.

Constructor & Destructor Documentation

◆ INTSignal()

template<board::ExternalInterruptPin EXTPIN_>
interrupt::INTSignal< EXTPIN_ >::INTSignal ( InterruptTrigger  trigger = InterruptTrigger::ANY_CHANGE)
inlineexplicit

Create a handler for EXTPIN external interrupt pin.

This does not automatically enable the interrupt.

Parameters
triggerthe kind of level event that shall trigger an External Interrupt for EXTPIN
See also
enable()
set_trigger()

Definition at line 154 of file int.h.

Member Function Documentation

◆ set_trigger()

template<board::ExternalInterruptPin EXTPIN_>
void interrupt::INTSignal< EXTPIN_ >::set_trigger ( InterruptTrigger  trigger)
inline

Change the kind of level event that shall trigger an External Interrupt for EXTPIN.

Note that this method is synchronized, i.e. it disables interrupts during its call and restores interrupts on return. If you do not need synchronization, then you should better use set_trigger_() instead.

Parameters
triggerthe new kind of level event
See also
set_trigger_()

Definition at line 170 of file int.h.

◆ enable()

template<board::ExternalInterruptPin EXTPIN_>
void interrupt::INTSignal< EXTPIN_ >::enable ( )
inline

Enable interrupts for this external interrupt pin.

Note that this method is synchronized, i.e. it disables all interrupts during its call and restores interrupts on return. If you do not need synchronization, then you should better use enable_() instead.

Definition at line 183 of file int.h.

◆ disable()

template<board::ExternalInterruptPin EXTPIN_>
void interrupt::INTSignal< EXTPIN_ >::disable ( )
inline

Disable interrupts for this external interrupt pin.

Note that this method is synchronized, i.e. it disables all interrupts during its call and restores interrupts on return. If you do not need synchronization, then you should better use disable_() instead.

Definition at line 195 of file int.h.

◆ clear()

template<board::ExternalInterruptPin EXTPIN_>
void interrupt::INTSignal< EXTPIN_ >::clear ( )
inline

Clear the interrupt flag for this external interrupt pin.

Generally, you would not need this method as that interrupt flag automatically gets cleared when the matching ISR is executed. Note that this method is synchronized, i.e. it disables all interrupts during its call and restores interrupts on return. If you do not need synchronization, then you should better use clear_() instead.

Definition at line 209 of file int.h.

◆ set_trigger_()

template<board::ExternalInterruptPin EXTPIN_>
void interrupt::INTSignal< EXTPIN_ >::set_trigger_ ( InterruptTrigger  trigger)
inline

Enable interrupts for this external interrupt pin.

Note that this method is not synchronized, hence you should ensure it is called only while global interrupts are not enabled. If you need synchronization, then you should better use set_trigger() instead.

Definition at line 221 of file int.h.

◆ enable_()

template<board::ExternalInterruptPin EXTPIN_>
void interrupt::INTSignal< EXTPIN_ >::enable_ ( )
inline

Enable interrupts for this external interrupt pin.

Note that this method is not synchronized, hence you should ensure it is called only while global interrupts are not enabled. If you need synchronization, then you should better use enable() instead.

Definition at line 234 of file int.h.

◆ disable_()

template<board::ExternalInterruptPin EXTPIN_>
void interrupt::INTSignal< EXTPIN_ >::disable_ ( )
inline

Disable interrupts for this external interrupt pin.

Note that this method is not synchronized, hence you should ensure it is called only while global interrupts are not enabled. If you need synchronization, then you should better use disable() instead.

Definition at line 246 of file int.h.

◆ clear_()

template<board::ExternalInterruptPin EXTPIN_>
void interrupt::INTSignal< EXTPIN_ >::clear_ ( )
inline

Clear the interrupt flag for this external interrupt pin.

Generally, you would not need this method as that interrupt flag automatically gets cleared when the matching ISR is executed. Note that this method is not synchronized, hence you should ensure it is called only while global interrupts are not enabled. If you need synchronization, then you should better use clear() instead.

Definition at line 260 of file int.h.


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