[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] (Fwd) WinAVR 20030424
From: |
E. Weddington |
Subject: |
Re: [avr-libc-dev] (Fwd) WinAVR 20030424 |
Date: |
Mon, 05 May 2003 11:35:57 -0600 |
On 5 May 2003 at 9:46, Theodore A. Roth wrote:
>
>
> On Mon, 5 May 2003, E. Weddington wrote:
>
> :) > > {
> :) > > #if defined(EIMSK)
> :) > > EIMSK = ints;
> :) > > #elif defined(GIMSK)
> :) > > GIMSK = ints;
> :) > > #elif defined(GICR)
> :) > > GICR = ints;
> :) > > #else
> :) > > # error "No valid external interrupt control register defined."
> :) > > #endif :) > > }
>
> <snip>
>
> :) But in the meanwhile, as a stopgap, can we change the #error to :)
> #warning? Or just drop that branch and let it compile to nothing; :)
> it's harmless if those registers aren't defined.
>
> It's an error since the header isn't handling something correctly.
>
> Doing nothing is wrong. The user expects something to happen when they
> use the interface and silently doing nothing breaks their program. I
> made it an #error to help flush out unhandled cases (and it seems to
> have worked).
>
Do you have an alternative?
Since there's no external interrupt control register defined for the
part, the function is meaningless.
We could just make it unavailable such as:
#ifndef _AVR_IO86RF401_H_
extern inline void enable_external_int (unsigned char ints)
{
#if defined(EIMSK)
EIMSK = ints;
#elif defined(GIMSK)
GIMSK = ints;
#elif defined(GICR)
GICR = ints;
#else
# error "No valid external interrupt control register defined."
#endif
}
#endif
Or, (shudder), yet another AVR architecture class to handle these
oddball application-specific + AVR parts and conditionally compile on
the architecture.
Eric