Added support for RGBW NeoPixels (#449)
This commit is contained in:
parent
68cc1451b2
commit
e24b6579ff
3 changed files with 32 additions and 12 deletions
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "ws2812_i2s/ws2812_i2s.h"
|
||||
|
||||
const uint32_t led_number = 60;
|
||||
const uint32_t led_number = 12;
|
||||
const uint32_t tail_fade_factor = 2;
|
||||
const uint32_t tail_length = 8;
|
||||
|
||||
|
@ -41,7 +41,7 @@ static int fix_index(int index)
|
|||
|
||||
static ws2812_pixel_t next_colour()
|
||||
{
|
||||
ws2812_pixel_t colour = {0, 0, 0};
|
||||
ws2812_pixel_t colour = {0, 0, 0, 0};
|
||||
colour.red = rand() % 256;
|
||||
colour.green = rand() % 256;
|
||||
colour.blue = rand() % 256;
|
||||
|
@ -54,7 +54,7 @@ static void demo(void *pvParameters)
|
|||
ws2812_pixel_t pixels[led_number];
|
||||
int head_index = 0;
|
||||
|
||||
ws2812_i2s_init(led_number);
|
||||
ws2812_i2s_init(led_number, PIXEL_RGB);
|
||||
|
||||
memset(pixels, 0, sizeof(ws2812_pixel_t) * led_number);
|
||||
|
||||
|
@ -69,8 +69,8 @@ static void demo(void *pvParameters)
|
|||
memset(&pixels[fix_index(head_index - tail_length)], 0,
|
||||
sizeof(ws2812_pixel_t));
|
||||
|
||||
ws2812_i2s_update(pixels);
|
||||
vTaskDelay(20 / portTICK_PERIOD_MS);
|
||||
ws2812_i2s_update(pixels, PIXEL_RGB);
|
||||
vTaskDelay(50 / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,6 +78,14 @@ static void demo(void *pvParameters)
|
|||
void user_init(void)
|
||||
{
|
||||
uart_set_baud(0, 115200);
|
||||
struct sdk_station_config config = {
|
||||
.ssid = "Loading...",
|
||||
.password = "morays59924_howitzer",
|
||||
};
|
||||
|
||||
/* required to call wifi_set_opmode before station_set_config */
|
||||
sdk_wifi_set_opmode(STATION_MODE);
|
||||
sdk_wifi_station_set_config(&config);
|
||||
|
||||
xTaskCreate(&demo, "ws2812_i2s", 256, NULL, 10, NULL);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue