From c30bba8c63120b19e15779c6459624958fed23df Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 22 Mar 2017 12:30:34 +0800 Subject: [PATCH] rmt driver: Fix parameter & description of rmt_driver_install Closes #187 https://github.com/espressif/esp-idf/issues/187 --- components/driver/include/driver/rmt.h | 15 +++++---------- components/driver/rmt.c | 6 +++--- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/components/driver/include/driver/rmt.h b/components/driver/include/driver/rmt.h index 36e33e732e..f5e82b4a1f 100644 --- a/components/driver/include/driver/rmt.h +++ b/components/driver/include/driver/rmt.h @@ -619,22 +619,17 @@ esp_err_t rmt_fill_tx_items(rmt_channel_t channel, rmt_item32_t* item, uint16_t * * @param channel RMT channel (0 - 7) * - * @param rx_buf_size Size of RMT RX ringbuffer. + * @param rx_buf_size Size of RMT RX ringbuffer. Can be 0 if the RX ringbuffer is not used. * - * @note - * If we do not need RX ringbuffer, just set rx_buf_size to 0. - * - * @note - * When we call rmt_driver_install function, it will register a driver ISR handler, - * DO NOT REGISTER ISR HANDLER AGAIN. - * - * @param rmt_intr_num RMT interrupt number. + * @param intr_alloc_flags Flags for the RMT driver interrupt handler. Pass 0 for default flags. See esp_intr_alloc.h for details. * * @return + * - ESP_ERR_INVALID_STATE Driver is already installed, call rmt_driver_uninstall first. + * - ESP_ERR_NO_MEM Memory allocation failure * - ESP_ERR_INVALID_ARG Parameter error * - ESP_OK Success */ -esp_err_t rmt_driver_install(rmt_channel_t channel, size_t rx_buf_size, int rmt_intr_num); +esp_err_t rmt_driver_install(rmt_channel_t channel, size_t rx_buf_size, int intr_alloc_flags); /** * @brief Uninstall RMT driver. diff --git a/components/driver/rmt.c b/components/driver/rmt.c index d277ea00cd..6ff1fb671a 100644 --- a/components/driver/rmt.c +++ b/components/driver/rmt.c @@ -643,15 +643,15 @@ esp_err_t rmt_driver_install(rmt_channel_t channel, size_t rx_buf_size, int intr { RMT_CHECK(channel < RMT_CHANNEL_MAX, RMT_CHANNEL_ERROR_STR, ESP_ERR_INVALID_ARG); if(p_rmt_obj[channel] != NULL) { - ESP_LOGD(RMT_TAG, "RMT DRIVER ALREADY INSTALLED"); - return ESP_FAIL; + ESP_LOGD(RMT_TAG, "RMT driver already installed"); + return ESP_ERR_INVALID_STATE; } p_rmt_obj[channel] = (rmt_obj_t*) malloc(sizeof(rmt_obj_t)); if(p_rmt_obj[channel] == NULL) { ESP_LOGE(RMT_TAG, "RMT driver malloc error"); - return ESP_FAIL; + return ESP_ERR_NO_MEM; } memset(p_rmt_obj[channel], 0, sizeof(rmt_obj_t));