mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-06 19:47:02 +03:00
restore static struct for led_vu
This commit is contained in:
@@ -44,15 +44,6 @@ struct led_strip_t {
|
|||||||
// RMT peripheral settings
|
// RMT peripheral settings
|
||||||
rmt_channel_t rmt_channel;
|
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
|
gpio_num_t gpio; // Must be less than GPIO_NUM_33
|
||||||
|
|
||||||
struct led_color_t *led_strip_working;
|
struct led_color_t *led_strip_working;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
static const char *TAG = "led_vu";
|
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
|
#define LED_VU_PEAK_HOLD 6U
|
||||||
|
|
||||||
@@ -39,6 +39,10 @@ static const char *TAG = "led_vu";
|
|||||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||||
|
|
||||||
struct led_strip_t* led_display = NULL;
|
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 {
|
static EXT_RAM_ATTR struct {
|
||||||
int gpio;
|
int gpio;
|
||||||
@@ -90,19 +94,18 @@ void led_vu_init()
|
|||||||
strip.vu_odd = strip.length - 1;
|
strip.vu_odd = strip.length - 1;
|
||||||
|
|
||||||
// create driver configuration
|
// 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.access_semaphore = xSemaphoreCreateBinary();
|
||||||
led_strip_config.led_strip_length = strip.length;
|
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_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.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.gpio = strip.gpio;
|
||||||
led_strip_config.rmt_channel = rmt_system_base_channel++;
|
led_strip_config.rmt_channel = rmt_system_base_channel++;
|
||||||
|
|
||||||
// initialize driver
|
// initialize driver
|
||||||
bool led_init_ok = led_strip_init(&led_strip_config);
|
bool led_init_ok = led_strip_init(&led_strip_config);
|
||||||
if (led_init_ok) {
|
if (led_init_ok) {
|
||||||
led_display = &led_strip_config;
|
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 {
|
} else {
|
||||||
ESP_LOGE(TAG, "led_vu init failed");
|
ESP_LOGE(TAG, "led_vu init failed");
|
||||||
goto done;
|
goto done;
|
||||||
|
|||||||
Reference in New Issue
Block a user