FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
interrupt::PCISignal< PCINT_ > Class Template Reference

Handler of a Pin Change Interrupt vector. More...

#include <fastarduino/pci.h>

Public Member Functions

 PCISignal (const PCISignal &)=delete
 
PCISignaloperator= (const PCISignal &)=delete
 
void enable ()
 Enable pin change interrupts handled by this PCISignal. More...
 
void disable ()
 Disable all pin change interrupts handled by this PCISignal. More...
 
void clear ()
 Clear the interrupt flag for this pin change interrupt vector. More...
 
void set_enable_pins (uint8_t mask)
 Set the exact list of pins, in this PCINT, for which Pin Change Interrupts must be enabled. More...
 
void enable_pins (uint8_t mask)
 Enable pin change interrupts for several pins of this PCINT. More...
 
void disable_pins (uint8_t mask)
 Disable pin change interrupts for several pins of this PCINT. More...
 
template<board::InterruptPin PIN>
void enable_pin ()
 Enable Pin Change Interrupts for PIN. More...
 
template<board::InterruptPin PIN>
void disable_pin ()
 Disable Pin Change Interrupts for PIN. More...
 
void enable_ ()
 Enable pin change interrupts for this PCISignal. More...
 
void disable_ ()
 Disable all pin change interrupts for this PCISignal. More...
 
void clear_ ()
 Clear the interrupt flag for this pin change interrupt vector. More...
 
void set_enable_pins_ (uint8_t mask)
 Set the exact list of pins, in this PCINT, for which Pin Change Interrupts must be enabled. More...
 
void enable_pins_ (uint8_t mask)
 Enable pin change interrupts for several pins of this PCINT. More...
 
void disable_pins_ (uint8_t mask)
 Disable pin change interrupts for several pins of this PCINT. More...
 
template<board::InterruptPin PIN>
void enable_pin_ ()
 Enable Pin Change Interrupts for PIN. More...
 
template<board::InterruptPin PIN>
void disable_pin_ ()
 Disable Pin Change Interrupts for PIN. More...
 

Static Public Attributes

static constexpr const uint8_t PCINT = PCINT_
 The PCINT vector number for this PCISignal. More...
 

Detailed Description

template<uint8_t PCINT_>
class interrupt::PCISignal< PCINT_ >

Handler of a Pin Change Interrupt vector.

For each PCINT vector you need, you must create one instance of this handler. With one instance, you are then able to handle individually each pin which interrupt you want to enable or disable. If you need a function or method to be called back when a Pin Change Interrupt occurs for a PCINT vector, then you have to use REGISTER_PCI_ISR_FUNCTION or REGISTER_PCI_ISR_METHOD() macros. If you don't then use REGISTER_PCI_ISR_EMPTY() macro. If you don't know the PCINT you need to handle but only a pin, then you can use PCI_SIGNAL<PIN>.

Template Parameters
PCINT_the PCINT vector you want to manage
See also
REGISTER_PCI_ISR_FUNCTION
REGISTER_PCI_ISR_METHOD
REGISTER_PCI_ISR_EMPTY
PCIType
PCI_SIGNAL

Definition at line 176 of file pci.h.

Member Function Documentation

◆ enable()

template<uint8_t PCINT_>
void interrupt::PCISignal< PCINT_ >::enable ( )
inline

Enable pin change interrupts handled by this PCISignal.

Enabling interrupts on a PCINT is not sufficient, you should enable pin change interrupts for each individual pin you are interested in, with enable_pin() or enable_pins(). 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.

See also
enable_()
disable()
enable_pin()
enable_pins()

Definition at line 211 of file pci.h.

◆ disable()

template<uint8_t PCINT_>
void interrupt::PCISignal< PCINT_ >::disable ( )
inline

Disable all pin change interrupts handled by this PCISignal.

If you need to only diable pin change interrupts for some pins of that PCINT, then use disable_pin() instead. 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.

See also
enable()
disable_()
disable_pin()

