summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-09-05 16:01:05 +1000
committerjacqueline <me@jacqueline.id.au>2023-09-05 16:01:05 +1000
commita9008884c93946f26fd26448aeb716d005693d6c (patch)
tree4c8c5fd15da77e1e4fa28533a357e628df383180 /src
parent020d42d43156423488df4ea4538f4952a3c97c48 (diff)
downloadtangara-fw-a9008884c93946f26fd26448aeb716d005693d6c.tar.gz
Improve dac startup sequencing to reduce the clicky poppy
Diffstat (limited to 'src')
-rw-r--r--src/drivers/i2s_dac.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/drivers/i2s_dac.cpp b/src/drivers/i2s_dac.cpp
index bedf7ebf..2fdd826f 100644
--- a/src/drivers/i2s_dac.cpp
+++ b/src/drivers/i2s_dac.cpp
@@ -93,22 +93,21 @@ I2SDac::I2SDac(IGpios& gpio, i2s_chan_handle_t i2s_handle)
wm8523::WriteRegister(wm8523::Register::kReset, 1);
vTaskDelay(pdMS_TO_TICKS(10));
wm8523::WriteRegister(wm8523::Register::kPsCtrl, 0b0);
+
+ gpio_.WriteSync(IGpios::Pin::kAmplifierEnable, true);
}
I2SDac::~I2SDac() {
Stop();
i2s_del_channel(i2s_handle_);
+
+ gpio_.WriteSync(IGpios::Pin::kAmplifierEnable, false);
}
auto I2SDac::Start() -> void {
std::lock_guard<std::mutex> lock(configure_mutex_);
gpio_.WriteSync(IGpios::Pin::kAmplifierUnmute, false);
- // Ramp up the amplifier power supply.
- gpio_.WriteSync(IGpios::Pin::kAmplifierEnable, true);
-
- // Wait for voltage to stabilise
- vTaskDelay(pdMS_TO_TICKS(5));
// Ensure the DAC powers up to a muted state.
wm8523::WriteRegister(wm8523::Register::kPsCtrl, 0b10);
@@ -118,12 +117,7 @@ auto I2SDac::Start() -> void {
i2s_channel_enable(i2s_handle_);
i2s_active_ = true;
- // Wait for DAC output lines to stabilise
- vTaskDelay(pdMS_TO_TICKS(5));
-
wm8523::WriteRegister(wm8523::Register::kPsCtrl, 0b11);
-
- vTaskDelay(pdMS_TO_TICKS(5));
gpio_.WriteSync(IGpios::Pin::kAmplifierUnmute, true);
}