FastLED 3.6.0
Loading...
Searching...
No Matches
fastled_progmem.h File Reference

Detailed Description

Wrapper definitions to allow seamless use of PROGMEM in environments that have it.

This is a compatibility layer for devices that do or don't have "PROGMEM" and the associated pgm_ accessors.

If a platform supports PROGMEM, it should define FASTLED_USE_PROGMEM as 1, otherwise FastLED will fall back to NOT using PROGMEM.

Whether or not pgmspace.h is #included is separately controllable by FASTLED_INCLUDE_PGMSPACE, if needed.

Definition in file fastled_progmem.h.

#include "FastLED.h"

Go to the source code of this file.

Macros

#define FASTLED_USE_PROGMEM   1
 Determine whether the current platform supports PROGMEM.
 
#define FL_ALIGN_PROGMEM   __attribute__ ((aligned (4)))
 Helps to force 4-byte alignment for platforms with unaligned access.
 
#define FL_PROGMEM
 
#define FL_PGM_READ_BYTE_NEAR(x)   (*((const uint8_t*)(x)))
 
#define FL_PGM_READ_WORD_NEAR(x)   (*((const uint16_t*)(x)))
 
#define FL_PGM_READ_DWORD_NEAR(x)   (*((const uint32_t*)(x)))
 
#define FL_ALIGN_PROGMEM
 Helps to force 4-byte alignment for platforms with unaligned access.
 

Macro Definition Documentation

◆ FASTLED_USE_PROGMEM

#define FASTLED_USE_PROGMEM   1

Determine whether the current platform supports PROGMEM.

If FASTLED_USE_PROGMEM is 1, we'll map FL_PROGMEM and the FL_PGM_* accessors to the Arduino equivalents.

Definition at line 26 of file fastled_progmem.h.

◆ FL_ALIGN_PROGMEM [1/2]

#define FL_ALIGN_PROGMEM   __attribute__ ((aligned (4)))

Helps to force 4-byte alignment for platforms with unaligned access.

On some platforms, most notably ARM M0, unaligned access to 'PROGMEM' for multibyte values (e.g. read dword) is not allowed and causes a crash. This macro can help force 4-byte alignment as needed. The FastLED gradient palette code uses 'read dword', and now uses this macro to make sure that gradient palettes are 4-byte aligned.

Definition at line 27 of file fastled_progmem.h.

◆ FL_ALIGN_PROGMEM [2/2]

#define FL_ALIGN_PROGMEM

Helps to force 4-byte alignment for platforms with unaligned access.

On some platforms, most notably ARM M0, unaligned access to 'PROGMEM' for multibyte values (e.g. read dword) is not allowed and causes a crash. This macro can help force 4-byte alignment as needed. The FastLED gradient palette code uses 'read dword', and now uses this macro to make sure that gradient palettes are 4-byte aligned.

Definition at line 27 of file fastled_progmem.h.

◆ FL_PGM_READ_BYTE_NEAR

#define FL_PGM_READ_BYTE_NEAR (   x)    (*((const uint8_t*)(x)))

Definition at line 83 of file fastled_progmem.h.

◆ FL_PGM_READ_DWORD_NEAR

#define FL_PGM_READ_DWORD_NEAR (   x)    (*((const uint32_t*)(x)))

Definition at line 85 of file fastled_progmem.h.

◆ FL_PGM_READ_WORD_NEAR

#define FL_PGM_READ_WORD_NEAR (   x)    (*((const uint16_t*)(x)))

Definition at line 84 of file fastled_progmem.h.

◆ FL_PROGMEM

#define FL_PROGMEM

Definition at line 82 of file fastled_progmem.h.