Skip to content

Commit 6d32c67

Browse files
committed
Merge pull request esp8266#1170 from jensh/jens/patch-pgmspace-c
Make pgm_read_byte() and pgm_read_word() usable from c.
2 parents ee314f2 + dd89de4 commit 6d32c67

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cores/esp8266/pgmspace.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ int vsnprintf_P(char *str, size_t strSize, PGM_P formatP, va_list ap) __attribut
7878
(__extension__({ \
7979
PGM_P __local = (PGM_P)(addr); /* isolate varible for macro expansion */ \
8080
ptrdiff_t __offset = ((uint32_t)__local & 0x00000003); /* byte aligned mask */ \
81-
const uint32_t* __addr32 = reinterpret_cast<const uint32_t*>(reinterpret_cast<const uint8_t*>(__local)-__offset); \
81+
const uint32_t* __addr32 = (const uint32_t*)((const uint8_t*)(__local)-__offset); \
8282
uint8_t __result = ((*__addr32) >> (__offset * 8)); \
8383
__result; \
8484
}))
@@ -87,7 +87,7 @@ int vsnprintf_P(char *str, size_t strSize, PGM_P formatP, va_list ap) __attribut
8787
(__extension__({ \
8888
PGM_P __local = (PGM_P)(addr); /* isolate varible for macro expansion */ \
8989
ptrdiff_t __offset = ((uint32_t)__local & 0x00000002); /* word aligned mask */ \
90-
const uint32_t* __addr32 = reinterpret_cast<const uint32_t*>(reinterpret_cast<const uint8_t*>(__local) - __offset); \
90+
const uint32_t* __addr32 = (const uint32_t*)((const uint8_t*)(__local) - __offset); \
9191
uint16_t __result = ((*__addr32) >> (__offset * 8)); \
9292
__result; \
9393
}))

0 commit comments

Comments
 (0)