Definition at line 228 of file pci.h.

◆ clear()

template<uint8_t PCINT_>
void interrupt::PCISignal< PCINT_ >::clear ( )
inline

Clear the interrupt flag for this pin change interrupt vector.

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.

See also
clear_()

Definition at line 243 of file pci.h.

◆ set_enable_pins()

template<uint8_t PCINT_>
void interrupt::PCISignal< PCINT_ >::set_enable_pins ( uint8_t  mask)
inline

Set the exact list of pins, in this PCINT, for which Pin Change Interrupts must be enabled.

For other pins, interrupts will be disabled. This method provides no compile-time safety net if you pass a wrong mask. 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 set_enable_pins_() instead.

Parameters
maskthe mask of pin bits which pin change interrupts you want to enable for this PCINT; other pins will have interrupts disabled.
See also
set_enable_pins_()
enable_pins()
disable_pins()

Definition at line 262 of file pci.h.

◆ enable_pins()

template<uint8_t PCINT_>
void interrupt::PCISignal< PCINT_ >::enable_pins ( uint8_t  mask)
inline

Enable pin change interrupts for several pins of this PCINT.

This does not enable completely interrupts, for this you need to also call enable(). This method is useful when you have several pins to enable at once; if you have only one pin, then enable_pin() is preferred. This method provides no compile-time safety net if you pass a wrong mask. 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_pins_() instead.

Parameters
maskthe mask of pin bits which pin change interrupts you want to enable for this PCINT; only pins included in mask will be affected; if other pins are already enabled, they won't be changed.
See also
enable()
enable_pins_()
enable_pin()
disable_pin()

Definition at line 286 of file pci.h.

◆ disable_pins()

template<uint8_t PCINT_>
void interrupt::PCISignal< PCINT_ >::disable_pins ( uint8_t  mask)
inline

Disable pin change interrupts for several pins of this PCINT.

This does not disable completely interrupts, for this you need to also call disable(). This method is useful when you have several pins to disable at once; if you have only one pin, then disable_pin() is preferred. This method provides no compile-time safety net if you pass a wrong mask. 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_pins_() instead.

Parameters
maskthe mask of pin bits which pin change interrupts you want to disable for this PCINT; only pins included in mask will be affected; if other pins are already enabled, they won't be changed.
See also
disable()
disable_pins_()
enable_pin()
disable_pin()

Definition at line 310 of file pci.h.

◆ enable_pin()

template<uint8_t PCINT_>
template<board::InterruptPin PIN>
void interrupt::PCISignal< PCINT_ >::enable_pin ( )
inline

Enable Pin Change Interrupts for 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_pin_() instead.

Template Parameters
PINthe pin for which to enable Pin Change Interrupts; this must belong to the handler's PCINT and must support Pin Change Interrupts, otherwise compilation will fail.
See also
enable_pin_()
disable_pin()
enable_pins()

Definition at line 328 of file pci.h.

◆ disable_pin()

template<uint8_t PCINT_>
template<board::InterruptPin PIN>
void interrupt::PCISignal< PCINT_ >::disable_pin ( )
inline

Disable Pin Change Interrupts for 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_pin_() instead.

Template Parameters
PINthe pin for which to disable Pin Change Interrupts; this must belong to the handler's PCINT and must support Pin Change Interrupts, otherwise compilation will fail.
See also
disable_pin_()
enable_pin()

Definition at line 346 of file pci.h.

◆ enable_()

template<uint8_t PCINT_>
void interrupt::PCISignal< PCINT_ >::enable_ ( )
inline

Enable pin change interrupts for this PCISignal.

Enabling interrupts is not sufficient, you should enable pin change interrupts for each individual pin you are interested in, with enable_pin() or enable_pins(). 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.

See also
enable()
disable_()
enable_pin_()
enable_pins_()

Definition at line 366 of file pci.h.

◆ disable_()

template<uint8_t PCINT_>
void interrupt::PCISignal< PCINT_ >::disable_ ( )
inline

