12#if defined(__AVR_ATtinyxy4__)
14const uint8_t kMatrixWidth = 8;
15const uint8_t kMatrixHeight = 8;
17const uint8_t kMatrixWidth = 16;
18const uint8_t kMatrixHeight = 16;
21#define MAX_DIMENSION ((kMatrixWidth>kMatrixHeight) ? kMatrixWidth : kMatrixHeight)
22#define NUM_LEDS (kMatrixWidth * kMatrixHeight)
25const bool kMatrixSerpentineLayout =
true;
28uint16_t XY( uint8_t x, uint8_t y)
32 if( kMatrixSerpentineLayout ==
false) {
33 i = (y * kMatrixWidth) + x;
36 if( kMatrixSerpentineLayout ==
true) {
39 uint8_t reverseX = (kMatrixWidth - 1) - x;
40 i = (y * kMatrixWidth) + reverseX;
43 i = (y * kMatrixWidth) + x;
51CRGB leds[kMatrixWidth * kMatrixHeight];
77uint16_t noise[MAX_DIMENSION][MAX_DIMENSION];
95 for(
int i = 0; i < MAX_DIMENSION; i++) {
96 int ioffset = scale * i;
97 for(
int j = 0; j < MAX_DIMENSION; j++) {
98 int joffset = scale * j;
99 noise[i][j] =
inoise8(x + ioffset,y + joffset,z);
107 static uint8_t ihue=0;
109 for(
int i = 0; i < kMatrixWidth; i++) {
110 for(
int j = 0; j < kMatrixHeight; j++) {
114 leds[XY(i,j)] =
CHSV(noise[j][i],255,noise[i][j]);
CFastLED FastLED
Global LED strip management instance.
central include file for FastLED, defines the CFastLED class/object
void setBrightness(uint8_t scale)
Set the global brightness scaling.
void show(uint8_t scale)
Update all our controllers with the current led colors, using the passed in brightness.
static CLEDController & addLeds(CLEDController *pLed, struct CRGB *data, int nLedsOrOffset, int nLedsIfOffset=0)
Add a CLEDController instance to the world.
@ RGB
Red, Green, Blue (0012)
uint8_t inoise8(uint16_t x, uint16_t y, uint16_t z)
8-Bit, fixed point implementation of Perlin's noise.
LIB8STATIC uint16_t random16()
Generate a 16-bit random number.
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Representation of an RGB pixel (Red, Green, Blue)