FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
|
General API for handling Pin Change Interrupts. More...
#include "boards/board.h"
#include "boards/board_traits.h"
#include <avr/interrupt.h>
#include "interrupts.h"
#include "utilities.h"
Go to the source code of this file.
Classes | |
class | interrupt::PCISignal< PCINT_ > |
Handler of a Pin Change Interrupt vector. More... | |
struct | interrupt::PCIType< PIN > |
Helper class that easily converts a PIN into the right PCISignal . More... | |
Namespaces | |
namespace | board |
Defines all types and constants specific to support a specific MCU target. | |
namespace | interrupt |
Defines API to handle AVR interruptions. | |
Macros | |
#define | REGISTER_PCI_ISR_METHOD(PCI_NUM, HANDLER, CALLBACK, PIN, ...) |
Register the necessary ISR (Interrupt Service Routine) for a Pin Change Interrupt vector. More... | |
#define | REGISTER_PCI_ISR_FUNCTION(PCI_NUM, CALLBACK, PIN, ...) |
Register the necessary ISR (Interrupt Service Routine) for a Pin Change Interrupt vector. More... | |
#define | REGISTER_PCI_ISR_EMPTY(PCI_NUM, PIN, ...) |
Register an empty ISR (Interrupt Service Routine) for a Pin Change Interrupt vector. More... | |
#define | DECL_PCI_ISR_HANDLERS_FRIEND |
This macro shall be used in a class containing a private callback method, registered by REGISTER_PCI_ISR_METHOD . More... | |
Typedefs | |
template<board::InterruptPin PIN> | |
using | interrupt::PCI_SIGNAL = typename PCIType< PIN >::TYPE |
Useful alias type to the PCISignal type matching a given board::InterruptPin . More... | |
template<board::Port PORT> | |
using | interrupt::PCI_PORT_SIGNAL = PCISignal< board_traits::Port_trait< PORT >::PCINT > |
Convert a board::PORT to the matching PCISignal . More... | |
Functions | |
template<InterruptPin PCI> | |
constexpr DigitalPin | board::PCI_PIN () |
Convert an InterruptPin to the matching DigitalPin . More... | |
General API for handling Pin Change Interrupts.
The basic principle is to instantiate one interrupt::PCI
per PCINT vector you need to handle, whatever the number of pins you need in this PCINT. If you add a callback, it will be called for whatever pin may have changed state in the list of pins supported by your interrupt::PCI
instance.
Definition in file pci.h.
#define REGISTER_PCI_ISR_METHOD | ( | PCI_NUM, | |
HANDLER, | |||
CALLBACK, | |||
PIN, | |||
... | |||
) |
Register the necessary ISR (Interrupt Service Routine) for a Pin Change Interrupt vector.
PCI_NUM | the number of the PCINT vector for the given PIN pins |
HANDLER | the class holding the callback method |
CALLBACK | the method of HANDLER that will be called when the interrupt is triggered; this must be a proper PTMF (pointer to member function). |
PIN | the board::InterruptPin pins for PCI_NUM ; if any of the given PIN does not match with PCI_NUM , compilation will fail. |
#define REGISTER_PCI_ISR_FUNCTION | ( | PCI_NUM, | |
CALLBACK, | |||
PIN, | |||
... | |||
) |
Register the necessary ISR (Interrupt Service Routine) for a Pin Change Interrupt vector.
PCI_NUM | the number of the PCINT vector for the given PIN pins |
CALLBACK | the function that will be called when the interrupt is triggered |
PIN | the board::InterruptPin pins for PCI_NUM ; if any of the given PIN does not match with PCI_NUM , compilation will fail. |
#define REGISTER_PCI_ISR_EMPTY | ( | PCI_NUM, | |
PIN, | |||
... | |||
) |
Register an empty ISR (Interrupt Service Routine) for a Pin Change Interrupt vector.
This can be useful if you just need to wake up the MCU from an external signal, but do not need to perform any sepcific stuff with a callback.
PCI_NUM | the number of the PCINT vector for the given PIN pins |
PIN | the board::InterruptPin pins for PCI_NUM ; if any of the given PIN does not match with PCI_NUM , compilation will fail. |
#define DECL_PCI_ISR_HANDLERS_FRIEND |
This macro shall be used in a class containing a private callback method, registered by REGISTER_PCI_ISR_METHOD
.
It declares the class where it is used as a friend of all necessary functions so that the private callback method can be called properly.