Pages: 1 [2]   Go Down
Author Topic: Determine device at build time?  (Read 1396 times)
0 Members and 1 Guest are viewing this topic.
Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 47
Posts: 2927
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Off Topic...
Comment on krupski's tag line...
Quote
Wouldn't it be easier to make assault and murder illegal rather than trying to have a law against every and any type of weapon?
What a concept.. Think We can Sell it? God didn't... "Thou Shalt Not Kill" is present in one form or another in all the mainstream religions... Or So I've Been Told.

Robert Khayyam Johnson Sr.

My deep personal belief is that any references to guns is best left in forums devoted to that purpose, they serve little purpose in this forum. IMNSHO.
« Last Edit: February 17, 2013, 11:54:58 pm by Docedison » Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

SF Bay Area (USA)
Online Online
Tesla Member
***
Karma: 137
Posts: 6789
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Note that current trends in the Arduino core and etc are AWAY from checking for specific cpu types, and toward checking for specific features that you're using instead.
So instead of
Code:
#if defined(__AVR_ATmega1280__)
// m1280 has more timers to initialize
sbi(TCCR3B, CS31); // set timer 3 prescale factor to 64
sbi(TCCR3B, CS30);
sbi(TCCR3A, WGM30); // put timer 3 in 8-bit phase correct pwm mode
sbi(TCCR4B, CS41); // set timer 4 prescale factor to 64
sbi(TCCR4B, CS40);
sbi(TCCR4A, WGM40); // put timer 4 in 8-bit phase correct pw
#endif

One would check whether the individual timers instead:
Code:
#if defined(TCCR3B) && defined(CS31) && defined(WGM30)
sbi(TCCR3B, CS31);
sbi(TCCR3B, CS30);
sbi(TCCR3A, WGM30);
#endif

#if defined(TCCR4B) && defined(CS41) && defined(WGM40)
sbi(TCCR4B, CS41);
sbi(TCCR4B, CS40);
sbi(TCCR4A, WGM40);
#endif
this way, you can compile on essentially similar cpus without having to go and find all the places where the code checks for CPU type.  (m328 vs m328p, or m1280 vs m2560, for instance!)
Code:
#define RAMEND      0x4FF
Exactly!  It's much better to check for having more than a minimum amount of RAM, than to make the size of an array dependent on CPU type.
Some things are documented here: http://www.nongnu.org/avr-libc/user-manual/group__avr__io.html

Logged

Worst state in America
Offline Offline
God Member
*****
Karma: 32
Posts: 808
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Off Topic...
Comment on krupski's tag line...
Quote
Wouldn't it be easier to make assault and murder illegal rather than trying to have a law against every and any type of weapon?
What a concept.. Think We can Sell it? God didn't... "Thou Shalt Not Kill" is present in one form or another in all the mainstream religions... Or So I've Been Told.

Robert Khayyam Johnson Sr.

My deep personal belief is that any references to guns is best left in forums devoted to that purpose, they serve little purpose in this forum. IMNSHO.

Who said anything about guns?
Logged

Gentlemen may prefer Blondes, but Real Men prefer Redheads!

Pages: 1 [2]   Go Up
Jump to: