mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 12:53:26 +00:00
[i2s_audio] Reset dout GPIO when stopping speaker driver (#16573)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#ifdef USE_ESP32
|
||||
|
||||
#include <driver/gpio.h>
|
||||
#include <driver/i2s_std.h>
|
||||
|
||||
#include "esphome/components/audio/audio.h"
|
||||
@@ -299,6 +300,15 @@ void I2SAudioSpeakerBase::stop_i2s_driver_() {
|
||||
i2s_channel_disable(this->tx_handle_);
|
||||
i2s_del_channel(this->tx_handle_);
|
||||
this->tx_handle_ = nullptr;
|
||||
|
||||
// i2s_del_channel() leaves dout wired to this port's data-out signal in the GPIO matrix: it only
|
||||
// clears an internal reservation mask, never the esp_rom_gpio_connect_out_signal() routing that
|
||||
// setup installed. If another speaker reuses this port (shared bus), its audio still reaches our
|
||||
// dout. Detach the pin and drive it low so a stale output stops driving downstream hardware: a
|
||||
// SPDIF optical transmitter would otherwise stay lit, and an analog DAC would emit noise.
|
||||
gpio_reset_pin(this->dout_pin_);
|
||||
gpio_set_direction(this->dout_pin_, GPIO_MODE_OUTPUT);
|
||||
gpio_set_level(this->dout_pin_, 0);
|
||||
}
|
||||
this->parent_->unlock();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user