i2s: fix only right case

Closes: https://github.com/espressif/esp-idf/issues/8538
This commit is contained in:
laokaiyao
2022-04-05 15:47:16 +08:00
committed by Kevin (Lao Kaiyao)
parent d6d34b27a8
commit b99ced08a2
10 changed files with 290 additions and 26 deletions

View File

@@ -19,6 +19,7 @@
#include "soc/i2s_periph.h"
#include "soc/i2s_struct.h"
#include "hal/i2s_types.h"
#include "hal/i2s_types_priv.h"
#ifdef __cplusplus
extern "C" {
@@ -828,11 +829,48 @@ static inline void i2s_ll_rx_enable_msb_shift(i2s_dev_t *hw, bool msb_shift_enab
* @brief Set I2S tx chan mode
*
* @param hw Peripheral I2S hardware instance address.
* @param val value to set tx chan mode
* @param slot_sel select slot to send data
*/
static inline void i2s_ll_tx_set_chan_mod(i2s_dev_t *hw, uint32_t val)
static inline void i2s_ll_tx_select_slot(i2s_dev_t *hw, i2s_std_slot_sel_t slot_sel)
{
hw->conf_chan.tx_chan_mod = val;
switch (slot_sel)
{
case I2S_STD_SLOT_ONLY_LEFT:
hw->conf_chan.tx_chan_mod = 1;
break;
case I2S_STD_SLOT_ONLY_RIGHT:
hw->conf_chan.tx_chan_mod = 2;
break;
case I2S_STD_SLOT_LEFT_RIGHT:
hw->conf_chan.tx_chan_mod = 0;
break;
default:
break;
}
}
/**
* @brief Set I2S rx chan mode
*
* @param hw Peripheral I2S hardware instance address.
* @param slot_sel select slot to receive data
*/
static inline void i2s_ll_rx_select_slot(i2s_dev_t *hw, i2s_std_slot_sel_t slot_sel)
{
switch (slot_sel)
{
case I2S_STD_SLOT_ONLY_LEFT:
hw->conf_chan.rx_chan_mod = 1;
break;
case I2S_STD_SLOT_ONLY_RIGHT:
hw->conf_chan.rx_chan_mod = 2;
break;
case I2S_STD_SLOT_LEFT_RIGHT:
hw->conf_chan.rx_chan_mod = 0;
break;
default:
break;
}
}
/**