ledc: Add timer selection check to the driver, and leave space for future clk tree management

This commit is contained in:
Song Ruo Jing
2023-03-24 19:40:18 +08:00
parent e8814f8a18
commit 64aec54308
5 changed files with 138 additions and 39 deletions
+9 -1
View File
@@ -60,7 +60,7 @@ Setting the timer is done by calling the function :cpp:func:`ledc_timer_config`
:esp32: - Speed mode :cpp:type:`ledc_mode_t`
:not esp32: - Speed mode (value must be ``LEDC_LOW_SPEED_MODE``)
- Timer number :cpp:type:`ledc_timer_t`
- PWM signal frequency
- PWM signal frequency in Hz
- Resolution of PWM duty
- Source clock :cpp:type:`ledc_clk_cfg_t`
@@ -222,6 +222,14 @@ 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.
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`)
- :cpp:member:`ledc_timer_config_t::timer_num` The ID of the timers which wants to be deconfigured (:cpp:type:`ledc_timer_t`)
- :cpp:member:`ledc_timer_config_t::deconfigure` Set this to true so that the timer specified can be deconfigured
.. _ledc-api-configure-channel: