Skip to content

Commit b3fa571

Browse files
committed
Fixed pgm_read_ptr_aligned macro for the ESP8266 platform
See: esp8266/Arduino#5735
1 parent 0ecc486 commit b3fa571

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

version_helper.h

+10
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,16 @@ e-mail : [email protected]
157157
#define fprintf_P(s, ...) ((s), __VA_ARGS__)
158158
#endif
159159

160+
#ifdef ESP8266
161+
// Workaround the following issue: https://github.com/esp8266/Arduino/pull/5735
162+
#undef pgm_read_ptr_aligned
163+
#ifdef __cplusplus
164+
#define pgm_read_ptr_aligned(addr) (*reinterpret_cast<const void* const*>(addr))
165+
#else
166+
#define pgm_read_ptr_aligned(addr) (*(const void* const*)(addr))
167+
#endif
168+
#endif
169+
160170
#ifndef pgm_read_byte
161171
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
162172
#endif

0 commit comments

Comments
 (0)