Function esp_idf_hal::sys::i2s_new_channel
source · pub unsafe extern "C" fn i2s_new_channel(
chan_cfg: *const i2s_chan_config_t,
ret_tx_handle: *mut *mut i2s_channel_obj_t,
ret_rx_handle: *mut *mut i2s_channel_obj_t,
) -> i32
Expand description
@brief Allocate new I2S channel(s) @note The new created I2S channel handle will be REGISTERED state after it is allocated successfully. @note When the port id in channel configuration is I2S_NUM_AUTO, driver will allocate I2S port automatically on one of the i2s controller, otherwise driver will try to allocate the new channel on the selected port. @note If both tx_handle and rx_handle are not NULL, it means this I2S controller will work at full-duplex mode, the rx and tx channels will be allocated on a same I2S port in this case. Note that some configurations of tx/rx channel are shared on ESP32 and ESP32S2, so please make sure they are working at same condition and under same status(start/stop). Currently, full-duplex mode can’t guarantee tx/rx channels write/read synchronously, they can only share the clock signals for now. @note If tx_handle OR rx_handle is NULL, it means this I2S controller will work at simplex mode. For ESP32 and ESP32S2, the whole I2S controller (i.e. both rx and tx channel) will be occupied, even if only one of rx or tx channel is registered. For the other targets, another channel on this controller will still available.
@param[in] chan_cfg I2S controller channel configurations @param[out] ret_tx_handle I2S channel handler used for managing the sending channel(optional) @param[out] ret_rx_handle 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 i2s_chan_config_t - ESP_ERR_NOT_FOUND No available I2S channel found