ESP-IDF timer delay

Hello, I am trying to provide delay between the RGB colors of an led. I don't want to use the vTaskDelay() since it effects also other part of my code. Therefore, I am trying to implement ESP-IDF timer functions but only the first color appears and never blinks. Can someone point out to where I'm going wring and where I can correct? Thank you.

The timer implementation is as below:

static void periodic_timer_callback(void* arg)
  gpioToggle = true;

int initgpio(task_t *_this)
  if(_this->state > TASKSTATE_UNINITIALIZED) {
    return -1;

    /* 1. create a periodic timer which will run every 0.5s, and print a message */
    const esp_timer_create_args_t periodic_timer_args = {
            .callback = &periodic_timer_callback,
            /* name is optional, but may help identify the timer when debugging */
            .name = "periodic"
    esp_timer_handle_t periodic_timer;
    ESP_ERROR_CHECK(esp_timer_create(&periodic_timer_args, &periodic_timer));
    /* Start the timer */
    ESP_ERROR_CHECK(esp_timer_start_periodic(periodic_timer, 500000));

 _this->state = TASKSTATE_RUNNING;
	return -1;

Also the led blink implementation:

void RGB_Val(uint16_t val) {
  if (gpioToggle) {
    databuf[0]= val;
    ret=spi_device_transmit(handle, &t);
    gpioToggle = false;

void execgpio(task_t *_this) {
    gpio_set_level(GPIO_CS, state_low);
    gpio_set_level(GPIO_CS, state_high);

Can you explain that? vTaskDelay() will only delay that task that calls it.

Please answer post#2, I've not ever heard or experienced such a thing.

There is a hint in the below code as to what is being done wring under the Arduino IDE.

esp_timer_create_args_t oneshot_timer_args = {}; // initialize High Resoulition Timer (HRT) configuration structure
  oneshot_timer_args.callback = &oneshot_timer_callback; // configure for callback, name of callback function
  esp_timer_create( &oneshot_timer_args, &oneshot_timer ); // assign configuration to the HRT, receive timer handle

Another hint:

gpio_config_t io_cfg = {};
  io_cfg.mode = GPIO_MODE_INPUT;
  io_cfg.pin_bit_mask = ( (1ULL << GPIO_NUM_17)  );

Look at how the configuration structure is used under the Arduino IDE VS the IDF?

@gfvalvo, I have a series of tasks that execute in an order. So I believe it will effect the other tasks. Correct me If I'm wrong.

@gfvalvo @Idahowalker Now I found a solution for this. Thank you very much:)

How about answer how vTaskDelay from various tasks are effecting each other?