]> granicus.if.org Git - esp-idf/commitdiff
rmt driver: Fix parameter & description of rmt_driver_install
authorAngus Gratton <angus@espressif.com>
Wed, 22 Mar 2017 04:30:34 +0000 (12:30 +0800)
committerAngus Gratton <angus@espressif.com>
Wed, 22 Mar 2017 04:30:34 +0000 (12:30 +0800)
Closes #187 https://github.com/espressif/esp-idf/issues/187

components/driver/include/driver/rmt.h
components/driver/rmt.c

index 36e33e732edf5f8bad193c08ec0ca936c35fcd0b..f5e82b4a1f36030f1e751876a91e6b39e6080121 100644 (file)
@@ -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.
index d277ea00cda686a2820f5093528f13f5e51107e3..6ff1fb671a7d4d91cda2022fe8120920f65921d0 100644 (file)
@@ -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));