简体   繁体   English

Arduino平台编译器标志

[英]Arduino platform compiler flag

Is there's any compiler flag to indicate the platform? 是否有任何编译器标志指示平台? eg: 例如:

#ifdef ARDUINO_UNO
....//code for uno
#elif ARDUINO_NANO
...//code for nano
#else
error("unknown platform");
#endif

In Arduino.h file, you can find the following preprocessor checks: 在Arduino.h文件中,您可以找到以下预处理程序检查:

#if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
...
#else  
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644A__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__)
...
#endif

I never tried these, but do not I see why you will not be able to use them in your code as well. 我从未尝试过这些,但是我不明白为什么您也将无法在代码中使用它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM