Go Down

Topic: Board type #define (Read 1 time) previous topic - next topic

Mark S

Apr 02, 2010, 03:17 pm Last Edit: Apr 02, 2010, 03:43 pm by msproul Reason: 1
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

Coding Badly

#1
Apr 02, 2010, 07:50 pm Last Edit: Apr 02, 2010, 07:53 pm by bcook Reason: 1
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.

gbulmer

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-)

Coding Badly


Which pin has the on-board LED.

Go Up