EasyManua.ls Logo

Espressif ESP32-S2 - Page 332

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
Parameters
speed_mode: Select the LEDC channel group with specified speed mode. Note that not all targets
support high speed mode.
channel: LEDC channel (0 - LEDC_CHANNEL_MAX-1), select from ledc_channel_t
esp_err_t ledc_set_fade(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t duty,
ledc_duty_direction_t fade_direction, uint32_t step_num, uint32_t
duty_cycle_num, uint32_t duty_scale)
LEDC set gradient Set LEDC gradient, After the function calls the ledc_update_duty function, the function
can take effect.
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_OK Success
ESP_ERR_INVALID_ARG Parameter 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 (0 - LEDC_CHANNEL_MAX-1), select from ledc_channel_t
duty: Set the start of the gradient duty, the range of duty setting is [0, (2**duty_resolution) - 1]
fade_direction: Set the direction of the gradient
step_num: Set the number of the gradient
duty_cycle_num: Set how many LEDC tick each time the gradient lasts
duty_scale: Set gradient change amplitude
esp_err_t ledc_isr_register(void (*fn))void *
, void *arg, int intr_alloc_flags, ledc_isr_handle_t *handleRegister LEDC interrupt handler, the handler is an
ISR. The handler will be attached to the same CPU core that this function is running on.
Return
ESP_OK Success
ESP_ERR_INVALID_ARG Function pointer error.
Parameters
fn: Interrupt handler function.
arg: User-supplied argument passed to the handler function.
intr_alloc_flags: Flags used to allocate the interrupt. One or multiple (ORred)
ESP_INTR_FLAG_* values. See esp_intr_alloc.h for more info.
handle: Pointer to return handle. If non-NULL, a handle for the interrupt will be returned here.
esp_err_t ledc_timer_set(ledc_mode_t speed_mode, ledc_timer_t timer_sel, uint32_t clock_divider,
uint32_t duty_resolution, ledc_clk_src_t clk_src)
Configure LEDC settings.
Return
(-1) Parameter error
Other Current LEDC duty
Parameters
speed_mode: Select the LEDC channel group with specified speed mode. Note that not all targets
support high speed mode.
timer_sel: Timer index (0-3), there are 4 timers in LEDC module
clock_divider: Timer clock divide value, the timer clock is divided from the selected clock
source
duty_resolution: Resolution of duty setting in number of bits. The range of duty values is
[0, (2**duty_resolution)]
clk_src: Select LEDC source clock.
esp_err_t ledc_timer_rst(ledc_mode_t speed_mode, ledc_timer_t timer_sel)
Reset LEDC timer.
Return
ESP_ERR_INVALID_ARG Parameter error
Espressif Systems 321
Submit Document Feedback
Release v4.4

Table of Contents