From 3350a8dbc70b3aeea8f144f13a770b683a2fe744 Mon Sep 17 00:00:00 2001 From: Wizmo2 Date: Fri, 15 Sep 2023 20:02:30 -0400 Subject: [PATCH 1/4] restore static struct for led_vu --- components/led_strip/led_strip.h | 9 --------- components/led_strip/led_vu.c | 11 +++++++---- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/components/led_strip/led_strip.h b/components/led_strip/led_strip.h index f1ec881a7..3fdace09e 100644 --- a/components/led_strip/led_strip.h +++ b/components/led_strip/led_strip.h @@ -44,15 +44,6 @@ struct led_strip_t { // RMT peripheral settings rmt_channel_t rmt_channel; - /* - * Interrupt table is located in soc.h - * As of 11/27/16, reccomended interrupts are: - * 9, 12, 13, 17, 18, 19, 20, 21 or 23 - * Ensure that the same interrupt number isn't used twice - * across all libraries - */ - int rmt_interrupt_num; - gpio_num_t gpio; // Must be less than GPIO_NUM_33 struct led_color_t *led_strip_working; diff --git a/components/led_strip/led_vu.c b/components/led_strip/led_vu.c index a0dd2d384..a8ee90f29 100644 --- a/components/led_strip/led_vu.c +++ b/components/led_strip/led_vu.c @@ -28,7 +28,7 @@ static const char *TAG = "led_vu"; -#define LED_VU_STACK_SIZE (3*1024) +#define LED_VU_STACK_SIZE (3*1024) #define LED_VU_PEAK_HOLD 6U @@ -39,6 +39,10 @@ static const char *TAG = "led_vu"; #define max(a,b) (((a) > (b)) ? (a) : (b)) struct led_strip_t* led_display = NULL; +static EXT_RAM_ATTR struct led_strip_t led_strip_config = { + .rgb_led_type = RGB_LED_TYPE_WS2812, + .gpio = -1, +}; static EXT_RAM_ATTR struct { int gpio; @@ -90,19 +94,18 @@ void led_vu_init() strip.vu_odd = strip.length - 1; // create driver configuration - struct led_strip_t led_strip_config = { .rgb_led_type = RGB_LED_TYPE_WS2812 }; led_strip_config.access_semaphore = xSemaphoreCreateBinary(); led_strip_config.led_strip_length = strip.length; led_strip_config.led_strip_working = heap_caps_malloc(strip.length * sizeof(struct led_color_t), MALLOC_CAP_8BIT); led_strip_config.led_strip_showing = heap_caps_malloc(strip.length * sizeof(struct led_color_t), MALLOC_CAP_8BIT); led_strip_config.gpio = strip.gpio; led_strip_config.rmt_channel = rmt_system_base_channel++; - + // initialize driver bool led_init_ok = led_strip_init(&led_strip_config); if (led_init_ok) { led_display = &led_strip_config; - ESP_LOGI(TAG, "led_vu using gpio:%d length:%d on channek:%d", strip.gpio, strip.length, led_strip_config.rmt_channel); + ESP_LOGI(TAG, "led_vu using gpio:%d length:%d on channel:%d", strip.gpio, strip.length, led_strip_config.rmt_channel); } else { ESP_LOGE(TAG, "led_vu init failed"); goto done; From 7f0b411dac9d46bf2fff3ecf2819bfcdbc3c3ce1 Mon Sep 17 00:00:00 2001 From: Wizmo2 Date: Fri, 15 Sep 2023 20:15:53 -0400 Subject: [PATCH 2/4] fix endings --- components/led_strip/led_strip.h | 2 +- components/led_strip/led_vu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/led_strip/led_strip.h b/components/led_strip/led_strip.h index 3fdace09e..87b240f32 100644 --- a/components/led_strip/led_strip.h +++ b/components/led_strip/led_strip.h @@ -43,7 +43,7 @@ struct led_strip_t { // RMT peripheral settings rmt_channel_t rmt_channel; - + gpio_num_t gpio; // Must be less than GPIO_NUM_33 struct led_color_t *led_strip_working; diff --git a/components/led_strip/led_vu.c b/components/led_strip/led_vu.c index a8ee90f29..5f5985fcf 100644 --- a/components/led_strip/led_vu.c +++ b/components/led_strip/led_vu.c @@ -100,7 +100,7 @@ void led_vu_init() led_strip_config.led_strip_showing = heap_caps_malloc(strip.length * sizeof(struct led_color_t), MALLOC_CAP_8BIT); led_strip_config.gpio = strip.gpio; led_strip_config.rmt_channel = rmt_system_base_channel++; - + // initialize driver bool led_init_ok = led_strip_init(&led_strip_config); if (led_init_ok) { From f32e4de84bc1fefac5528644a0c6d3cba8d98ff4 Mon Sep 17 00:00:00 2001 From: Wizmo2 Date: Sat, 16 Sep 2023 16:45:43 -0400 Subject: [PATCH 3/4] static declaration in function --- components/led_strip/led_vu.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/components/led_strip/led_vu.c b/components/led_strip/led_vu.c index f18f0738b..3257551d2 100644 --- a/components/led_strip/led_vu.c +++ b/components/led_strip/led_vu.c @@ -39,10 +39,6 @@ static const char *TAG = "led_vu"; #define max(a,b) (((a) > (b)) ? (a) : (b)) struct led_strip_t* led_display = NULL; -static EXT_RAM_ATTR struct led_strip_t led_strip_config = { - .rgb_led_type = RGB_LED_TYPE_WS2812, - .gpio = -1, -}; static EXT_RAM_ATTR struct { int gpio; @@ -94,6 +90,7 @@ void led_vu_init() strip.vu_odd = strip.length - 1; // create driver configuration + static struct led_strip_t led_strip_config = { .rgb_led_type = RGB_LED_TYPE_WS2812}; led_strip_config.access_semaphore = xSemaphoreCreateBinary(); led_strip_config.led_strip_length = strip.length; led_strip_config.led_strip_working = heap_caps_malloc(strip.length * sizeof(struct led_color_t), MALLOC_CAP_8BIT); From 2ecf2e609845ba766178c90939c84c2b92ee13d9 Mon Sep 17 00:00:00 2001 From: Wizmo2 Date: Sat, 16 Sep 2023 17:12:26 -0400 Subject: [PATCH 4/4] hacked led_strip --- components/led_strip/led_strip.h | 2 +- components/led_strip/led_vu.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/components/led_strip/led_strip.h b/components/led_strip/led_strip.h index 87b240f32..3051c1cae 100644 --- a/components/led_strip/led_strip.h +++ b/components/led_strip/led_strip.h @@ -38,7 +38,7 @@ struct led_color_t { }; struct led_strip_t { - const enum rgb_led_type_t rgb_led_type; + enum rgb_led_type_t rgb_led_type; // should be const, but workaround needed for initialization uint32_t led_strip_length; // RMT peripheral settings diff --git a/components/led_strip/led_vu.c b/components/led_strip/led_vu.c index 3257551d2..59ca0defd 100644 --- a/components/led_strip/led_vu.c +++ b/components/led_strip/led_vu.c @@ -39,6 +39,7 @@ static const char *TAG = "led_vu"; #define max(a,b) (((a) > (b)) ? (a) : (b)) struct led_strip_t* led_display = NULL; +static EXT_RAM_ATTR struct led_strip_t led_strip_config; static EXT_RAM_ATTR struct { int gpio; @@ -90,7 +91,7 @@ void led_vu_init() strip.vu_odd = strip.length - 1; // create driver configuration - static struct led_strip_t led_strip_config = { .rgb_led_type = RGB_LED_TYPE_WS2812}; + led_strip_config.rgb_led_type = RGB_LED_TYPE_WS2812; led_strip_config.access_semaphore = xSemaphoreCreateBinary(); led_strip_config.led_strip_length = strip.length; led_strip_config.led_strip_working = heap_caps_malloc(strip.length * sizeof(struct led_color_t), MALLOC_CAP_8BIT);