Skip to content

Commit

Permalink
revert commit/73ca054
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason2866 committed Aug 29, 2023
1 parent 5065c93 commit 87b93f2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 92 deletions.
56 changes: 10 additions & 46 deletions components/hal/esp32/include/hal/i2s_ll.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

#include <stdbool.h>
#include "hal/misc.h"
#include "hal/assert.h"
#include "soc/i2s_periph.h"
#include "soc/i2s_struct.h"
#include "hal/i2s_types.h"
Expand Down Expand Up @@ -689,57 +688,22 @@ 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 chan_fmt The channel format of the TX channel
*/
static inline void i2s_ll_tx_set_chan_mod(i2s_dev_t *hw, i2s_channel_fmt_t chan_fmt)
{
switch (chan_fmt) {
case I2S_CHANNEL_FMT_ALL_RIGHT:
hw->conf_chan.tx_chan_mod = 1;
break;
case I2S_CHANNEL_FMT_ONLY_RIGHT:
hw->conf_chan.tx_chan_mod = 3;
break;
case I2S_CHANNEL_FMT_ALL_LEFT:
hw->conf_chan.tx_chan_mod = 2;
break;
case I2S_CHANNEL_FMT_ONLY_LEFT:
hw->conf_chan.tx_chan_mod = 4;
break;
case I2S_CHANNEL_FMT_RIGHT_LEFT:
hw->conf_chan.tx_chan_mod = 0;
break;
default:
HAL_ASSERT(false);
}
* @param val value to set tx chan mode
*/
static inline void i2s_ll_tx_set_chan_mod(i2s_dev_t *hw, uint32_t val)
{
hw->conf_chan.tx_chan_mod = val;
}

/**
* @brief Set I2S rx chan mode
*
* @param hw Peripheral I2S hardware instance address.
* @param chan_fmt The channel format of the RX channel
* @param is_msb_right Is msb_right enabled, if it does, we need to flip the channel
*/
static inline void i2s_ll_rx_set_chan_mod(i2s_dev_t *hw, i2s_channel_fmt_t chan_fmt, bool is_msb_right)
{
switch (chan_fmt) {
case I2S_CHANNEL_FMT_ALL_RIGHT:
/* fall through */
case I2S_CHANNEL_FMT_ONLY_RIGHT:
hw->conf_chan.rx_chan_mod = is_msb_right ? 1 : 2;
break;
case I2S_CHANNEL_FMT_ALL_LEFT:
/* fall through */
case I2S_CHANNEL_FMT_ONLY_LEFT:
hw->conf_chan.rx_chan_mod = is_msb_right ? 2 : 1;
break;
case I2S_CHANNEL_FMT_RIGHT_LEFT:
hw->conf_chan.rx_chan_mod = 0;
break;
default:
HAL_ASSERT(false);
}
* @param val value to set rx chan mode
*/
static inline void i2s_ll_rx_set_chan_mod(i2s_dev_t *hw, uint32_t val)
{
hw->conf_chan.rx_chan_mod = val;
}

/**
Expand Down
56 changes: 10 additions & 46 deletions components/hal/esp32s2/include/hal/i2s_ll.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

#include <stdbool.h>
#include "hal/misc.h"
#include "hal/assert.h"
#include "soc/i2s_periph.h"
#include "soc/i2s_struct.h"
#include "hal/i2s_types.h"
Expand Down Expand Up @@ -765,57 +764,22 @@ 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 chan_fmt The channel format of the TX channel
*/
static inline void i2s_ll_tx_set_chan_mod(i2s_dev_t *hw, i2s_channel_fmt_t chan_fmt)
{
switch (chan_fmt) {
case I2S_CHANNEL_FMT_ALL_RIGHT:
hw->conf_chan.tx_chan_mod = 1;
break;
case I2S_CHANNEL_FMT_ONLY_RIGHT:
hw->conf_chan.tx_chan_mod = 3;
break;
case I2S_CHANNEL_FMT_ALL_LEFT:
hw->conf_chan.tx_chan_mod = 2;
break;
case I2S_CHANNEL_FMT_ONLY_LEFT:
hw->conf_chan.tx_chan_mod = 4;
break;
case I2S_CHANNEL_FMT_RIGHT_LEFT:
hw->conf_chan.tx_chan_mod = 0;
break;
default:
HAL_ASSERT(false);
}
* @param val value to set tx chan mode
*/
static inline void i2s_ll_tx_set_chan_mod(i2s_dev_t *hw, uint32_t val)
{
hw->conf_chan.tx_chan_mod = val;
}

/**
* @brief Set I2S rx chan mode
*
* @param hw Peripheral I2S hardware instance address.
* @param chan_fmt The channel format of the RX channel
* @param is_msb_right Is msb_right enabled, if it does, we need to flip the channel
*/
static inline void i2s_ll_rx_set_chan_mod(i2s_dev_t *hw, i2s_channel_fmt_t chan_fmt, bool is_msb_right)
{
switch (chan_fmt) {
case I2S_CHANNEL_FMT_ALL_RIGHT:
/* fall through */
case I2S_CHANNEL_FMT_ONLY_RIGHT:
hw->conf_chan.rx_chan_mod = is_msb_right ? 1 : 2;
break;
case I2S_CHANNEL_FMT_ALL_LEFT:
/* fall through */
case I2S_CHANNEL_FMT_ONLY_LEFT:
hw->conf_chan.rx_chan_mod = is_msb_right ? 2 : 1;
break;
case I2S_CHANNEL_FMT_RIGHT_LEFT:
hw->conf_chan.rx_chan_mod = 0;
break;
default:
HAL_ASSERT(false);
}
* @param val value to set rx chan mode
*/
static inline void i2s_ll_rx_set_chan_mod(i2s_dev_t *hw, uint32_t val)
{
hw->conf_chan.rx_chan_mod = val;
}

/**
Expand Down

1 comment on commit 87b93f2

@Jason2866
Copy link
Collaborator Author

@Jason2866 Jason2866 commented on 87b93f2 Aug 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

espressif/arduino-esp32#8577 and espressif/arduino-esp32#8583
reverts i2s: fixed incorrect channel format on ESP32
NOTE: The original IDF commit was made to fix I2S microphones. Reverting it might break I2S microphones in Arduino.

Please sign in to comment.