Moved the macros into avrpins instead, as we need to redefine pgm_read_ptr as well

This commit is contained in:
Kristian Sloth Lauszus 2019-04-14 23:47:18 +02:00
parent b3fa5718d5
commit db33d38c44
2 changed files with 20 additions and 10 deletions

View file

@ -1395,6 +1395,26 @@ public: \
#if defined(ESP8266) #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<const void* const*>(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 // Pinout for ESP-12 module
// 0 .. 16 - Digital pins // 0 .. 16 - Digital pins
// GPIO 6 to 11 and 16 are not usable in this library. // GPIO 6 to 11 and 16 are not usable in this library.

View file

@ -157,16 +157,6 @@ e-mail : support@circuitsathome.com
#define fprintf_P(s, ...) ((s), __VA_ARGS__) #define fprintf_P(s, ...) ((s), __VA_ARGS__)
#endif #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<const void* const*>(addr))
#else
#define pgm_read_ptr_aligned(addr) (*(const void* const*)(addr))
#endif
#endif
#ifndef pgm_read_byte #ifndef pgm_read_byte
#define pgm_read_byte(addr) (*(const unsigned char *)(addr)) #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
#endif #endif