From db33d38c441444caf3563a09cf1b1742f2144f19 Mon Sep 17 00:00:00 2001 From: Kristian Sloth Lauszus Date: Sun, 14 Apr 2019 23:47:18 +0200 Subject: [PATCH] Moved the macros into avrpins instead, as we need to redefine pgm_read_ptr as well --- avrpins.h | 20 ++++++++++++++++++++ version_helper.h | 10 ---------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/avrpins.h b/avrpins.h index f55c708b..d5c7c4aa 100644 --- a/avrpins.h +++ b/avrpins.h @@ -1395,6 +1395,26 @@ public: \ #if defined(ESP8266) +// Workaround the following issue: https://github.com/esp8266/Arduino/pull/5735 +#undef pgm_read_ptr_aligned +#ifdef __cplusplus +#define pgm_read_ptr_aligned(addr) (*reinterpret_cast(addr)) +#else +#define pgm_read_ptr_aligned(addr) (*(const void* const*)(addr)) +#endif + +#undef pgm_read_ptr +#if PGM_READ_UNALIGNED +#define pgm_read_ptr(p) pgm_read_ptr_unaligned(p) +#else +#define pgm_read_ptr(p) pgm_read_ptr_aligned(p) +#endif + +#ifdef pgm_read_pointer +#undef pgm_read_pointer +#endif +#define pgm_read_pointer(p) pgm_read_ptr(p) + // Pinout for ESP-12 module // 0 .. 16 - Digital pins // GPIO 6 to 11 and 16 are not usable in this library. diff --git a/version_helper.h b/version_helper.h index cfc99cf3..ab7bb0ca 100644 --- a/version_helper.h +++ b/version_helper.h @@ -157,16 +157,6 @@ e-mail : support@circuitsathome.com #define fprintf_P(s, ...) ((s), __VA_ARGS__) #endif -#ifdef ESP8266 -// Workaround the following issue: https://github.com/esp8266/Arduino/pull/5735 -#undef pgm_read_ptr_aligned -#ifdef __cplusplus -#define pgm_read_ptr_aligned(addr) (*reinterpret_cast(addr)) -#else -#define pgm_read_ptr_aligned(addr) (*(const void* const*)(addr)) -#endif -#endif - #ifndef pgm_read_byte #define pgm_read_byte(addr) (*(const unsigned char *)(addr)) #endif