components/core2forAWS/sk6812/sk6812.c
int neopixel_init(int gpioNum, rmt_channel_t channel) {
	if (neopixel_sem == NULL) {
		neopixel_sem = xSemaphoreCreateBinary();
		if (neopixel_sem == NULL) return ESP_FAIL;
		xSemaphoreGive(neopixel_sem);
	}

	xSemaphoreTake(neopixel_sem, portMAX_DELAY);
    rmt_config_t config = {                                                
        .rmt_mode = RMT_MODE_TX,
        .channel = channel,
        .gpio_num = gpioNum,
        .clk_div = 2,
        .mem_block_num = 1, 
        .tx_config = {
            .idle_level = RMT_IDLE_LEVEL_LOW,
            .carrier_en = false,
            .loop_en = false,
            .idle_output_en = true,
        }                                            
    };

	esp_err_t res = ESP_OK;
	res = rmt_config(&config);
	if (res != ESP_OK) {
		goto failed;
	}

	res = rmt_driver_install(config.channel, 0, 0);
	if (res != ESP_OK) {
		goto failed;
	}

    res = rmt_translator_init(channel, np_rmt_adapter);
	if (res != ESP_OK) {
		goto failed;
	}

failed:
	xSemaphoreGive(neopixel_sem);
	return res;
}
// Initialize Neopixel RMT interface on specific GPIO
//===================================================
Initialize Neopixel RMT interface on specific GPIO
Initialize Neopixel RMT interface on specific GPIO
int neopixel_init(int gpioNum, rmt_channel_t channel) {
	if (neopixel_sem == NULL) {
		neopixel_sem = xSemaphoreCreateBinary();
		if (neopixel_sem == NULL) return ESP_FAIL;
		xSemaphoreGive(neopixel_sem);
	}
	xSemaphoreTake(neopixel_sem, portMAX_DELAY);
    rmt_config_t config = {                                                
        .rmt_mode = RMT_MODE_TX,
        .channel = channel,
        .gpio_num = gpioNum,
        .clk_div = 2,
        .mem_block_num = 1, 
        .tx_config = {
            .idle_level = RMT_IDLE_LEVEL_LOW,
            .carrier_en = false,
            .loop_en = false,
            .idle_output_en = true,
        }                                            
    };
	esp_err_t res = ESP_OK;
	res = rmt_config(&config);
	if (res != ESP_OK) {
		goto failed;
	}
	res = rmt_driver_install(config.channel, 0, 0);
	if (res != ESP_OK) {
		goto failed;
	}
    res = rmt_translator_init(channel, np_rmt_adapter);
	if (res != ESP_OK) {
		goto failed;
	}
failed:
	xSemaphoreGive(neopixel_sem);
	return res;
}
int neopixel_init ( int gpioNum , rmt_channel_t channel ) { if ( neopixel_sem == NULL ) { neopixel_sem = xSemaphoreCreateBinary ( ) ; if ( neopixel_sem == NULL ) return ESP_FAIL ; xSemaphoreGive ( neopixel_sem ) ; } xSemaphoreTake ( neopixel_sem , portMAX_DELAY ) ; rmt_config_t config = { . rmt_mode = RMT_MODE_TX , . channel = channel , . gpio_num = gpioNum , . clk_div = 2 , . mem_block_num = 1 , . tx_config = { . idle_level = RMT_IDLE_LEVEL_LOW , . carrier_en = false , . loop_en = false , . idle_output_en = true , } } ; esp_err_t res = ESP_OK ; res = rmt_config ( & config ) ; if ( res != ESP_OK ) { goto failed ; } res = rmt_driver_install ( config . channel , 0 , 0 ) ; if ( res != ESP_OK ) { goto failed ; } res = rmt_translator_init ( channel , np_rmt_adapter ) ; if ( res != ESP_OK ) { goto failed ; } failed : xSemaphoreGive ( neopixel_sem ) ; return res ; }
Initialize Neopixel RMT interface on specific GPIO
Initialize Neopixel RMT interface on specific GPIO