mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-07 20:00:53 +00:00
doc(lp_i2s): lp i2s programming guide
This commit is contained in:
@@ -55,7 +55,7 @@ esp_err_t lp_i2s_new_channel(const lp_i2s_chan_config_t *chan_cfg, lp_i2s_chan_h
|
||||
/**
|
||||
* @brief Register LP I2S event callbacks
|
||||
*
|
||||
* @param[in] handle LP I2S channel handle
|
||||
* @param[in] chan LP I2S channel handle
|
||||
* @param[in] cbs Callbacks
|
||||
* @param[in] user_data User data
|
||||
*
|
||||
@@ -64,12 +64,12 @@ esp_err_t lp_i2s_new_channel(const lp_i2s_chan_config_t *chan_cfg, lp_i2s_chan_h
|
||||
* - ESP_ERR_INVALID_ARG: Invalid argument
|
||||
* - ESP_ERR_INVALID_STATE: Invalid state
|
||||
*/
|
||||
esp_err_t lp_i2s_register_event_callbacks(lp_i2s_chan_handle_t handle, const lp_i2s_evt_cbs_t *cbs, void *user_data);
|
||||
esp_err_t lp_i2s_register_event_callbacks(lp_i2s_chan_handle_t chan, const lp_i2s_evt_cbs_t *cbs, void *user_data);
|
||||
|
||||
/**
|
||||
* @brief Enable LP I2S driver
|
||||
*
|
||||
* @param[in] handle LP I2S channel handle
|
||||
* @param[in] chan LP I2S channel handle
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: On success
|
||||
@@ -81,7 +81,7 @@ esp_err_t lp_i2s_channel_enable(lp_i2s_chan_handle_t chan);
|
||||
/**
|
||||
* @brief Read LP I2S received data
|
||||
*
|
||||
* @param[in] handle LP I2S channel handle
|
||||
* @param[in] chan LP I2S channel handle
|
||||
* @param[in] trans LP I2S transaction
|
||||
* @param[in] timeout_ms Timeout in ms, set to `LP_I2S_MAX_DELAY` to wait until read is done
|
||||
*
|
||||
@@ -95,7 +95,7 @@ esp_err_t lp_i2s_channel_read(lp_i2s_chan_handle_t chan, lp_i2s_trans_t *trans,
|
||||
/**
|
||||
* @brief Read LP I2S received data until certain bytes
|
||||
*
|
||||
* @param[in] handle LP I2S channel handle
|
||||
* @param[in] chan LP I2S channel handle
|
||||
* @param[in] trans LP I2S transaction
|
||||
*
|
||||
* @return
|
||||
@@ -108,7 +108,7 @@ esp_err_t lp_i2s_channel_read_until_bytes(lp_i2s_chan_handle_t chan, lp_i2s_tran
|
||||
/**
|
||||
* @brief Disable LP I2S driver
|
||||
*
|
||||
* @param[in] handle LP I2S channel handle
|
||||
* @param[in] chan LP I2S channel handle
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: On success
|
||||
@@ -120,13 +120,13 @@ esp_err_t lp_i2s_channel_disable(lp_i2s_chan_handle_t chan);
|
||||
/**
|
||||
* @brief Delete the LP I2S channel
|
||||
*
|
||||
* @param[in] handle LP I2S channel handler
|
||||
* @param[in] chan LP I2S channel handler
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK Delete successfully
|
||||
* - ESP_ERR_INVALID_ARG NULL pointer
|
||||
*/
|
||||
esp_err_t lp_i2s_del_channel(lp_i2s_chan_handle_t handle);
|
||||
esp_err_t lp_i2s_del_channel(lp_i2s_chan_handle_t chan);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -246,10 +246,10 @@ esp_err_t lp_i2s_del_channel(lp_i2s_chan_handle_t chan)
|
||||
_Static_assert(sizeof(lp_i2s_evt_cbs_t) == sizeof(lp_i2s_evt_cbs_internal_t), "Invalid size of lp_i2s_evt_cbs_t structure");
|
||||
#endif
|
||||
|
||||
esp_err_t lp_i2s_register_event_callbacks(lp_i2s_chan_handle_t handle, const lp_i2s_evt_cbs_t *cbs, void *user_data)
|
||||
esp_err_t lp_i2s_register_event_callbacks(lp_i2s_chan_handle_t chan, const lp_i2s_evt_cbs_t *cbs, void *user_data)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE(handle && cbs, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
||||
ESP_RETURN_ON_FALSE(handle->state < I2S_CHAN_STATE_RUNNING, ESP_ERR_INVALID_STATE, TAG, "the channel is in enabled state already");
|
||||
ESP_RETURN_ON_FALSE(chan && cbs, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
||||
ESP_RETURN_ON_FALSE(chan->state < I2S_CHAN_STATE_RUNNING, ESP_ERR_INVALID_STATE, TAG, "the channel is in enabled state already");
|
||||
|
||||
if (cbs->on_thresh_met) {
|
||||
ESP_RETURN_ON_FALSE(esp_ptr_in_iram(cbs->on_thresh_met), ESP_ERR_INVALID_ARG, TAG, "on_thresh_met callback not in IRAM");
|
||||
@@ -258,9 +258,9 @@ esp_err_t lp_i2s_register_event_callbacks(lp_i2s_chan_handle_t handle, const lp_
|
||||
ESP_RETURN_ON_FALSE(esp_ptr_in_iram(cbs->on_request_new_trans), ESP_ERR_INVALID_ARG, TAG, "on_request_new_trans callback not in IRAM");
|
||||
}
|
||||
|
||||
handle->cbs.on_thresh_met = cbs->on_thresh_met;
|
||||
handle->cbs.on_request_new_trans = cbs->on_request_new_trans;
|
||||
handle->user_data = user_data;
|
||||
chan->cbs.on_thresh_met = cbs->on_thresh_met;
|
||||
chan->cbs.on_request_new_trans = cbs->on_request_new_trans;
|
||||
chan->user_data = user_data;
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
Reference in New Issue
Block a user