#pragma once #include #include "ws2812b.h" #define DEFINE_PATTERN \ __attribute__((__section__( \ ".patterns"))) volatile static pattern_t __FILE__ = typedef struct { /* Name of the pattern. */ const char* name; /* Return the rgb for the pixel at the given offset 'x' and time 't' */ rgb_t (*get_rgb)(uint32_t t, size_t x); /* Resets the pattern to the beginning. */ void (*reset)(void); } pattern_t; extern pattern_t PATTERNS_START; extern pattern_t PATTERNS_END; #define patterns (&PATTERNS_START) #define n_patterns (&PATTERNS_END - &PATTERNS_START)