FastLED 3.9.15
Loading...
Searching...
No Matches
fastled_progmem.h
Go to the documentation of this file.
1#pragma once
2
3#if defined(__EMSCRIPTEN__) || defined(FASTLED_TESTING) || defined(FASTLED_STUB_IMPL)
4#include "platforms/null_progmem.h"
5#else
6
7
8#include "fl/namespace.h"
9
22
23
24
25// This block is used for Doxygen documentation generation,
26// so that the Doxygen parser will be able to find the macros
27// included without a defined platform
28#ifdef FASTLED_DOXYGEN
29#define FASTLED_USE_PROGMEM 1
30#endif
31
36
37
38#if (FASTLED_USE_PROGMEM == 1) || defined(FASTLED_DOXYGEN)
39#ifndef FASTLED_INCLUDE_PGMSPACE
40#define FASTLED_INCLUDE_PGMSPACE 1
41#endif
42
43#if FASTLED_INCLUDE_PGMSPACE == 1
44#include <avr/pgmspace.h>
45#endif
46
48#define FL_PROGMEM PROGMEM
49
59
61#define FL_PGM_READ_BYTE_NEAR(x) (pgm_read_byte_near(x))
63#define FL_PGM_READ_WORD_NEAR(x) (pgm_read_word_near(x))
65#define FL_PGM_READ_DWORD_NEAR(x) (pgm_read_dword_near(x))
66
68
69// Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734
70#if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6))
71#ifdef FASTLED_AVR
72#ifdef PROGMEM
73#undef PROGMEM
74#define PROGMEM __attribute__((section(".progmem.data")))
75#endif
76#endif
77#endif
78
79#else
80// If FASTLED_USE_PROGMEM is 0 or undefined,
81// we'll use regular memory (RAM) access.
82
83#include "platforms/null_progmem.h"
84
85#endif
86
96
97#ifndef FL_ALIGN_PROGMEM
98#if defined(FASTLED_ARM) || defined(ESP32) || defined(ESP8266) || defined(FASTLED_DOXYGEN)
99#define FL_ALIGN_PROGMEM __attribute__ ((aligned (4)))
100#else
101#define FL_ALIGN_PROGMEM
102#endif
103#endif
104
105#endif // defined(__EMSCRIPTEN__) || defined(FASTLED_TESTING) || defined(FASTLED_STUB_IMPL)
Implements the FastLED namespace macros.