From e52ffb0a69264dc5e3a661cb7209b9991f500f0e Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Tue, 20 Dec 2022 16:21:48 +0100 Subject: [PATCH] [STM32WLx] Only build on compatible STM32 boards This checks for some system macros to be set, but also includes the doxygen build to generate documentation. This reuses the RADIOLIB_EXCLUDE_STM32WLX that the code already checks for to prevent having to duplicate this macro check in four places. To detect running inside doxygen, this configures doxygen to predefine a DOXYGEN macro (it seems no such macros are defined by default by doxygen). --- Doxyfile | 3 ++- src/BuildOpt.h | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Doxyfile b/Doxyfile index 3c1d2d18..db6d223b 100644 --- a/Doxyfile +++ b/Doxyfile @@ -2172,7 +2172,8 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = protected=private +PREDEFINED = protected=private \ + DOXYGEN # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/src/BuildOpt.h b/src/BuildOpt.h index 2e2e8835..5e6ca965 100644 --- a/src/BuildOpt.h +++ b/src/BuildOpt.h @@ -1010,6 +1010,13 @@ #define RADIOLIB_STATIC_ARRAY_SIZE (256) #endif + +// This only compiles on STM32 boards with SUBGHZ module, but also +// include when generating docs +#if (!defined(ARDUINO_ARCH_STM32) || !defined(SUBGHZSPI_BASE)) && !defined(DOXYGEN) + #define RADIOLIB_EXCLUDE_STM32WLX +#endif + #if defined(RADIOLIB_DEBUG) #if defined(RADIOLIB_BUILD_ARDUINO) #define RADIOLIB_DEBUG_PRINT(...) { RADIOLIB_DEBUG_PORT.print(__VA_ARGS__); }