void PixelTask ( void * pvParameters ) { int16_t i; WS2812_init ( LED_COUNT ); while ( 1 ) { for (i = 0; i < 763; i += LED_COUNT) { WS2812_send(&eightbit[i], LED_COUNT); vTaskDelay ( 30 / portTICK_RATE_MS ); }; uint8_t colors[LED_COUNT][3]; for ( i = 0; i < 128; i++ ) { uint8_t j = 0; for ( j = 0; j < LED_COUNT; j++ ) { colors[j][0] = 255 - i * 2; colors[j][1] = 0; colors[j][2] = 0; }; WS2812_send(&colors[0], LED_COUNT); vTaskDelay ( 10 / portTICK_RATE_MS ); }; for ( i = 0; i < 128; i++ ) { uint8_t j = 0; for ( j = 0; j < LED_COUNT; j++ ) { colors[j][0] = i * 2; colors[j][1] = i * 2; colors[j][2] = i * 2; }; WS2812_send(&colors[0], LED_COUNT); vTaskDelay ( 10 / portTICK_RATE_MS ); }; for ( i = 0; i < 128; i++ ) { uint8_t j = 0; for ( j = 0; j < LED_COUNT; j++ ) { colors[j][0] = 255; colors[j][1] = 255 - i * 2; colors[j][2] = 255 - i * 2; }; WS2812_send(&colors[0], LED_COUNT ); vTaskDelay ( 10 / portTICK_RATE_MS ); }; }; };
void updateVisualization(uint16_t hours, uint16_t minutes, uint16_t seconds, uint16_t posInSecond){ uint32_t aniSteps = RATE_MIN; uint32_t clk = seconds * UPDATE_RATE_SEC + posInSecond; // Sekundenanimation ANIM_LED_t secondAnimation; calcLED(aniSteps, clk, &secondAnimation); // Minuten-Darstellung ANIM_LED_t minutesAnimation; aniSteps = RATE_MIN * 60; //clk = minutes * RATE_MIN + seconds * UPDATE_RATE_SEC + posInSecond; clk = minutes * RATE_MIN + clk; calcLED(aniSteps, clk, &minutesAnimation); // Stundenanimation ANIM_LED_t hoursAnimation; #if TWENTYFOURMOD aniSteps = RATE_MIN * 60 * 24; // 12 hours display clk = (hours % 24) * RATE_MIN * 60 + clk; #else aniSteps = RATE_MIN * 60 * 12; // 12 hours display clk = (hours % 12) * RATE_MIN * 60 + clk; #endif calcLED(aniSteps, clk, &hoursAnimation); // now set output to nothing ;) for(uint32_t i = 0; i < LED; i++){ hsvStripe[i].s = SATURATION; hsvStripe[i].h = 0; hsvStripe[i].v = 0; } // merge colors mergeColors(&hoursAnimation, &minutesAnimation, &secondAnimation); // now convert to rgb value for(uint32_t i = 0; i < LED; i++){ rgbStripe[i] = convertHSV2RGB(&hsvStripe[i]); } // no draw the f**k hahahahahaha WS2812_send(rgbStripe, LED); }