feat(ledc): add ledc_find_suitable_duty_resolution helper function

Helper function to find the maximum possible duty resolution in bits
for ledc_timer_config()

Merges https://github.com/espressif/esp-idf/pull/11810
This commit is contained in:
IhorNehrutsa
2023-07-07 17:42:57 +03:00
committed by Song Ruo Jing
parent fbc31c8f15
commit 9ced54699e
4 changed files with 49 additions and 4 deletions

View File

@@ -202,6 +202,8 @@ The source clock can also limit the PWM frequency. The higher the source clock f
2. For {IDF_TARGET_NAME}, all timers share one clock source. In other words, it is impossible to use different clock sources for different timers.
The LEDC driver offers a helper function :cpp:func:`ledc_find_suitable_duty_resolution` to find the maximum possible resolution for the timer, given the source clock frequency and the desired PWM signal frequency.
When a timer is no longer needed by any channel, it can be deconfigured by calling the same function :cpp:func:`ledc_timer_config`. The configuration structure :cpp:type:`ledc_timer_config_t` passes in should be:
- :cpp:member:`ledc_timer_config_t::speed_mode` The speed mode of the timer which wants to be deconfigured belongs to (:cpp:type:`ledc_mode_t`)