clang-format

custom
jacqueline 2 years ago
parent 9d33c33c8d
commit 97bd3be892
  1. 5
      src/app_console/app_console.cpp
  2. 6
      src/audio/audio_task.cpp
  3. 8
      src/audio/i2s_audio_output.cpp
  4. 5
      src/drivers/i2s_dac.cpp
  5. 4
      src/drivers/include/wm8523.hpp
  6. 4
      src/drivers/wm8523.cpp

@ -249,8 +249,9 @@ int CmdDbIndex(int argc, char** argv) {
return -1; return -1;
} }
if (res->values().at(choice).track()) { if (res->values().at(choice).track()) {
AppConsole::sTrackQueue->IncludeLast(std::make_shared<playlist::IndexRecordSource>( AppConsole::sTrackQueue->IncludeLast(
AppConsole::sDatabase, res, 0, res, choice)); std::make_shared<playlist::IndexRecordSource>(AppConsole::sDatabase,
res, 0, res, choice));
} }
auto cont = res->values().at(choice).Expand(20); auto cont = res->values().at(choice).Expand(20);
if (!cont) { if (!cont) {

@ -81,10 +81,8 @@ auto Timer::AddBytes(std::size_t bytes) -> void {
total_duration_seconds_ = current_seconds_; total_duration_seconds_ = current_seconds_;
} }
PlaybackUpdate ev{ PlaybackUpdate ev{.seconds_elapsed = current_seconds_,
.seconds_elapsed = current_seconds_, .seconds_total = total_duration_seconds_};
.seconds_total = total_duration_seconds_
};
events::Audio().Dispatch(ev); events::Audio().Dispatch(ev);
events::Ui().Dispatch(ev); events::Ui().Dispatch(ev);
} }

@ -82,13 +82,13 @@ auto I2SAudioOutput::SetVolume(uint_fast8_t percent) -> void {
using drivers::wm8523::Register; using drivers::wm8523::Register;
drivers::wm8523::WriteRegister(Register::kDacGainLeft, left); 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 { auto I2SAudioOutput::GetVolume() -> uint_fast8_t {
return return static_cast<uint_fast8_t>(static_cast<float>(current_volume_) /
static_cast<uint_fast8_t>( max_volume_ * 100.0f);
static_cast<float>(current_volume_) / max_volume_ * 100.0f);
} }
auto I2SAudioOutput::AdjustVolumeUp() -> bool { auto I2SAudioOutput::AdjustVolumeUp() -> bool {

@ -28,10 +28,10 @@
#include "hal/i2c_types.h" #include "hal/i2c_types.h"
#include "gpios.hpp" #include "gpios.hpp"
#include "wm8523.hpp"
#include "hal/i2s_types.h" #include "hal/i2s_types.h"
#include "i2c.hpp" #include "i2c.hpp"
#include "soc/clk_tree_defs.h" #include "soc/clk_tree_defs.h"
#include "wm8523.hpp"
namespace drivers { namespace drivers {
@ -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. // Set the correct word size, and set the input format to I2S-justified.
wm8523::WriteRegister(wm8523::Register::kAifCtrl1, (word_length << 3) | 0b10); wm8523::WriteRegister(wm8523::Register::kAifCtrl1, (word_length << 3) | 0b10);
// Tell the DAC the clock ratio instead of waiting for it to auto detect. // 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_) { if (i2s_active_) {
i2s_channel_enable(i2s_handle_); i2s_channel_enable(i2s_handle_);

@ -27,5 +27,5 @@ auto ReadRegister(Register reg) -> std::optional<uint16_t>;
auto WriteRegister(Register reg, uint16_t data) -> bool; auto WriteRegister(Register reg, uint16_t data) -> bool;
auto WriteRegister(Register reg, uint8_t msb, uint8_t lsb) -> bool; auto WriteRegister(Register reg, uint8_t msb, uint8_t lsb) -> bool;
} } // namespace wm8523
} } // namespace drivers

@ -47,5 +47,5 @@ auto WriteRegister(Register reg, uint8_t msb, uint8_t lsb) -> bool {
return transaction.Execute() == ESP_OK; return transaction.Execute() == ESP_OK;
} }
} } // namespace wm8523
} } // namespace drivers

Loading…
Cancel
Save