Disable all pin change interrupts for this PCISignal.

If you need to only diable pin change interrupts for some pins of that PCINT, then use disable_pin() instead. 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.

See also
enable()
disable()
disable_pin_()

Definition at line 383 of file pci.h.

◆ clear_()

template<uint8_t PCINT_>
void interrupt::PCISignal< PCINT_ >::clear_ ( )
inline

Clear the interrupt flag for this pin change interrupt vector.

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.

See also
clear()

Definition at line 398 of file pci.h.

◆ set_enable_pins_()

template<uint8_t PCINT_>
void interrupt::PCISignal< PCINT_ >::set_enable_pins_ ( uint8_t  mask)
inline

Set the exact list of pins, in this PCINT, for which Pin Change Interrupts must be enabled.

For other pins, interrupts will be disabled. This method provides no compile-time safety net if you pass a wrong mask. 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_enable_pins() instead.

Parameters
maskthe mask of pin bits which pin change interrupts you want to enable for this PCINT; other pins will have interrupts disabled.
See also
set_enable_pins()
enable_pins_()
disable_pins_()

Definition at line 417 of file pci.h.

◆ enable_pins_()

template<uint8_t PCINT_>
void interrupt::PCISignal< PCINT_ >::enable_pins_ ( uint8_t  mask)
inline

Enable pin change interrupts for several pins of this PCINT.

This does not enable completely interrupts, for this you need to also call enable_(). This method is useful when you have several pins to enable at once; if you have only one pin, then enable_pin_() is preferred. This method provides no compile-time safety net if you pass a wrong mask. 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_pin() instead.

Parameters
maskthe mask of pin bits which pin change interrupts you want to enable for this PCINT; only pins included in mask will be affected; if other pins are already enabled, they won't be changed.
See also
enable_()
enable_pins()
enable_pin_()
disable_pin_()

Definition at line 441 of file pci.h.

◆ disable_pins_()

template<uint8_t PCINT_>
void interrupt::PCISignal< PCINT_ >::disable_pins_ ( uint8_t  mask)
inline

Disable pin change interrupts for several pins of this PCINT.

This does not disable completely interrupts, for this you need to also call disable_(). This method is useful when you have several pins to disable at once; if you have only one pin, then disable_pin_() is preferred. This method provides no compile-time safety net if you pass a wrong mask. 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_pin() instead.

Parameters
maskthe mask of pin bits which pin change interrupts you want to disable for this PCINT; only pins included in mask will be affected; if other pins are already enabled, they won't be changed.
See also
disable_()
disable_pins()
enable_pin_()
disable_pin_()

Definition at line 465 of file pci.h.

◆ enable_pin_()

template<uint8_t PCINT_>
template<board::InterruptPin PIN>
void interrupt::PCISignal< PCINT_ >::enable_pin_ ( )
inline

Enable Pin Change Interrupts for 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_pin() instead.

Template Parameters
PINthe pin for which to enable Pin Change Interrupts; this must belong to the handler's PCINT and must support Pin Change Interrupts, otherwise compilation will fail.
See also
enable_pin()
disable_pin_()
enable_pins_()

Definition at line 483 of file pci.h.

◆ disable_pin_()

template<uint8_t PCINT_>
template<board::InterruptPin PIN>
void interrupt::PCISignal< PCINT_ >::disable_pin_ ( )
inline

Disable Pin Change Interrupts for 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_pin() instead.

Template Parameters
PINthe pin for which to disable Pin Change Interrupts; this must belong to the handler's PCINT and must support Pin Change Interrupts, otherwise compilation will fail.
See also
disable_pin()
enable_pin_()

Definition at line 501 of file pci.h.

Member Data Documentation

◆ PCINT

template<uint8_t PCINT_>
constexpr const uint8_t interrupt::PCISignal< PCINT_ >::PCINT = PCINT_
staticconstexpr

The PCINT vector number for this PCISignal.

Definition at line 195 of file pci.h.


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