FastLED 3.9.12
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 "fl/namespace.h"
5
18
19
20
21// This block is used for Doxygen documentation generation,
22// so that the Doxygen parser will be able to find the macros
23// included without a defined platform
24#ifdef FASTLED_DOXYGEN
25#define FASTLED_USE_PROGMEM 1
26#endif
27
32
33
34#if (FASTLED_USE_PROGMEM == 1) || defined(FASTLED_DOXYGEN)
35#ifndef FASTLED_INCLUDE_PGMSPACE
36#define FASTLED_INCLUDE_PGMSPACE 1
37#endif
38
39#if FASTLED_INCLUDE_PGMSPACE == 1
40#include <avr/pgmspace.h>
41#endif
42
44#define FL_PROGMEM PROGMEM
45
55
57#define FL_PGM_READ_BYTE_NEAR(x) (pgm_read_byte_near(x))
59#define FL_PGM_READ_WORD_NEAR(x) (pgm_read_word_near(x))
61#define FL_PGM_READ_DWORD_NEAR(x) (pgm_read_dword_near(x))
62
64
65// Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734
66#if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6))
67#ifdef FASTLED_AVR
68#ifdef PROGMEM
69#undef PROGMEM
70#define PROGMEM __attribute__((section(".progmem.data")))
71#endif
72#endif
73#endif
74
75#else
76// If FASTLED_USE_PROGMEM is 0 or undefined,
77// we'll use regular memory (RAM) access.
78
79//empty PROGMEM simulation
80#define FL_PROGMEM
81#define FL_PGM_READ_BYTE_NEAR(x) (*((const uint8_t*)(x)))
82#define FL_PGM_READ_WORD_NEAR(x) (*((const uint16_t*)(x)))
83#define FL_PGM_READ_DWORD_NEAR(x) (*((const uint32_t*)(x)))
84
85#endif
86
96
97#if defined(FASTLED_ARM) || defined(ESP32) || defined(ESP8266) || defined(FASTLED_DOXYGEN)
98#define FL_ALIGN_PROGMEM __attribute__ ((aligned (4)))
99#else
100#define FL_ALIGN_PROGMEM
101#endif
102
103#endif
Implements the FastLED namespace macros.