Conversation
|
Just tested this with a servo on my ESP32. Works great! Wrt naming, I think the class should be I didn't dig all the way into the MCPWM docs yet, but can each channel set its frequency independently? For LEDC there are 4 timers shared among each group of 6 or 8 channels, so |
|
@vickash However, we believe that a class named PWM is necessary in case a program is ported from another platform (ex. mruby/c) or a beginner uses mruby-esp32. I checked the MicroPython on ESP32 documentation and the PWM class was still present. And it uses LEDC internally. I have two ideas.
How about I create a Pull Request with idea 1, if you don't mind? |
Perhaps you could use more than one timer. However, the current mruby-esp32-pwm can only use one timer. |
Ah, I see. I think aliasing LEDC to PWM is a good choice then. I'll do a PR soon with those changes, and some logic to manage its timer allocation. |
|
@vickash |
Added PWM class.
This class uses MCPWM internally, unlike LEDC.
This class is implemented based on the "peripheral class common specifications" here.
https://github.com/HirohitoHigashi/mruby_io_class_study
@vickash
I am not sure if the name "PWM class" is appropriate since the role is similar to mruby-esp32-ledc. However, I would like to follow the "peripheral class common specifications."
Any good ideas would be appreciated.