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

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

Re: [avr-gcc-list] avr-g++ and interrupt vectors


From: Sander Pool
Subject: Re: [avr-gcc-list] avr-g++ and interrupt vectors
Date: Fri, 5 Jul 2002 11:14:30 -0700

Nils,

to call a method you first need an object. Interrupts have no idea what a
valid object would be to call your method. So to make this work your
Interrupt routine would at least have to be declared Static which would be
very similar to a regular C function. To then move processing to an object
you'd need to retrieve the reference from somewhere.

Are you sure you are familiar enough with both C++ and embedded systems to
try this? I love C++ but it seems overkill for most AVR scale embedded
systems.

Good luck,

    Sander

----- Original Message -----
From: "Nils Kristian Strom" <address@hidden>
To: "AVR-GCC List" <address@hidden>
Sent: Friday, July 05, 2002 9:59 AM
Subject: [avr-gcc-list] avr-g++ and interrupt vectors


> Hi!
>
> I am experimenting with C++ on the AVR, trying to implement a simple
> class for a timer.  I ran into a problem when trying to declare the ISR
> as part of the class.
>
> In plain old C, my ISR looks like this:
>
> SIGNAL( SIG_OVERFLOW1 )
> {
> timer_count++;
> }
>
> In my C++ implementation what must I use ?
>
> I would expect something like
>
> SIGNAL( SIG_OVERFLOW1 )  // <- Make vector jump to Timer::Interrupt
> Timer::Interrupt()
> {
> count++;
> }
>
> The main issue is that Timer::Interrupt() should be a private member
> function of Timer.  If not, I could use the plain C alternative and make
> Timer::count public, however, this is not what I want.
>
>
> Regards,
>   Nils
>
>
> avr-gcc-list at http://avr1.org
>

avr-gcc-list at http://avr1.org



reply via email to

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