9 years, 2 months ago.

mbed SDK official #ifdef directive

Hi,

I am porting a library over to mbed, is there an official #ifdef directive for mbed SDK ? which i can use #ifdef to select mbed version of the codes when it compile under mbed.

thank

jhleong

2 Answers

9 years, 2 months ago.

There are a few different ones you can use, but MBED_H should always be there, so I would just use that one.

9 years, 2 months ago.

Hi,

there's MBED_LIBRARY_VERSION , located in the mbed.h file. Can you specify the use case you want to use version macro?

If I understand it correctly he doesn't care about the mbed version, but he for example has code which uses DigitalOut for the mbed version, and DigitalWrite for the arduino version.

posted by Erik - 11 Feb 2015

Yes, Erik got my question correct. I want to use the mbed SPI API in the code together with arduino , raspberry version of the API.

No official direction for mbed ? I suppose MBED_H will work.

posted by JH Leong 11 Feb 2015

__MBED__

is set to 1, when I exported projects in the mbed SDK sources. Therefoer I assume this is also used in the online IDE, or also that mbed revision as I said, it's always defined

posted by Martin Kojtal 16 Feb 2015