Jason2866 / platform-espressif32

Tasmota Espressif 32: development platform for PlatformIO

Home Page:http://platformio.org/platforms/espressif32

Repository from Github https://github.comJason2866/platform-espressif32Repository from Github https://github.comJason2866/platform-espressif32

Problem with H2 and PWM

anthonymichelon opened this issue · comments

Hello,

I'm using your H2-devkit platform and I encountered an issue using the ledc functions to drive PWM.

Here is my platformio.ini:
[env:esp32-h2-devkitm-1]
platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF5
board = esp32-h2-devkitm-1
framework = arduino
upload_port = /dev/cu.usbmodem323101
monitor_speed = 460800
build_flags =
-D ARDUINO_USB_MODE=1
-D ARDUINO_USB_CDC_ON_BOOT=1

Here is a simple code to try the function:
#include <Arduino.h>

void setup()
{
ledcAttachPin(18, 0); // broche 18, canal 0.
ledcSetup(0, 5000, 12); // canal = 0, frequence = 5000 Hz, resolution = 12 bits
ledcWrite(0, 2048); // canal = 0, rapport cyclique = 2048
}

void loop()
{
}

I got an error on the ledcAttachPin, ledcSetup functions :
src/main.cpp: In function 'void setup()':
src/main.cpp:5:3: error: 'ledcAttachPin' was not declared in this scope; did you mean 'ledcAttach'?
5 | ledcAttachPin(18, 0); // broche 18, canal 0.
| ^~~~~~~~~~~~~
| ledcAttach
src/main.cpp:6:3: error: 'ledcSetup' was not declared in this scope
6 | ledcSetup(0, 5000, 12); // canal = 0, frequence = 5000 Hz, resolution = 12 bits
| ^~~~~~~~~
*** [.pio\build\esp32-h2-devkitm-1\src\main.cpp.o] Error 1

And if I remove #include <Arduino.h>, I also have the error on ledcWrite:
src/main.cpp: In function 'void setup()':
src/main.cpp:5:3: error: 'ledcAttachPin' was not declared in this scope
5 | ledcAttachPin(18, 0); // broche 18, canal 0.
| ^~~~~~~~~~~~~
src/main.cpp:6:3: error: 'ledcSetup' was not declared in this scope
6 | ledcSetup(0, 5000, 12); // canal = 0, frequence = 5000 Hz, resolution = 12 bits
| ^~~~~~~~~
src/main.cpp:7:3: error: 'ledcWrite' was not declared in this scope
7 | ledcWrite(0, 2048); // canal = 0, rapport cyclique = 2048
| ^~~~~~~~~

Is it something to be done to correct this library access (?) issue?

Regards

Not an issue of the platform-espressif32. Please open an issue at https://github.com/espressif/arduino-esp32/issues