Browse Source

restore static struct for led_vu

Wizmo2 1 year ago
parent
commit
3350a8dbc7
2 changed files with 7 additions and 13 deletions
  1. 0 9
      components/led_strip/led_strip.h
  2. 7 4
      components/led_strip/led_vu.c

+ 0 - 9
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;

+ 7 - 4
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;