2019-08-11 10:47:19 +02:00
|
|
|
// ArduinoJson - arduinojson.org
|
2020-01-09 15:48:38 +01:00
|
|
|
// Copyright Benoit Blanchon 2014-2020
|
2019-08-11 10:47:19 +02:00
|
|
|
// MIT License
|
|
|
|
|
|
|
|
#include <stdint.h> // uint8_t
|
|
|
|
#include <string.h> // strcmp, strlen...
|
|
|
|
|
|
|
|
class __FlashStringHelper;
|
|
|
|
|
|
|
|
inline const void* convertPtrToFlash(const void* s) {
|
|
|
|
return reinterpret_cast<const char*>(s) + 42;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline const void* convertFlashToPtr(const void* s) {
|
|
|
|
return reinterpret_cast<const char*>(s) - 42;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define F(X) reinterpret_cast<const __FlashStringHelper*>(convertPtrToFlash(X))
|
2019-08-21 09:31:53 +02:00
|
|
|
#define FC(X) reinterpret_cast<const char*>(convertPtrToFlash(X))
|
2019-08-11 10:47:19 +02:00
|
|
|
|
2019-08-21 09:31:53 +02:00
|
|
|
inline uint8_t pgm_read_byte(const void* p) {
|
2019-08-11 10:47:19 +02:00
|
|
|
return *reinterpret_cast<const uint8_t*>(convertFlashToPtr(p));
|
|
|
|
}
|