mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/bytes_encoder_config_update_v5.2' into 'release/v5.2'
feat(rmt): support update bytes encoder configurations at runtime (v5.2) See merge request espressif/esp-idf!28381
This commit is contained in:
commit
df558f4f39
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -98,6 +98,21 @@ typedef struct {
|
||||
*/
|
||||
esp_err_t rmt_new_bytes_encoder(const rmt_bytes_encoder_config_t *config, rmt_encoder_handle_t *ret_encoder);
|
||||
|
||||
/**
|
||||
* @brief Update the configuration of the bytes encoder
|
||||
*
|
||||
* @note The configurations of the bytes encoder is also set up by `rmt_new_bytes_encoder()`.
|
||||
* This function is used to update the configuration of the bytes encoder at runtime.
|
||||
*
|
||||
* @param[in] bytes_encoder Bytes encoder handle, created by e.g `rmt_new_bytes_encoder()`
|
||||
* @param[in] config Bytes encoder configuration
|
||||
* @return
|
||||
* - ESP_OK: Update RMT bytes encoder successfully
|
||||
* - ESP_ERR_INVALID_ARG: Update RMT bytes encoder failed because of invalid argument
|
||||
* - ESP_FAIL: Update RMT bytes encoder failed because of other error
|
||||
*/
|
||||
esp_err_t rmt_bytes_encoder_update_config(rmt_encoder_handle_t bytes_encoder, const rmt_bytes_encoder_config_t *config);
|
||||
|
||||
/**
|
||||
* @brief Create RMT copy encoder, which copies the given RMT symbols into RMT memory
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -275,6 +275,16 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
esp_err_t rmt_bytes_encoder_update_config(rmt_encoder_handle_t bytes_encoder, const rmt_bytes_encoder_config_t *config)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE(bytes_encoder && config, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
||||
rmt_bytes_encoder_t *encoder = __containerof(bytes_encoder, rmt_bytes_encoder_t, base);
|
||||
encoder->bit0 = config->bit0;
|
||||
encoder->bit1 = config->bit1;
|
||||
encoder->flags.msb_first = config->flags.msb_first;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t rmt_new_copy_encoder(const rmt_copy_encoder_config_t *config, rmt_encoder_handle_t *ret_encoder)
|
||||
{
|
||||
esp_err_t ret = ESP_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user