Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add I2S_MODE_ADC_BUILT_IN support to i2s_stream.c (AUD-4544) #988

Open
wants to merge 1 commit into
base: release/v2.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions components/audio_stream/i2s_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,10 @@ audio_element_handle_t i2s_stream_init(i2s_stream_cfg_t *config)
#if SOC_I2S_SUPPORTS_ADC_DAC
if ((config->i2s_config.mode & I2S_MODE_DAC_BUILT_IN) != 0) {
i2s_set_dac_mode(I2S_DAC_CHANNEL_BOTH_EN);
} else if ((config->i2s_config.mode & I2S_MODE_ADC_BUILT_IN) != 0) {
i2s_set_adc_mode(ADC_UNIT_1, ADC1_CHANNEL_7);
adc1_config_channel_atten(ADC1_CHANNEL_7, i2s->config.adc_atten_db);
i2s_adc_enable(i2s->config.i2s_port);
} else
#endif
{
Expand Down
1 change: 1 addition & 0 deletions components/audio_stream/include/i2s_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ typedef struct {
bool uninstall_drv; /*!< whether uninstall the i2s driver when stream destroyed*/
bool need_expand; /*!< whether to expand i2s data */
i2s_bits_per_sample_t expand_src_bits; /*!< The source bits per sample when data expand */
int adc_atten_db;
} i2s_stream_cfg_t;

#define I2S_STREAM_TASK_STACK (3072+512)
Expand Down