FastLED 3.6.0
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
18
19FASTLED_NAMESPACE_BEGIN
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#define FL_ALIGN_PROGMEM __attribute__ ((aligned (4)))
28#endif
29
34
35
36#if FASTLED_USE_PROGMEM == 1
37#ifndef FASTLED_INCLUDE_PGMSPACE
38#define FASTLED_INCLUDE_PGMSPACE 1
39#endif
40
41#if FASTLED_INCLUDE_PGMSPACE == 1
42#include <avr/pgmspace.h>
43#endif
44
46#define FL_PROGMEM PROGMEM
47
57
59#define FL_PGM_READ_BYTE_NEAR(x) (pgm_read_byte_near(x))
61#define FL_PGM_READ_WORD_NEAR(x) (pgm_read_word_near(x))
63#define FL_PGM_READ_DWORD_NEAR(x) (pgm_read_dword_near(x))
64
66
67// Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734
68#if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6))
69#ifdef FASTLED_AVR
70#ifdef PROGMEM
71#undef PROGMEM
72#define PROGMEM __attribute__((section(".progmem.data")))
73#endif
74#endif
75#endif
76
77#else
78// If FASTLED_USE_PROGMEM is 0 or undefined,
79// we'll use regular memory (RAM) access.
80
81//empty PROGMEM simulation
82#define FL_PROGMEM
83#define FL_PGM_READ_BYTE_NEAR(x) (*((const uint8_t*)(x)))
84#define FL_PGM_READ_WORD_NEAR(x) (*((const uint16_t*)(x)))
85#define FL_PGM_READ_DWORD_NEAR(x) (*((const uint32_t*)(x)))
86
87#endif
88
98
99#if defined(FASTLED_ARM) || defined(ESP32) || defined(ESP8266)
100#define FL_ALIGN_PROGMEM __attribute__ ((aligned (4)))
101#else
102#define FL_ALIGN_PROGMEM
103#endif
104
105
106FASTLED_NAMESPACE_END
107
108#endif
central include file for FastLED, defines the CFastLED class/object