From 97bd3be892ce549dac8e0b9930607a282701653e Mon Sep 17 00:00:00 2001 From: jacqueline Date: Fri, 28 Jul 2023 15:25:44 +1000 Subject: [PATCH] clang-format --- src/app_console/app_console.cpp | 5 +++-- src/audio/audio_task.cpp | 6 ++---- src/audio/i2s_audio_output.cpp | 10 +++++----- src/drivers/i2s_dac.cpp | 7 ++++--- src/drivers/include/wm8523.hpp | 4 ++-- src/drivers/wm8523.cpp | 4 ++-- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/app_console/app_console.cpp b/src/app_console/app_console.cpp index bef29834..3e2d8067 100644 --- a/src/app_console/app_console.cpp +++ b/src/app_console/app_console.cpp @@ -249,8 +249,9 @@ int CmdDbIndex(int argc, char** argv) { return -1; } if (res->values().at(choice).track()) { - AppConsole::sTrackQueue->IncludeLast(std::make_shared( - AppConsole::sDatabase, res, 0, res, choice)); + AppConsole::sTrackQueue->IncludeLast( + std::make_shared(AppConsole::sDatabase, + res, 0, res, choice)); } auto cont = res->values().at(choice).Expand(20); if (!cont) { diff --git a/src/audio/audio_task.cpp b/src/audio/audio_task.cpp index 751366c1..ca6a3824 100644 --- a/src/audio/audio_task.cpp +++ b/src/audio/audio_task.cpp @@ -81,10 +81,8 @@ auto Timer::AddBytes(std::size_t bytes) -> void { total_duration_seconds_ = current_seconds_; } - PlaybackUpdate ev{ - .seconds_elapsed = current_seconds_, - .seconds_total = total_duration_seconds_ - }; + PlaybackUpdate ev{.seconds_elapsed = current_seconds_, + .seconds_total = total_duration_seconds_}; events::Audio().Dispatch(ev); events::Ui().Dispatch(ev); } diff --git a/src/audio/i2s_audio_output.cpp b/src/audio/i2s_audio_output.cpp index 5873d80f..bb413b38 100644 --- a/src/audio/i2s_audio_output.cpp +++ b/src/audio/i2s_audio_output.cpp @@ -48,7 +48,7 @@ I2SAudioOutput::I2SAudioOutput(drivers::IGpios* expander, current_config_(), left_difference_(0), current_volume_(kDefaultVolume), - max_volume_(kLineLevelVolume){ + max_volume_(kLineLevelVolume) { SetVolume(GetVolume()); dac_->SetSource(stream()); } @@ -82,13 +82,13 @@ auto I2SAudioOutput::SetVolume(uint_fast8_t percent) -> void { using drivers::wm8523::Register; drivers::wm8523::WriteRegister(Register::kDacGainLeft, left); - drivers::wm8523::WriteRegister(Register::kDacGainRight, current_volume_ | 0x200); + drivers::wm8523::WriteRegister(Register::kDacGainRight, + current_volume_ | 0x200); } auto I2SAudioOutput::GetVolume() -> uint_fast8_t { - return - static_cast( - static_cast(current_volume_) / max_volume_ * 100.0f); + return static_cast(static_cast(current_volume_) / + max_volume_ * 100.0f); } auto I2SAudioOutput::AdjustVolumeUp() -> bool { diff --git a/src/drivers/i2s_dac.cpp b/src/drivers/i2s_dac.cpp index e4e782c2..c835fb1f 100644 --- a/src/drivers/i2s_dac.cpp +++ b/src/drivers/i2s_dac.cpp @@ -28,10 +28,10 @@ #include "hal/i2c_types.h" #include "gpios.hpp" -#include "wm8523.hpp" #include "hal/i2s_types.h" #include "i2c.hpp" #include "soc/clk_tree_defs.h" +#include "wm8523.hpp" namespace drivers { @@ -106,7 +106,7 @@ auto I2SDac::Start() -> void { vTaskDelay(pdMS_TO_TICKS(1)); wm8523::WriteRegister(wm8523::Register::kPsCtrl, 0b10); - uint8_t zeroes[256] {0}; + uint8_t zeroes[256]{0}; size_t bytes_loaded = 0; esp_err_t res = ESP_OK; do { @@ -180,7 +180,8 @@ auto I2SDac::Reconfigure(Channels ch, BitsPerSample bps, SampleRate rate) // Set the correct word size, and set the input format to I2S-justified. wm8523::WriteRegister(wm8523::Register::kAifCtrl1, (word_length << 3) | 0b10); // Tell the DAC the clock ratio instead of waiting for it to auto detect. - wm8523::WriteRegister(wm8523::Register::kAifCtrl2, bps == BPS_24 ? 0b100 : 0b011); + wm8523::WriteRegister(wm8523::Register::kAifCtrl2, + bps == BPS_24 ? 0b100 : 0b011); if (i2s_active_) { i2s_channel_enable(i2s_handle_); diff --git a/src/drivers/include/wm8523.hpp b/src/drivers/include/wm8523.hpp index 8b20eda0..6dc2e56e 100644 --- a/src/drivers/include/wm8523.hpp +++ b/src/drivers/include/wm8523.hpp @@ -27,5 +27,5 @@ auto ReadRegister(Register reg) -> std::optional; auto WriteRegister(Register reg, uint16_t data) -> bool; auto WriteRegister(Register reg, uint8_t msb, uint8_t lsb) -> bool; -} -} +} // namespace wm8523 +} // namespace drivers diff --git a/src/drivers/wm8523.cpp b/src/drivers/wm8523.cpp index dbd4a88e..e1dffd51 100644 --- a/src/drivers/wm8523.cpp +++ b/src/drivers/wm8523.cpp @@ -47,5 +47,5 @@ auto WriteRegister(Register reg, uint8_t msb, uint8_t lsb) -> bool { return transaction.Execute() == ESP_OK; } -} -} +} // namespace wm8523 +} // namespace drivers