From 572d88c1c4762526fbac09c3bc40d0381fccec47 Mon Sep 17 00:00:00 2001 From: Harrison Mclean Date: Tue, 21 Jul 2015 00:37:16 +0800 Subject: [PATCH] Re-added lost function memcpy_P This was lost in https://github.com/esp8266/Arduino/commit/80a5f29e89ebb48d2414edd75e1847c3f47798e4 I've also changed the type of src to PGM_VOID_P to match the other changes made in the above commit. --- cores/esp8266/pgmspace.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cores/esp8266/pgmspace.cpp b/cores/esp8266/pgmspace.cpp index 93bf15ded..7f03de402 100644 --- a/cores/esp8266/pgmspace.cpp +++ b/cores/esp8266/pgmspace.cpp @@ -26,6 +26,18 @@ size_t strnlen_P(PGM_P s, size_t size) { return (size_t) (cp - s); } +void* memcpy_P(void* dest, PGM_VOID_P src, size_t count) { + const uint8_t* read = reinterpret_cast(src); + uint8_t* write = reinterpret_cast(dest); + + while (count) + { + *write++ = pgm_read_byte(read++); + count--; + } + + return dest; +} int memcmp_P(const void* buf1, PGM_VOID_P buf2P, size_t size) { int result = 0;