Compare commits
2 Commits
@@ -174,11 +174,23 @@ menu "Audio Board"
|
|||||||
menu "DAC-Operation-Mode"
|
menu "DAC-Operation-Mode"
|
||||||
depends on DAC_TAS5805M
|
depends on DAC_TAS5805M
|
||||||
|
|
||||||
config DAC_BRIDGE_MODE
|
choice DAC_BRIDGE_MODE
|
||||||
bool "Enable Bridge-Mode"
|
prompt "Bridge-Mode selection"
|
||||||
default false if DAC_TAS5805M
|
default DAC_BRIDGE_MODE_DISABLED
|
||||||
help
|
|
||||||
If enabled left channel will be played with more power. To use the right channel please change Word-Select-Setting in Logic-Level-Settings.
|
config DAC_BRIDGE_MODE_DISABLED
|
||||||
|
bool "Stereo (bridge mode disabled)"
|
||||||
|
|
||||||
|
config DAC_BRIDGE_MODE_MONO
|
||||||
|
bool "Mono mode (Left + Right / 2)"
|
||||||
|
|
||||||
|
config DAC_BRIDGE_MODE_LEFT
|
||||||
|
bool "Output left input channel"
|
||||||
|
|
||||||
|
config DAC_BRIDGE_MODE_RIGHT
|
||||||
|
bool "Output right input channel"
|
||||||
|
|
||||||
|
endchoice
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
menu "Merus MA120x0 interface Configuration"
|
menu "Merus MA120x0 interface Configuration"
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ esp_err_t pcm5102a_init(audio_hal_codec_config_t *codec_cfg) {
|
|||||||
|
|
||||||
gpio_config_t io_conf;
|
gpio_config_t io_conf;
|
||||||
|
|
||||||
|
if (CONFIG_PCM5102A_MUTE_PIN < 0) {
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
io_conf.intr_type = GPIO_INTR_DISABLE;
|
io_conf.intr_type = GPIO_INTR_DISABLE;
|
||||||
io_conf.mode = GPIO_MODE_OUTPUT;
|
io_conf.mode = GPIO_MODE_OUTPUT;
|
||||||
io_conf.pin_bit_mask = (1ULL << CONFIG_PCM5102A_MUTE_PIN);
|
io_conf.pin_bit_mask = (1ULL << CONFIG_PCM5102A_MUTE_PIN);
|
||||||
@@ -65,12 +69,20 @@ esp_err_t pcm5102a_set_volume(int vol) { return ESP_OK; }
|
|||||||
esp_err_t pcm5102a_get_volume(int *value) { return ESP_OK; }
|
esp_err_t pcm5102a_get_volume(int *value) { return ESP_OK; }
|
||||||
|
|
||||||
esp_err_t pcm5102a_set_mute(bool enable) {
|
esp_err_t pcm5102a_set_mute(bool enable) {
|
||||||
|
if (CONFIG_PCM5102A_MUTE_PIN < 0) {
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
return gpio_set_level(CONFIG_PCM5102A_MUTE_PIN, enable ? 0 : 1);
|
return gpio_set_level(CONFIG_PCM5102A_MUTE_PIN, enable ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t pcm5102a_get_mute(bool *enabled) { return ESP_OK; }
|
esp_err_t pcm5102a_get_mute(bool *enabled) { return ESP_OK; }
|
||||||
|
|
||||||
esp_err_t pcm5102a_deinit(void) {
|
esp_err_t pcm5102a_deinit(void) {
|
||||||
|
if (CONFIG_PCM5102A_MUTE_PIN < 0) {
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
return gpio_reset_pin(CONFIG_PCM5102A_MUTE_PIN);
|
return gpio_reset_pin(CONFIG_PCM5102A_MUTE_PIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -167,14 +167,82 @@ esp_err_t tas5805m_init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if Bridge-Mode is enabled
|
// Check if Bridge-Mode is enabled
|
||||||
#ifdef CONFIG_DAC_BRIDGE_MODE
|
#if defined(CONFIG_DAC_BRIDGE_MODE_MONO) || defined(CONFIG_DAC_BRIDGE_MODE_LEFT) || defined(CONFIG_DAC_BRIDGE_MODE_RIGHT)
|
||||||
uint8_t value = 0;
|
ESP_LOGV(TAG, "Setting Bridge-Mode");
|
||||||
ret = tas5805m_read_byte(TAS5805M_DEVICE_CTRL_1_REGISTER, &value);
|
|
||||||
if (ret != ESP_OK) return ret;
|
|
||||||
value = 0b100;
|
|
||||||
|
|
||||||
ret = tas5805m_write_byte(TAS5805M_DEVICE_CTRL_1_REGISTER, value);
|
// enable bridge mode
|
||||||
if (ret != ESP_OK) return ret;
|
ret = tas5805m_write_byte(TAS5805M_DEVICE_CTRL_1_REGISTER, 0x04);
|
||||||
|
|
||||||
|
// Mixer config
|
||||||
|
ret |= tas5805m_write_byte(0x0, 0x0);
|
||||||
|
ret |= tas5805m_write_byte(0x7f, 0x8c);
|
||||||
|
ret |= tas5805m_write_byte(0x0, 0x29);
|
||||||
|
|
||||||
|
#if defined(CONFIG_DAC_BRIDGE_MODE_MONO)
|
||||||
|
ESP_LOGI(TAG, "Defining Bridge-Mode to Mono");
|
||||||
|
// Left mixer input to left ouput (-6 dB)
|
||||||
|
ret |= tas5805m_write_byte(0x18, 0x00);
|
||||||
|
ret |= tas5805m_write_byte(0x19, 0x40);
|
||||||
|
ret |= tas5805m_write_byte(0x1a, 0x26);
|
||||||
|
ret |= tas5805m_write_byte(0x1b, 0xe7);
|
||||||
|
|
||||||
|
// Right mixer input to left ouput (-6 dB)
|
||||||
|
ret |= tas5805m_write_byte(0x1c, 0x00);
|
||||||
|
ret |= tas5805m_write_byte(0x1d, 0x40);
|
||||||
|
ret |= tas5805m_write_byte(0x1e, 0x26);
|
||||||
|
ret |= tas5805m_write_byte(0x1f, 0xe7);
|
||||||
|
|
||||||
|
#elif defined(CONFIG_DAC_BRIDGE_MODE_LEFT)
|
||||||
|
ESP_LOGI(TAG, "Defining Bridge-Mode to Left");
|
||||||
|
// Left mixer input to left ouput (0 dB)
|
||||||
|
ret |= tas5805m_write_byte(0x18, 0x00);
|
||||||
|
ret |= tas5805m_write_byte(0x19, 0x80);
|
||||||
|
ret |= tas5805m_write_byte(0x1a, 0x00);
|
||||||
|
ret |= tas5805m_write_byte(0x1b, 0x00);
|
||||||
|
|
||||||
|
// Right mixer input to left ouput (-110 dB)
|
||||||
|
ret |= tas5805m_write_byte(0x1c, 0x00);
|
||||||
|
ret |= tas5805m_write_byte(0x1d, 0x00);
|
||||||
|
ret |= tas5805m_write_byte(0x1e, 0x00);
|
||||||
|
ret |= tas5805m_write_byte(0x1f, 0x00);
|
||||||
|
|
||||||
|
#elif defined(CONFIG_DAC_BRIDGE_MODE_RIGHT)
|
||||||
|
ESP_LOGI(TAG, "Defining Bridge-Mode to Right");
|
||||||
|
// Left mixer input to left ouput (-110 dB)
|
||||||
|
ret |= tas5805m_write_byte(0x18, 0x00);
|
||||||
|
ret |= tas5805m_write_byte(0x19, 0x00);
|
||||||
|
ret |= tas5805m_write_byte(0x1a, 0x00);
|
||||||
|
ret |= tas5805m_write_byte(0x1b, 0x00);
|
||||||
|
|
||||||
|
// Right mixer input to left ouput (0 dB)
|
||||||
|
ret |= tas5805m_write_byte(0x1c, 0x00);
|
||||||
|
ret |= tas5805m_write_byte(0x1d, 0x80);
|
||||||
|
ret |= tas5805m_write_byte(0x1e, 0x00);
|
||||||
|
ret |= tas5805m_write_byte(0x1f, 0x00);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Left mixer input to right ouput (-110 dB as the right output is not used)
|
||||||
|
ret |= tas5805m_write_byte(0x20, 0x00);
|
||||||
|
ret |= tas5805m_write_byte(0x21, 0x00);
|
||||||
|
ret |= tas5805m_write_byte(0x22, 0x00);
|
||||||
|
ret |= tas5805m_write_byte(0x23, 0x00);
|
||||||
|
|
||||||
|
// Right mixer input to right ouput (-110 dB as the right output is not used)
|
||||||
|
ret |= tas5805m_write_byte(0x24, 0x00);
|
||||||
|
ret |= tas5805m_write_byte(0x25, 0x00);
|
||||||
|
ret |= tas5805m_write_byte(0x26, 0x00);
|
||||||
|
ret |= tas5805m_write_byte(0x27, 0x00);
|
||||||
|
|
||||||
|
|
||||||
|
// End config
|
||||||
|
ret |= tas5805m_write_byte(0x0, 0x0);
|
||||||
|
ret |= tas5805m_write_byte(0x7f, 0x0);
|
||||||
|
|
||||||
|
if (ret != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "Setting Bridge-Mode failed");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user