* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include"driver/i2s_types.h"
#include"hal/i2s_types.h"
#include"esp_types.h"
#include"esp_err.h"
#ifdef __cplusplus
extern"C"{
#endif
/**
* @brief LP_I2S max timeout value
*/
#define LP_I2S_MAX_DELAY UINT32_MAX
/**
* @brief LP I2S controller channel configuration
*/
typedefstruct{
intid;/*!< LP I2S port id */
i2s_role_trole;/*!< LP I2S role, only I2S_ROLE_SLAVE supported */
size_tthreshold;/*!< When LP I2S received bytes are bigger than this value, the `on_thresh_met` callback will be triggered. Must be in multiple of 4 */
}lp_i2s_chan_config_t;
/**
* @brief LP I2S event callbacks
*/
typedefstruct{
lp_i2s_callback_ton_thresh_met;///< Triggered when the received bytes are bigger than `lp_i2s_chan_config_t:threshold`
lp_i2s_callback_ton_request_new_trans;///< Triggered when a new transaction buffer is needed, when this callback is registered, you don't need to use `lp_i2s_channel_read` to get data, you can get data via this callback asynchronously
* @param[out] ret_tx_handle LP I2S channel handler used for managing the sending channel(optional), this one is not supported and is kept here for future-proof.
* @param[out] ret_rx_handle LP I2S channel handler used for managing the receiving channel(optional)
* @return
* - ESP_OK Allocate new channel(s) success
* - ESP_ERR_NOT_SUPPORTED The communication mode is not supported on the current chip
* - ESP_ERR_INVALID_ARG NULL pointer or illegal parameter in lp_i2s_chan_config_t
* - ESP_ERR_NOT_FOUND No available LP I2S channel found