23 return reinterpret_cast<T *
>(ptr);
69 void *ptr = malloc(
sizeof(T) * n);
73 memset(ptr, 0,
sizeof(T) * n);
74 return static_cast<T*
>(ptr);
86 template <
typename U,
typename... Args>
110 template <
typename U>
119 template <
typename U>
137 template <
typename U,
typename... Args>
143 template <
typename U>
152#define FL_USE_PSRAM_ALLOCATOR(TYPE) \
154class allocator<TYPE> { \
156 using value_type = TYPE; \
157 using pointer = TYPE*; \
158 using const_pointer = const TYPE*; \
159 using reference = TYPE&; \
160 using const_reference = const TYPE&; \
161 using size_type = size_t; \
162 using difference_type = ptrdiff_t; \
164 template <typename U> \
166 using other = allocator<U>; \
169 allocator() noexcept {} \
171 template <typename U> \
172 allocator(const allocator<U>&) noexcept {} \
174 ~allocator() noexcept {} \
176 TYPE *allocate(size_t n) { \
177 return reinterpret_cast<TYPE *>(PSRamAllocate(sizeof(TYPE) * n, true)); \
179 void deallocate(TYPE *p, size_t n) { \
180 if (p == nullptr) { \
183 PSRamDeallocate(p); \
186 template <typename U, typename... Args> \
187 void construct(U* p, Args&&... args) { \
188 new(static_cast<void*>(p)) U(fl::forward<Args>(args)...); \
191 template <typename U> \
192 void destroy(U* p) { \
static T * Alloc(size_t n)
ptrdiff_t difference_type
void deallocate(T *p, size_t n)
void construct(U *p, Args &&... args)
allocator_psram(const allocator_psram< U > &) noexcept
const T & const_reference
allocator_psram() noexcept
~allocator_psram() noexcept
allocator_psram< U > other
void deallocate(T *p, size_t n)
ptrdiff_t difference_type
void construct(U *p, Args &&... args)
allocator(const allocator< U > &) noexcept
const T & const_reference
void SetPSRamAllocator(void *(*alloc)(size_t), void(*free)(void *))
void * PSRamAllocate(size_t size, bool zero)
void PSRamDeallocate(void *ptr)
constexpr T && forward(typename remove_reference< T >::type &t) noexcept
Implements a simple red square effect for 2D LED grids.
static FASTLED_NAMESPACE_BEGIN uint8_t const p[]
#define FASTLED_UNUSED(x)