summaryrefslogtreecommitdiff
path: root/include/lib/ArduinoJson/Polyfills/static_array.hpp
blob: a877b4caa83772b3e663cb22f9e3dc5c6cee3df4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// ArduinoJson - https://arduinojson.org
// Copyright Benoit Blanchon 2014-2021
// 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