Skip to content

Identifying MCU and board variants using preprocessor

SuperUserNameMan edited this page Feb 22, 2021 · 11 revisions

As of 2021-02-22, in release v1.0.6 :

Preprocessor condition expressions to detect a board :

#if defined( __LGT8FX8E__ ) && defined( __LGT8F_SSOP20__ ) || defined( ARDUINO_AVR_LARDU_88DS20 )
#error LGT8F88D-SSOP20 detected
#endif

#if defined( __LGT8FX8E__ ) && ! defined( __LGT8F_SSOP20__ ) && ! defined( ARDUINO_AVR_LARDU_88DS20 )
#error 328D (rare) detected
#endif

#if defined( __LGT8FX8P__ ) && ( LED_BUILTIN != 12 ) && ! defined( __LGT8F_SSOP20__ ) && ! defined( __LGT8FX8P48__ )
#error 328P-LQFP32 (MiniEVB) detected
#endif

#if defined( __LGT8FX8P__ ) && ( LED_BUILTIN == 12 ) && ! defined( __LGT8F_SSOP20__ )
#error 328P-LQFP32 wemos-TTGO-XI detected
#endif

#if defined( __LGT8FX8P48__ )
#error 328P-LQFP48 MiniEVB detected
#endif

#if defined( __LGT8FX8P__ ) && defined( __LGT8F_SSOP20__ )
#error 328P-SSOP20 (e.g. green pseudo pro mini) detected
#endif

List of special definitions for each boards and variants :

boards.txt MCU variant lgt8f/variants/ special #define patterns
* lgt8f* __LGT8F__
* lgt8f*-ssop20 __LGT8F_SSOP20__
* lgt8f*d __LGT8FX8E__
* lgt8f*p __LGT8FX8P__
* lgt8f*d/p ARDUINO_AVR_LARDU_328E
LGT8F88D-SSOP20 lgt8f88d lgt8fx8ds20 ARDUINO_AVR_LARDU_88DS20
328D (rare) lgt8f328d lgt8fx8e __LGT8FX8E__ && ! __LGT8F_SSOP20__
328P-LQFP32 wemos-TTGO-XI lgt8f328p lgt8fx8p-wemos-TTGO-XI __LGT8FX8P__ && LED_BUILTIN==12
328P-LQFP32 (e.g. MiniEVB nano-style and WAVGAT) lgt8f328p lgt8fx8p __LGT8FX8P__ && LED_BUILTIN!=12 && ! __LGT8F_SSOP20__ && ! __LGT8FX8P48__
328P-LQFP48 MiniEVB lgt8f328p lgt8fx8p48 __LGT8FX8P48__
328P-SSOP20 (e.g. green pseudo pro mini) lgt8f328p lgt8fx8ps20 __LGT8FX8P__ && __LGT8F_SSOP20__