Pages: [1]   Go Down
Author Topic: Board type #define  (Read 1031 times)
0 Members and 1 Guest are viewing this topic.
USA
Offline Offline
Full Member
***
Karma: 2
Posts: 213
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would like to see the core files include a #DEFINE <board_type>

For example

#define   __BOARD_Duemilanove_

or

#define  __BOARD_MEGA__

or

#define __BOARD_SANQUINO__


The reason for this is I currently take advantage of the CPU defs such as __AVR_ATmega1280__ for the mega, but it is not always the case.
There are many different boards utilizing the same processor and it can get difficult to get programs working on multiple boards correctly.

Any comments?

Mark


p.s. I propose putting this define in pins_arduino.h since the pin numbering is the place where this is most likely to have a difference
« Last Edit: April 02, 2010, 08:43:54 am by msproul » Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 200
Posts: 12779
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Great idea.  I have some suggestions...

#define   __BOARD_Duemilanove_
#define  __BOARD_MEGA__

The vendor name should be included in the #define to avoid conflicts...

#define __BOARD_ARDUINO_DUEMILANOVE__
#define __BOARD_ARDUIN0_MEGA__
#define __BOARD_ADAFRUIT_BOARDUINO__

There are a few cases where knowing the revision of the board would be handy.  I suggest setting the #define to the board revision level...

#define __BOARD_ARDUINO_DUEMILANOVE__   1
#define __BOARD_ARDUINO_MEGA__   1
#define __BOARD_ADAFRUIT_BOARDUINO__   1

Quote
I propose putting this define in pins_arduino.h since the pin numbering is the place where this is most likely to have a difference
These should be taken from boards.txt and passed to the compiler by the IDE.
« Last Edit: April 02, 2010, 12:53:53 pm by bcook » Logged

UK
Offline Offline
God Member
*****
Karma: 0
Posts: 710
Arduino is Genius
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
There are many different boards utilizing the same processor and it can get difficult to get programs working on multiple boards correctly.

My impression is the majority of problems are caused by the different resources and capabilities of the MCU.
This includes the problem of 32pin vs 28pin package variant of the chip, which have different capabilities.

The next one is the different pin numbers that are used by the board designer, esp. folks making Nano-style boards.

Are their other common problems?

GB-)
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 200
Posts: 12779
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Which pin has the on-board LED.
Logged

Pages: [1]   Go Up
Jump to: