[Top][All Lists]

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

[avr-libc-dev] Re: Bit number/mask, Part 3000

From: Steve Franks
Subject: [avr-libc-dev] Re: Bit number/mask, Part 3000
Date: Mon, 10 Apr 2006 14:15:23 -0700

I, for one, would certainly like to see the script which turns the official
Atmel xml datasheets into headers (least I recall hearing that to be the
case from this  forum at some point) parse them such that any time a #define
with a XXXXX1 in it was found, that both the XXXXX and XXXXX0 defines would
be included for all parts.  Suppose one could also cook up a macro to do it
as well if one was smart enough.  Off course, this would no doubt require
some 'global' knowledge across parts.  Not being one to complain about the
cooking without picking up a frying pan, I'd be willing to take a stab at it
if someone more senior pointed me in the right direction.

A related rhetorical question:

Why do half the avr's use MCUCR<<2 for the pull-up disable, and the others
SFIOR<<4?  I think that's the single least portable across devices aspect of
the whole avr family.  I've also confused MCUCR & MCUCSR about 1000 times,
but now I risk outright childish complaining ;)

Currently I have solved this by having all my implementations (thanks, Vic,
by the way [he does more than just flame ;)]) take a template class which
implements something like
    class AtMega162_pud { void pullupdisable(bool pud) { SFIOR<<2 = pud; }
I then say
    template class doessomething_with_avr { .....pullupdisable(true);.....};

and then
    doessomething_with_avr cpu<AtMega162_pud>;

So I can swap parts w/o too much headache (just have a set of template
classes for each avr), and the compiler does all the work, so no performance
hit.  Makes a good lightweight 'driver' framework.  <commercial> Look for it
in my upcoming set of CC2420 "Industrial ZigBee developer boards".


Steve Franks, KE7BTE
Staff Engineer
Franks Development, LLC
(520) 312-0089

reply via email to

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