FastLED 3.9.3
Loading...
Searching...
No Matches
fastled_progmem.h
Go to the documentation of this file.
1#ifndef __INC_FL_PROGMEM_H
2#define __INC_FL_PROGMEM_H
3
4#include "FastLED.h"
5#include "namespace.h"
6
19
20
21
22// This block is used for Doxygen documentation generation,
23// so that the Doxygen parser will be able to find the macros
24// included without a defined platform
25#ifdef FASTLED_DOXYGEN
26#define FASTLED_USE_PROGMEM 1
27#endif
28
33
34
35#if (FASTLED_USE_PROGMEM == 1) || defined(FASTLED_DOXYGEN)
36#ifndef FASTLED_INCLUDE_PGMSPACE
37#define FASTLED_INCLUDE_PGMSPACE 1
38#endif
39
40#if FASTLED_INCLUDE_PGMSPACE == 1
41#include <avr/pgmspace.h>
42#endif
43
45#define FL_PROGMEM PROGMEM
46
56
58#define FL_PGM_READ_BYTE_NEAR(x) (pgm_read_byte_near(x))
60#define FL_PGM_READ_WORD_NEAR(x) (pgm_read_word_near(x))
62#define FL_PGM_READ_DWORD_NEAR(x) (pgm_read_dword_near(x))
63
65
66// Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734
67#if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6))
68#ifdef FASTLED_AVR
69#ifdef PROGMEM
70#undef PROGMEM
71#define PROGMEM __attribute__((section(".progmem.data")))
72#endif
73#endif
74#endif
75
76#else
77// If FASTLED_USE_PROGMEM is 0 or undefined,
78// we'll use regular memory (RAM) access.
79
80//empty PROGMEM simulation
81#define FL_PROGMEM
82#define FL_PGM_READ_BYTE_NEAR(x) (*((const uint8_t*)(x)))
83#define FL_PGM_READ_WORD_NEAR(x) (*((const uint16_t*)(x)))
84#define FL_PGM_READ_DWORD_NEAR(x) (*((const uint32_t*)(x)))
85
86#endif
87
97
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
104#endif
central include file for FastLED, defines the CFastLED class/object