Merge branch 'doc/explain_ledc_callback_return_value' into 'master'

ledc: explain the callback return value

Closes IDFGH-8647

See merge request espressif/esp-idf!20916
pull/10165/head
morris 2022-11-07 17:55:59 +08:00
commit 9f18a0bb5b
2 zmienionych plików z 8 dodań i 6 usunięć

Wyświetl plik

@ -90,8 +90,9 @@ typedef struct {
* @brief Type of LEDC event callback
* @param param LEDC callback parameter
* @param user_arg User registered data
* @return Whether a high priority task has been waken up by this function
*/
typedef bool (* ledc_cb_t)(const ledc_cb_param_t *param, void *user_arg);
typedef bool (*ledc_cb_t)(const ledc_cb_param_t *param, void *user_arg);
/**
* @brief Group of supported LEDC callbacks
@ -111,7 +112,7 @@ typedef struct {
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t ledc_channel_config(const ledc_channel_config_t* ledc_conf);
esp_err_t ledc_channel_config(const ledc_channel_config_t *ledc_conf);
/**
* @brief LEDC timer configuration
@ -124,7 +125,7 @@ esp_err_t ledc_channel_config(const ledc_channel_config_t* ledc_conf);
* - ESP_ERR_INVALID_ARG Parameter error
* - ESP_FAIL Can not find a proper pre-divider number base on the given frequency and the current duty_resolution.
*/
esp_err_t ledc_timer_config(const ledc_timer_config_t* timer_conf);
esp_err_t ledc_timer_config(const ledc_timer_config_t *timer_conf);
/**
* @brief LEDC update channel parameters
@ -299,7 +300,7 @@ esp_err_t ledc_set_fade(ledc_mode_t speed_mode, ledc_channel_t channel, uint32_t
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Function pointer error.
*/
esp_err_t ledc_isr_register(void (*fn)(void*), void * arg, int intr_alloc_flags, ledc_isr_handle_t *handle);
esp_err_t ledc_isr_register(void (*fn)(void *), void *arg, int intr_alloc_flags, ledc_isr_handle_t *handle);
/**
* @brief Configure LEDC settings
@ -462,7 +463,7 @@ esp_err_t ledc_fade_start(ledc_mode_t speed_mode, ledc_channel_t channel, ledc_f
* - ESP_ERR_INVALID_ARG Parameter error.
*/
esp_err_t ledc_fade_stop(ledc_mode_t speed_mode, ledc_channel_t channel);
#endif
#endif //SOC_LEDC_SUPPORT_FADE_STOP
/**
* @brief A thread-safe API to set duty for LEDC channel and return when duty updated.
@ -528,6 +529,7 @@ esp_err_t ledc_set_fade_step_and_start(ledc_mode_t speed_mode, ledc_channel_t ch
* - ESP_FAIL Fade function init error
*/
esp_err_t ledc_cb_register(ledc_mode_t speed_mode, ledc_channel_t channel, ledc_cbs_t *cbs, void *user_arg);
#ifdef __cplusplus
}
#endif

Wyświetl plik

@ -235,7 +235,7 @@ The LEDC hardware provides the means to gradually transition from one duty cycle
Start fading with :cpp:func:`ledc_fade_start`. A fade can be operated in blocking or non-blocking mode, please check :cpp:enum:`ledc_fade_mode_t` for the difference between the two available fade modes. Note that with either fade mode, the next fade or fixed-duty update will not take effect until the last fade finishes or is stopped. :cpp:func:`ledc_fade_stop` has to be called to stop a fade that is in progress.
To get a notification about the completion of a fade operation, a fade end callback function can be registered for each channel by calling :cpp:func:`ledc_cb_register` after the fade service being installed.
To get a notification about the completion of a fade operation, a fade end callback function can be registered for each channel by calling :cpp:func:`ledc_cb_register` after the fade service being installed. The fade end callback prototype is defined in :cpp:type:`ledc_cb_t`, where you should return a boolean value from the callback function, indicating whether a high priority task is woken up by this callback function.
If not required anymore, fading and an associated interrupt can be disabled with :cpp:func:`ledc_fade_func_uninstall`.