mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-01 16:14:05 +01:00
Moved float tables to PROGMEM
This commit is contained in:
34
src/ArduinoJson/Polyfills/static_array.hpp
Normal file
34
src/ArduinoJson/Polyfills/static_array.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
// ArduinoJson - arduinojson.org
|
||||
// Copyright Benoit Blanchon 2014-2020
|
||||
// MIT License
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ArduinoJson/Configuration.hpp>
|
||||
|
||||
#if ARDUINOJSON_ENABLE_PROGMEM
|
||||
|
||||
#include <ArduinoJson/Polyfills/pgmspace_generic.hpp>
|
||||
|
||||
#ifndef ARDUINOJSON_DEFINE_STATIC_ARRAY
|
||||
#define ARDUINOJSON_DEFINE_STATIC_ARRAY(type, name, value) \
|
||||
static type const name[] PROGMEM = value;
|
||||
#endif
|
||||
|
||||
#ifndef ARDUINOJSON_READ_STATIC_ARRAY
|
||||
#define ARDUINOJSON_READ_STATIC_ARRAY(type, name, index) \
|
||||
pgm_read<type>(name + index)
|
||||
#endif
|
||||
|
||||
#else // i.e. ARDUINOJSON_ENABLE_PROGMEM == 0
|
||||
|
||||
#ifndef ARDUINOJSON_DEFINE_STATIC_ARRAY
|
||||
#define ARDUINOJSON_DEFINE_STATIC_ARRAY(type, name, value) \
|
||||
static type const name[] = value;
|
||||
#endif
|
||||
|
||||
#ifndef ARDUINOJSON_READ_STATIC_ARRAY
|
||||
#define ARDUINOJSON_READ_STATIC_ARRAY(type, name, index) name[index]
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user