avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] RE: Class Interrupts


From: Ron Kreymborg
Subject: RE: [avr-gcc-list] RE: Class Interrupts
Date: Thu, 27 Mar 2008 14:52:24 +1100

Thanks to a few clues from Marek, this is now working well. The syntax is:

void MyInt(void) __attribute__ ((signal(xx), __INTR_ATTRS));

where xx is a number within the range of AVR interrupts and MyInt can be any
name.

Although not part of the patch, some thought should be given to the C user
macro. The simplest is a small change to the ISR macro:

#define ISR(name, ...) \
    void name(void) __attribute__ ((signal(__VA_ARGS__), __INTR_ATTRS)); \
    void name(void)

However without the interrupt number the name must be from the respective
ioxx.h file or the jump link fails, so there is a potential for confusion.
Might I suggest a new macro:

#define ISRN(name, number) \
    void name(void) __attribute__ ((signal(number), __INTR_ATTRS)); \
    void name(void)

For C++ users the method definition can sometimes be in the header and the
implementation elsewhere (in the cpp file), so the second line above is not
needed. Perhaps the macro:

#define CLASS_ISR(name, number) \
    void name(void) __attribute__ ((signal(number), __INTR_ATTRS));

Ron







reply via email to

[Prev in Thread] Current Thread [Next in Thread]