Chapter 2. API Reference
• ESP_OK Success
Parameters
• speed_mode: Select the LEDC channel group with specified speed mode. Note that not all targets
support high speed mode.
• timer_sel: LEDC timer index (0-3), select from ledc_timer_t
esp_err_t ledc_timer_pause(ledc_mode_t speed_mode, ledc_timer_t timer_sel)
Pause LEDC timer counter.
Return
• ESP_ERR_INVALID_ARG Parameter error
• ESP_OK Success
Parameters
• speed_mode: Select the LEDC channel group with specified speed mode. Note that not all targets
support high speed mode.
• timer_sel: LEDC timer index (0-3), select from ledc_timer_t
esp_err_t ledc_timer_resume(ledc_mode_t speed_mode, ledc_timer_t timer_sel)
Resume LEDC timer.
Return
• ESP_ERR_INVALID_ARG Parameter error
• ESP_OK Success
Parameters
• speed_mode: Select the LEDC channel group with specified speed mode. Note that not all targets
support high speed mode.
• timer_sel: LEDC timer index (0-3), select from ledc_timer_t
esp_err_t ledc_bind_channel_timer(ledc_mode_t speed_mode, ledc_channel_t channel,
ledc_timer_t timer_sel)
Bind LEDC channel with the selected timer.
Return
• ESP_ERR_INVALID_ARG Parameter error
• ESP_OK Success
Parameters
• speed_mode: Select the LEDC channel group with specified speed mode. Note that not all targets
support high speed mode.
• channel: LEDC channel index (0 - LEDC_CHANNEL_MAX-1), select from ledc_channel_t
• timer_sel: LEDC timer index (0-3), select from ledc_timer_t
esp_err_t ledc_set_fade_with_step(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t
target_duty, uint32_t scale, uint32_t cycle_num)
Set LEDC fade function.
Note Call ledc_fade_func_install() once before calling this function. Call ledc_fade_start() after this to start
fading.
Note ledc_set_fade_with_step, ledc_set_fade_with_time and ledc_fade_start are not thread-safe, do not call
these functions to control one LEDC channel in different tasks at the same time. A thread-safe version
of API is ledc_set_fade_step_and_start
Note If a fade operation is running in progress on that channel, the driver would not allow it to be stopped.
Other duty operations will have to wait until the fade operation has finished.
Return
• ESP_ERR_INVALID_ARG Parameter error
• ESP_OK Success
• ESP_ERR_INVALID_STATE Fade function not installed.
• ESP_FAIL Fade function init error
Parameters
• speed_mode: Select the LEDC channel group with specified speed mode. Note that not all targets
support high speed mode. ,
• channel: LEDC channel index (0 - LEDC_CHANNEL_MAX-1), select from ledc_channel_t
• target_duty: Target duty of fading [0, (2**duty_resolution) - 1]
Espressif Systems 322
Submit Document Feedback
Release v4.4