From bfc55beedc9aa486aaa82dcc08ca68b4dec7a389 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Mon, 13 Jun 2022 12:39:55 +1200 Subject: [PATCH] Fix and add to test4 --- .../components/es8388/es8388_component.cpp | 46 +++++++++---------- tests/test4.yaml | 3 ++ 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/esphome/components/es8388/es8388_component.cpp b/esphome/components/es8388/es8388_component.cpp index 41e9bed566..8b08fe2992 100644 --- a/esphome/components/es8388/es8388_component.cpp +++ b/esphome/components/es8388/es8388_component.cpp @@ -8,45 +8,45 @@ void ES8388Component::setup() { this->power_pin_->digital_write(false); // reset - this->write_bytes(0x00, {0x80}, 1); - this->write_bytes(0x00, {0x00}, 1); + this->write_bytes(0x00, {0x80}); + this->write_bytes(0x00, {0x00}); // mute - this->write_bytes(0x19, {0x04}, 1); - this->write_bytes(0x01, {0x50}, 1); + this->write_bytes(0x19, {0x04}); + this->write_bytes(0x01, {0x50}); // powerup - this->write_bytes(0x02, {0x00}, 1); + this->write_bytes(0x02, {0x00}); // slave mode - this->write_bytes(0x08, {0x00}, 1); + this->write_bytes(0x08, {0x00}); // DAC powerdown - this->write_bytes(0x04, {0xC0}, 1); + this->write_bytes(0x04, {0xC0}); // vmidsel/500k ADC/DAC idem - this->write_bytes(0x00, {0x12}, 1); + this->write_bytes(0x00, {0x12}); - this->write_bytes(0x01, {0x00}, 1); + this->write_bytes(0x01, {0x00}); // i2s 16 bits - this->write_bytes(0x17, {0x18}, 1); + this->write_bytes(0x17, {0x18}); // sample freq 256 - this->write_bytes(0x18, {0x02}, 1); + this->write_bytes(0x18, {0x02}); // LIN2/RIN2 for mixer - this->write_bytes(0x26, {0x09}, 1); + this->write_bytes(0x26, {0x09}); // left DAC to left mixer - this->write_bytes(0x27, {0x90}, 1); + this->write_bytes(0x27, {0x90}); // right DAC to right mixer - this->write_bytes(0x2A, {0x90}, 1); + this->write_bytes(0x2A, {0x90}); // DACLRC ADCLRC idem - this->write_bytes(0x2B, {0x80}, 1); - this->write_bytes(0x2D, {0x00}, 1); + this->write_bytes(0x2B, {0x80}); + this->write_bytes(0x2D, {0x00}); // DAC volume max - this->write_bytes(0x1B, {0x00}, 1); - this->write_bytes(0x1A, {0x00}, 1); + this->write_bytes(0x1B, {0x00}); + this->write_bytes(0x1A, {0x00}); - this->write_bytes(0x02, {0xF0}, 1); - this->write_bytes(0x02, {0x00}, 1); - this->write_bytes(0x1D, {0x1C}, 1); + this->write_bytes(0x02, {0xF0}); + this->write_bytes(0x02, {0x00}); + this->write_bytes(0x1D, {0x1C}); // DAC power-up LOUT1/ROUT1 enabled - this->write_bytes(0x04, {0x30}, 1); + this->write_bytes(0x04, {0x30}); // unmute - this->write_bytes(0x19, {0x00}, 1); + this->write_bytes(0x19, {0x00}); // Turn on amplifier this->power_pin_->digital_write(true); diff --git a/tests/test4.yaml b/tests/test4.yaml index 7b8f139a43..d88dbca981 100644 --- a/tests/test4.yaml +++ b/tests/test4.yaml @@ -716,3 +716,6 @@ voice_assistant: - logger.log: format: "Voice assistant error - code %s, message: %s" args: [code.c_str(), message.c_str()] + +es8388: + power_pin: GPIO21