Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RMT API: Add missing get function: rmt_get_idle_level(). Suppress … (IDFGH-1789) #2666

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion components/driver/include/driver/rmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,21 @@ esp_err_t rmt_get_source_clk(rmt_channel_t channel, rmt_source_clk_t* src_clk);
*/
esp_err_t rmt_set_idle_level(rmt_channel_t channel, bool idle_out_en, rmt_idle_level_t level);

/**
* @brief Get RMT idle output level for transmitter
*
* @param channel RMT channel (0-7)
*
* @param idle_out_en Pointer to accept value of enable idle.
*
* @param level Pointer to accept value of output signal's level in idle state for specified channel.
*
* @return
* - ESP_ERR_INVALID_ARG Parameter error
* - ESP_OK Success
*/
esp_err_t rmt_get_idle_level(rmt_channel_t channel, bool* idle_out_en, rmt_idle_level_t* level);

/**
* @brief Get RMT status
*
Expand Down Expand Up @@ -715,7 +730,7 @@ esp_err_t rmt_write_items(rmt_channel_t channel, const rmt_item32_t* rmt_item, i
*
* @param channel RMT channel (0 - 7)
*
* @param wait_time Maximum time in ticks to wait for transmission to be complete
* @param wait_time Maximum time in ticks to wait for transmission to be complete. If set 0, return immediately with ESP_ERR_TIMEOUT if TX is busy (polling).
*
* @return
* - ESP_OK RMT Tx done successfully
Expand Down
12 changes: 11 additions & 1 deletion components/driver/rmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,14 @@ esp_err_t rmt_set_idle_level(rmt_channel_t channel, bool idle_out_en, rmt_idle_l
return ESP_OK;
}

esp_err_t rmt_get_idle_level(rmt_channel_t channel, bool* idle_out_en, rmt_idle_level_t* level)
{
RMT_CHECK(channel < RMT_CHANNEL_MAX, RMT_CHANNEL_ERROR_STR, ESP_ERR_INVALID_ARG);
*idle_out_en = (bool) (RMT.conf_ch[channel].conf1.idle_out_en);
*level = (rmt_idle_level_t) (RMT.conf_ch[channel].conf1.idle_out_lv);
return ESP_OK;
}

esp_err_t rmt_get_status(rmt_channel_t channel, uint32_t* status)
{
RMT_CHECK(channel < RMT_CHANNEL_MAX, RMT_CHANNEL_ERROR_STR, ESP_ERR_INVALID_ARG);
Expand Down Expand Up @@ -837,7 +845,9 @@ esp_err_t rmt_wait_tx_done(rmt_channel_t channel, TickType_t wait_time)
return ESP_OK;
}
else {
ESP_LOGE(RMT_TAG, "Timeout on wait_tx_done");
if (wait_time != 0) { // Don't emit error message if just polling.
ESP_LOGE(RMT_TAG, "Timeout on wait_tx_done");
}
return ESP_ERR_TIMEOUT;
}
}
Expand Down