mirror of
https://github.com/ETLCPP/etl.git
synced 2026-10-28 18:07:10 +08:00
mutex_freertos.h unconditionally included the vanilla FreeRTOS header layout (FreeRTOS.h and semphr.h at the include root). On ESP-IDF, and therefore Arduino-ESP32 as well since it's built on top of ESP-IDF, these headers are nested one level deeper under freertos/, so the unconditional include fails to compile on any ESP32 target with ETL_TARGET_OS_FREERTOS defined. Use __has_include to try the standard path first, fall back to the ESP-IDF nested path, and fail with a clear #error if neither is found, rather than a mysterious "file not found" from the compiler. Also resolves a pre-existing include-style inconsistency in this file: the old code mixed "FreeRTOS.h" (quotes) with <semphr.h> (angle brackets). All includes now uniformly use angle brackets.
This commit is contained in:
parent
f7520ad0bd
commit
e4fc36d6f2
@ -31,8 +31,26 @@ SOFTWARE.
|
||||
|
||||
#include "../platform.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include <semphr.h>
|
||||
#if defined(__has_include) // Compiler supports __has_include
|
||||
|
||||
#if __has_include(<FreeRTOS.h>) && __has_include(<semphr.h>) // Standard FreeRTOS include layout
|
||||
#include <FreeRTOS.h>
|
||||
#include <semphr.h>
|
||||
|
||||
#elif __has_include(<freertos/FreeRTOS.h>) && __has_include(<freertos/semphr.h>) // ESP-IDF style include layout
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/semphr.h>
|
||||
|
||||
#else // Neither include layout found
|
||||
#error "FreeRTOS.h and semphr.h not found. Please include path to FreeRTOS in your project settings"
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#include <FreeRTOS.h>
|
||||
#include <semphr.h>
|
||||
|
||||
#endif
|
||||
|
||||
namespace etl
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user