Browse Source

hacked led_strip

Wizmo2 1 year ago
parent
commit
2ecf2e6098
2 changed files with 3 additions and 2 deletions
  1. 1 1
      components/led_strip/led_strip.h
  2. 2 1
      components/led_strip/led_vu.c

+ 1 - 1
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

+ 2 - 1
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);