FastLED 3.9.15
Loading...
Searching...
No Matches
fastled_progmem.h
Go to the documentation of this file.
1#pragma once
2
3
4#include "fl/namespace.h"
5
6#if defined(__EMSCRIPTEN__) || defined(FASTLED_TESTING) || defined(FASTLED_STUB_IMPL)
7#include "platforms/null_progmem.h"
8#elif defined(ESP8266)
9#include "platforms/esp/8266/progmem_esp8266.h"
10#else
11
12
13
14
27
28
29
30// This block is used for Doxygen documentation generation,
31// so that the Doxygen parser will be able to find the macros
32// included without a defined platform
33#ifdef FASTLED_DOXYGEN
34#define FASTLED_USE_PROGMEM 1
35#endif
36
41
42
43#if (FASTLED_USE_PROGMEM == 1) || defined(FASTLED_DOXYGEN)
44#ifndef FASTLED_INCLUDE_PGMSPACE
45#define FASTLED_INCLUDE_PGMSPACE 1
46#endif
47
48#if FASTLED_INCLUDE_PGMSPACE == 1
49#include <avr/pgmspace.h>
50#endif
51
53#define FL_PROGMEM PROGMEM
54
55
65
67#define FL_PGM_READ_BYTE_NEAR(x) (pgm_read_byte_near(x))
69#define FL_PGM_READ_WORD_NEAR(x) (pgm_read_word_near(x))
71#define FL_PGM_READ_DWORD_NEAR(x) (pgm_read_dword_near(x))
72
74
75// Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734
76#if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6))
77#ifdef FASTLED_AVR
78#ifdef PROGMEM
79#undef PROGMEM
80#define PROGMEM __attribute__((section(".progmem.data")))
81#endif
82#endif
83#endif
84
85#else
86// If FASTLED_USE_PROGMEM is 0 or undefined,
87// we'll use regular memory (RAM) access.
88
89#include "platforms/null_progmem.h"
90
91#endif
92
102
103#ifndef FL_ALIGN_PROGMEM
104#if defined(FASTLED_ARM) || defined(ESP32) || defined(FASTLED_DOXYGEN)
105#define FL_ALIGN_PROGMEM __attribute__ ((aligned (4)))
106#else
107#define FL_ALIGN_PROGMEM
108#endif
109#endif
110
111#endif // defined(__EMSCRIPTEN__) || defined(FASTLED_TESTING) || defined(FASTLED_STUB_IMPL)
Implements the FastLED namespace macros.