diff --git a/library.json b/library.json index 05ffaee..918e264 100644 --- a/library.json +++ b/library.json @@ -16,7 +16,7 @@ "url": "https://github.com/ardnew/cronos.git" }, "license": "MIT", - "version": "0.1.5", + "version": "0.1.6", "headers": [ "cronos.hpp" ], diff --git a/library.properties b/library.properties index 21e8b98..24070eb 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=cronos -version=0.1.5 +version=0.1.6 author=ardnew maintainer=ardnew (andrew@ardnew.com) sentence=A std::chrono wrapper for target system's native tick count. diff --git a/src/cronos.hpp b/src/cronos.hpp index afbaae9..e3b8c89 100644 --- a/src/cronos.hpp +++ b/src/cronos.hpp @@ -5,12 +5,18 @@ #include #include +#if defined(ESP_PLATFORM) +#include +#elif defined(ARDUINO) +#include +#endif + namespace native { class ticker { public: #if defined(ESP_PLATFORM) -#include // ESP32 (FreeRTOS) ticks are in microseconds. #define fastcode IRAM_ATTR /* __attribute__((section(".iram1.text"))) */ + // ESP32 (FreeRTOS) ticks are in microseconds. static constexpr auto fastcode count = esp_timer_get_time; using period = std::micro; @@ -18,8 +24,8 @@ class ticker { // It's likely there are many generic platforms that will have ARDUINO // defined. So be sure to check it last (but before the default C++ // implementation). -#include // Arduino ticks are in milliseconds. #define fastcode + // Arduino ticks are in milliseconds. static constexpr auto fastcode count = millis; using period = std::milli;