avr/cpp/Interrupt.h File Reference

#include "IO.h"
#include "Assembler.h"

Go to the source code of this file.

Namespaces

namespace  AVRCpp
namespace  AVRCpp::GlobalInterrupts
namespace  AVRCpp::GlobalInterrupts::Internal

Classes

class  AVRCpp::GlobalInterrupts::Internal::InterruptDisabler

Defines

#define INTERRUPT_HANDLER(interruptName)
#define RECURSIVE_INTERRUPT_HANDLER(interruptName)
#define EVOCABLE_INTERRUPT_HANDLER(interruptName)
#define EVOCABLE_RECURSIVE_INTERRUPT_HANDLER(interruptName)
#define EXCLUDE_INTERRUPT(interruptName)
#define __DELEGATE_HANDLER__(vector)
#define USING_MULTI_DELEGATE(interruptName)
#define USING_FAST_DELEGATE(interruptName)
#define USING_DATA_DELEGATE(interruptName, controllerName)
#define INTERRUPT_SAFE   for(AVRCpp::GlobalInterrupts::Internal::InterruptDisabler safeObject; !safeObject.IsFinished(); safeObject.Finished() )
 Temporarily disable interrupts.

Functions

void AVRCpp::GlobalInterrupts::Enable ()
void AVRCpp::GlobalInterrupts::Disable ()
uint8_t AVRCpp::GlobalInterrupts::IsEnabled ()
void AVRCpp::GlobalInterrupts::WaitForInterrupt ()


Define Documentation

#define __DELEGATE_HANDLER__ ( vector   ) 

Value:

extern "C" void vector(void) __attribute__ ((signal)); \
                void vector (void)

Definition at line 58 of file Interrupt.h.

#define EVOCABLE_INTERRUPT_HANDLER ( interruptName   ) 

Value:

extern "C" void interruptName ## _vect(void) __attribute__ ((signal)); \
                void interruptName ## _vect(void) { AVRCpp::interruptName ## _struct::Evoke(); } \
                void AVRCpp::interruptName ## _struct::Evoke(void)

Definition at line 44 of file Interrupt.h.

#define EVOCABLE_RECURSIVE_INTERRUPT_HANDLER ( interruptName   ) 

Value:

extern "C" void interruptName ## _vect(void) __attribute__ ((interrupt)); \
                void interruptName ## _vect(void) { AVRCpp::interruptName ## _struct::Evoke(); } \
                void AVRCpp::interruptName ## _struct::Evoke(void)

Definition at line 49 of file Interrupt.h.

#define EXCLUDE_INTERRUPT ( interruptName   ) 

Value:

extern "C" void interruptName ## _vect(void) __attribute__ ((naked)); \
                void interruptName ## _vect(void) {  __asm__ __volatile__ ("reti" ::); }

Definition at line 54 of file Interrupt.h.

#define INTERRUPT_HANDLER ( interruptName   ) 

Value:

extern "C" void interruptName ## _vect(void) __attribute__ ((signal)); \
                void interruptName ## _vect(void)

Definition at line 36 of file Interrupt.h.

#define INTERRUPT_SAFE   for(AVRCpp::GlobalInterrupts::Internal::InterruptDisabler safeObject; !safeObject.IsFinished(); safeObject.Finished() )

Temporarily disable interrupts.

Use INTERRUPT_SAFE to execute commands that need to run uninterrupted. Interruptsafe disables interrupts, executes your command(s) and finally enables interrupts, if they were enabled before using INTERRUPT_SAFE. To disable interrupts during one command, use the following code:

 // Interrupts are disabled during MyImportantCommand()
 INTERRUPT_SAFE
     MyImportantCommand();
If you need to run a block of code without any interrupts between or during the commands, enclose it with braces:
 // Interrupts are disabled during execution of the code block in braces
 INTERRUPT_SAFE
 {
     VariableX = new_value;
     methodThatDependsOnVariableX();
     methodThatHasToFollowImmediately();
 }
Attention:
If GlobalInterrupts::Enable() is called within the INTERRUPT_SAFE block, the interrupts will be enabled. INTERRUPT_SAFE just disables interrupts in the beginning and restores the previous state in the end. Any code in between can freely enable and disable interrupts.
Note:
INTERRUPT_SAFE is quite effective: it adds 5 commands to your program, while manually saving SREG, disabling interrupts and restoring SREG

Definition at line 112 of file Interrupt.h.

#define RECURSIVE_INTERRUPT_HANDLER ( interruptName   ) 

Value:

extern "C" void interruptName ## _vect(void) __attribute__ ((interrupt)); \
                void interruptName ## _vect(void)

Definition at line 40 of file Interrupt.h.

#define USING_DATA_DELEGATE ( interruptName,
controllerName   ) 

Value:

namespace AVRCpp { namespace interruptName ## _ns { namespace Internal { controllerName interruptName ## Controller; } \
                void interruptName ## _struct::Evoke() { interruptName ## _ns::Internal::interruptName ## Controller(); } \
                template <> CppDelegate::DataDelegate<controllerName> & interruptName ## _struct::Me<CppDelegate::DataDelegate<controllerName> >() { return interruptName ## _ns::Internal::interruptName ## Controller.Delegate(); } \
                template <> controllerName & interruptName ## _struct::Controller<controllerName>() { return (controllerName &)interruptName ## _ns::Internal::interruptName ## Controller; } } } \
                __DELEGATE_HANDLER__(interruptName ## _vect) { AVRCpp::interruptName ## _ns::Internal::interruptName ## Controller(); }

Definition at line 74 of file Interrupt.h.

#define USING_FAST_DELEGATE ( interruptName   ) 

Value:

namespace AVRCpp { namespace interruptName ## _ns       { namespace Internal { CppDelegate::FastDelegate interruptName ## Delegate; } \
                void interruptName ## _struct::Evoke() { interruptName ## _ns::Internal::interruptName ## Delegate(); } \
                template <> CppDelegate::FastDelegate & interruptName ## _struct::Me<CppDelegate::FastDelegate>() { return interruptName ## _ns::Internal::interruptName ## Delegate; } } } \
                __DELEGATE_HANDLER__(interruptName ## _vect) { AVRCpp::interruptName ## _ns::Internal::interruptName ## Delegate(); }

Definition at line 68 of file Interrupt.h.

#define USING_MULTI_DELEGATE ( interruptName   ) 

Value:

namespace AVRCpp { namespace interruptName ## _ns { namespace Internal { CppDelegate::MultiDelegate interruptName ## Delegate; } \
                void interruptName ## _struct::Evoke() { interruptName ## _ns::Internal::interruptName ## Delegate(); } \
                template <> CppDelegate::MultiDelegate & interruptName ## _struct::Me<CppDelegate::MultiDelegate>() { return interruptName ## _ns::Internal::interruptName ## Delegate; } } } \
                __DELEGATE_HANDLER__(interruptName ## _vect) { AVRCpp::interruptName ## _ns::Internal::interruptName ## Delegate(); }

Definition at line 62 of file Interrupt.h.


Generated on Sat Sep 15 23:41:05 2007 for AVR C++ Lib for ATmega64 by  doxygen 1.5.2
SourceForge.net Logo MTÜ TTÜ Robotiklubi