PlatformIO Community

PlatformIO ledc.h different from Espressif-IDF ledc


I made a project using the ledc functions from esp-idf to control LEDs. When i compile it in VSCode using the Espressif-IDF extension it works, but when i compile the same code using the PlatformIO extension it won’t compile because some parts of ledc.h are missing in the PlatformIO version vs the Espressif-IDF version, one example:

Compiling .pio/build/nodemcu-32s/src/main.o
src/main.c: In function 'app_main':
src/main.c:110:5: error: unknown type name 'ledc_cbs_t'; did you mean 'ledc_mode_t'?
     ledc_cbs_t callbacks = {

When i search for the ledc_cbs_t i find a reference to it in the Espressif-IDF version of ledc.h but not in the PlatformIO version. I also notice on top of those files the copyright of the PlatformIO version of ledc.h goes from 2015-2019 and the Espressif-IDF version goes from 2015-2022.

Info about my setup
Debian Bullseye
VSCode 1.65.2
Espressif IDF extension V1.4.0
PlatformIO IDE extension V2.4.3 Core 5.2.5 Home 3.4.1
PlatformIO Platform: Espressif 3.5.0 (with ESP-IDF v4.3.2)

What could be the problem, any help is apreciated.

Thank you


Correct. This matches the v.4.3.2 version as seen in the repo.

Are you using the LEDC example from v4.3.2, and not the current master version? See here.

You are right, I adapted my program from the current master of the esp-idf ledc_fade_example which contains the callback, the 4.3.2 version indeed is different, thank you for pointing me in the right direction. I will keep the 4.3.2 version in mind from now on.