|
M5Utility 0.2.0 git rev:301a6b5
|
Build-environment detection shared by the sources that need a time source or <chrono> More...
Go to the source code of this file.
Macros | |
| #define | M5UTILITY_TIME_SOURCE_ESP 1 |
| esp_timer + FreeRTOS (ESP-IDF and Arduino-ESP32) | |
| #define | M5UTILITY_TIME_SOURCE_ARDUINO 2 |
| Arduino API millis()/micros()/delay() | |
| #define | M5UTILITY_TIME_SOURCE_CHRONO 3 |
| hosted C++ <chrono> + <thread> | |
| #define | M5UTILITY_TIME_SOURCE M5UTILITY_TIME_SOURCE_CHRONO |
| Which API backs m5::utility::millis()/micros()/delay()/delayMicroseconds() and the no-<chrono> log timestamp. Predefine to one of the values above to override the auto-detection. | |
| #define | M5UTILITY_HAS_USABLE_CHRONO 1 |
| Whether the logging path may use <chrono> (elapsed_time_t and the log timestamp clock in log/library_log.*, the only consumers). Predefine (0/1) to override. | |
Build-environment detection shared by the sources that need a time source or <chrono>
Detection policy, kept in one place so supporting a new environment takes one change here (or a build-flag override) instead of edits scattered across sources:
| #define M5UTILITY_HAS_USABLE_CHRONO 1 |
Whether the logging path may use <chrono> (elapsed_time_t and the log timestamp clock in log/library_log.*, the only consumers). Predefine (0/1) to override.
Scope note: this flag alone does not make the whole library <chrono>-free — with M5UTILITY_TIME_SOURCE_CHRONO the time source itself still requires <chrono>/<thread> (compatibility_feature.cpp). An environment whose <chrono> is unusable needs a non-chrono M5UTILITY_TIME_SOURCE as well; the auto-detection already pairs the two (non-ESP Arduino cores get TIME_SOURCE_ARDUINO + HAS_USABLE_CHRONO=0).
Why not __has_include(<chrono>): on some non-ESP32 Arduino cores the header exists but Arduino.h's abs()/round() function-like macros corrupt <chrono>'s own internal use of those names (empirically confirmed on the officially-registered PlatformIO atmelsam / raspberrypi(mbed) platforms, GCC 9.x libstdc++).